Previous 15994 Revisions Next

r11225 Monday 18th April, 2011 at 07:21:15 UTC by Miodrag Milanović
Sync with MAME (r12174)
[src]version.c
[src/build]makelist.c
[src/emu]addrmap.c addrmap.h audit.c audit.h clifront.c clifront.h delegate.c delegate.h devcb.h driver.c driver.h emualloc.c emucore.h emutempl.h hash.c image.c info.h machine.c mame.h memory.c memory.h softlist.h uiswlist.c video.c
[src/emu/cpu/dsp56k]dsp56k.c
[src/emu/cpu/m68000]m68kcpu.c m68kcpu.h
[src/emu/cpu/upd7725]upd7725.h
[src/emu/imagedev]cassette.c chd_cd.c flopdrv.c
[src/emu/machine]cdp1852.c com8116.c i8214.c idectrl.c mc6852.c mc6852.h mos6529.c msm5832.c msm58321.c nvram.c nvram.h pic8259.c pic8259.h rp5c01.c upd7201.c upd7201.h
[src/emu/sound]k053260.c pokey.c tms5220.c wave.c ymz280b.c
[src/emu/video]cdp1861.c cdp1862.c dm9368.c hd44102.c pc_vga.c sed1330.c sed1330.h upd3301.c upd3301.h
[src/mame]mame.lst mame.mak
[src/mame/audio]beezer.c cage.c leland.c
[src/mame/drivers]2mindril.c alien.c atarig42.c atarisy2.c beathead.c bfm_sc1.c btoads.c cesclass.c cidelsa.c cojag.c combatsc.c cps3.c dec0.c famibox.c firebeat.c funworld.c hng64.c igs011.c majorpkr.c mediagx.c metro.c midqslvr.c midzeus.c missile.c model1.c model2.c mpu3.c* mpu4.c mpu4drvr.c namcos11.c nwk-tr.c plygonet.c segaorun.c segas16b.c segas18.c segas24.c spoker.c starwars.c taito_f3.c vcombat.c vegas.c viper.c
[src/mame/includes]4enraya.h cidelsa.h mcr68.h segas24.h taito_f3.h
[src/mame/layout]bfm_sc1.lay
[src/mame/machine]archimds.c atarigen.c beezer.c mcr68.c mhavoc.c midyunit.c namcos1.c segaic16.c segaic16.h snes.c steppers.c steppers.h
[src/mame/video]cidelsa.c model1.c model2.c segaic24.c segaic24.h segas24.c taito_f3.c victory.c
[src/mess/drivers]a2600.c abc80x.c atm.c avigo.c bw2.c cosmicos.c elf.c elwro800.c gba.c mc1000.c mpf1.c pcw16.c pentagon.c psx.c ql.c scorpion.c sg1000.c spectrum.c ti89.c tiki100.c tm990189.c vcs80.c vip.c vixen.c x68k.c
[src/mess/includes]apple2.h genpc.h hp48.h nes.h
[src/mess/machine]amstrad.c apple2.c apple2gs.c apple3.c bbc.c compis.c comx35.c dgn_beta.c genpc.c hp48.c isa.c isa.h isa_adlib.c isa_com.c isa_fdc.c isa_gblaster.c isa_hdc.c isa_sblaster.c lviv.c mac.c mbee.c mpc105.c nes.c nes_pcb.c osborne1.c pmd85.c rmnimbus.c sms.c thomson.c vic1112.c vtech2.c z80ne.c zx.c
[src/mess/machine/ti99]spchsyn.c speech8.c
[src/mess/video]cirrus.c ibm_vga.c isa_mda.c pc_vga_mess.c pc_vga_mess.h thomson.c
[src/osd]osdcore.h
[src/osd/sdl]osd_opengl.h sdl.mak sdlmain.c

src/build/makelist.c
r11224r11225
8989      fprintf(stderr, "Unable to read source file '%s'\n", srcfile);
9090      return 1;
9191   }
92   
92
9393   // rip through it to find all drivers
9494   int drivcount = 0;
9595   char *srcptr = (char *)buffer;
r11224r11225
9999   while (srcptr < endptr)
100100   {
101101      char c = *srcptr++;
102     
102
103103      // count newlines
104104      if (c == 13 || c == 10)
105105      {
r11224r11225
108108         linenum++;
109109         continue;
110110      }
111   
111
112112      // skip any spaces
113113      if (isspace(c))
114114         continue;
115     
115
116116      // look for end of C comment
117117      if (in_comment && c == '*' && *srcptr == '/')
118118      {
r11224r11225
120120         in_comment = false;
121121         continue;
122122      }
123     
123
124124      // skip anything else inside a C comment
125125      if (in_comment)
126126         continue;
127     
127
128128      // look for start of C comment
129129      if (c == '/' && *srcptr == '*')
130130      {
r11224r11225
132132         in_comment = true;
133133         continue;
134134      }
135     
135
136136      // if we hit a C++ comment, scan to the end of line
137137      if (c == '/' && *srcptr == '/')
138138      {
r11224r11225
140140            srcptr++;
141141         continue;
142142      }
143     
143
144144      // extract the driver name
145145      char drivname[32];
146146      drivname[0] = 0;
r11224r11225
150150         drivname[pos] = *srcptr++;
151151         drivname[pos+1] = 0;
152152      }
153     
153
154154      // verify the name as valid
155155      for (char *drivch = drivname; *drivch != 0; drivch++)
156156      {
r11224r11225
159159         fprintf(stderr, "%s:%d - Invalid character '%c' in driver \"%s\"\n", srcfile, linenum, *drivch, drivname);
160160         return 1;
161161      }
162     
162
163163      // add it to the list
164164      char *name = (char *)malloc(strlen(drivname) + 1);
165165      strcpy(name, drivname);
166166      drivlist[drivcount++] = name;
167167   }
168   
168
169169   // add a reference to the ___empty driver
170170   drivlist[drivcount++] = "___empty";
171   
171
172172   // output a count
173173   if (drivcount == 0)
174174   {
r11224r11225
176176      return 1;
177177   }
178178   fprintf(stderr, "%d drivers found\n", drivcount);
179   
179
180180   // sort the list
181181   qsort(drivlist, drivcount, sizeof(*drivlist), sort_callback);
182   
182
183183   // start with a header
184184   printf("#include \"emu.h\"\n\n");
185   
185
186186   // output the list of externs first
187187   for (int index = 0; index < drivcount; index++)
188188      printf("GAME_EXTERN(%s);\n", drivlist[index]);
r11224r11225
195195      printf("\t&GAME_NAME(%s)%s\n", drivlist[index], (index == drivcount - 1) ? "" : ",");
196196   printf("};\n");
197197   printf("\n");
198   
198
199199   // also output a global count
200200   printf("int driver_list::s_driver_count = %d;\n", drivcount);
201201
src/mame/mame.lst
r11224r11225
1066910669screenp1
1067010670screenp2
1067110671
10672// MPU3
10673mpu3utst
10674m_hprvpr
10675
1067210676// MPU4
1067310677m_oldtmr      // Barcrest - highly prelim
1067410678m_ccelbr
src/mame/audio/cage.c
r11224r11225
5252
5353   UINT8 timer_enabled[2];
5454   timer_device *timer[2];
55   
55
5656   UINT32 tms32031_io_regs[0x100];
5757   UINT16 from_main;
5858   UINT16 control;
src/mame/audio/leland.c
r11224r11225
560560   state->m_i80186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
561561   state->m_i80186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
562562   state->m_i80186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
563   state->m_i80186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
564   state->m_i80186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
565   state->m_i80186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
563   state->m_i80186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
564   state->m_i80186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
565   state->m_i80186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
566566   state->m_i80186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback), device);
567567   state->m_i80186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback), device);
568568
569569   for (i = 0; i < 9; i++)
570      state->m_counter[i].timer = machine.scheduler().timer_alloc(FUNC(NULL));
570      state->m_counter[i].timer = machine.scheduler().timer_alloc(FUNC_NULL);
571571}
572572
573573static DEVICE_START( leland_80186_sound )
src/mame/audio/beezer.c
r11224r11225
1616     a silence waveform for 55516, alternating zeroes and ones.
1717    * The channel mixing is done additively at the moment rather than
1818     emulating the original multiplexer, which is actually not that hard to do
19    but adds a bit of complexity to the render loop.
19    but adds a bit of complexity to the render loop.
2020    * The 'FM OR AM' output of the audio via (pb1) appears to control some sort
2121     of suppression or filtering change of the post-DAC amplifier when enabled,
2222     only during the TIMER1 OUT time-slot of the multiplexer, see page 1B 3-3
r11224r11225
3232     of 74ls670 4x4 register files wired up as four 8-bit words;
3333     The four words are used as the volumes for four 1-bit channels by inversion
3434     of the MSB of the 8 bit value.
35   NOISE is the output of an MM5837 whitenoise generator, a self-clocked (at
36    around 100khz) LFSR with taps on bits (base-0) 16 and 13.
35    NOISE is the output of an MM5837 whitenoise generator, a self-clocked (at
36     around 100khz) LFSR with taps on bits (base-0) 16 and 13.
3737    The four channels are:
3838    CNT1 CNT0
3939    0    0    6522 pin 7 output (squarewave); 'FM or AM' affects this slot only
src/mame/machine/midyunit.c
r11224r11225
506506
507507/********************** Terminator 2 **********************/
508508
509static void term2_init_common(running_machine &machine, write16_space_func hack_w)
509static void term2_init_common(running_machine &machine, write16_space_func hack_w, const char *name)
510510{
511511   midyunit_state *state = machine.driver_data<midyunit_state>();
512512   /* protection */
r11224r11225
526526
527527   /* HACK: this prevents the freeze on the movies */
528528   /* until we figure whats causing it, this is better than nothing */
529   state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x010aa0e0, 0x010aa0ff, FUNC(hack_w));
529   state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x010aa0e0, 0x010aa0ff, hack_w, name);
530530}
531531
532DRIVER_INIT( term2 ) { term2_init_common(machine, term2_hack_w); }
533DRIVER_INIT( term2la3 ) { term2_init_common(machine, term2la3_hack_w); }
534DRIVER_INIT( term2la2 ) { term2_init_common(machine, term2la2_hack_w); }
535DRIVER_INIT( term2la1 ) { term2_init_common(machine, term2la1_hack_w); }
532DRIVER_INIT( term2 ) { term2_init_common(machine, FUNC(term2_hack_w)); }
533DRIVER_INIT( term2la3 ) { term2_init_common(machine, FUNC(term2la3_hack_w)); }
534DRIVER_INIT( term2la2 ) { term2_init_common(machine, FUNC(term2la2_hack_w)); }
535DRIVER_INIT( term2la1 ) { term2_init_common(machine, FUNC(term2la1_hack_w)); }
536536
537537
538538
src/mame/machine/mhavoc.c
r11224r11225
136136   cputag_set_input_line(machine, "gamma", INPUT_LINE_NMI, PULSE_LINE);
137137
138138   /* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */
139   machine.scheduler().timer_set(attotime::from_usec(250), FUNC(NULL));
139   machine.scheduler().timer_set(attotime::from_usec(250), FUNC_NULL);
140140}
141141
142142
src/mame/machine/namcos1.c
r11224r11225
5858static WRITE8_HANDLER( bank15_w ) { bank_w(space, offset, data, 14); }
5959static WRITE8_HANDLER( bank16_w ) { bank_w(space, offset, data, 15); }
6060
61static const read8_space_func io_bank_handler_r[16] =
61static const struct { read8_space_func func; const char *name; } io_bank_handler_r[16] =
6262{
63   bank1_r, bank2_r, bank3_r, bank4_r,
64   bank5_r, bank6_r, bank7_r, bank8_r,
65   bank9_r, bank10_r, bank11_r, bank12_r,
66   bank13_r, bank14_r, bank15_r, bank16_r
63   { FUNC(bank1_r) }, { FUNC(bank2_r) }, { FUNC(bank3_r) }, { FUNC(bank4_r) },
64   { FUNC(bank5_r) }, { FUNC(bank6_r) }, { FUNC(bank7_r) }, { FUNC(bank8_r) },
65   { FUNC(bank9_r) }, { FUNC(bank10_r) }, { FUNC(bank11_r) }, { FUNC(bank12_r) },
66   { FUNC(bank13_r) }, { FUNC(bank14_r) }, { FUNC(bank15_r) }, { FUNC(bank16_r) }
6767};
6868
69static const write8_space_func io_bank_handler_w[16] =
69static const struct { write8_space_func func; const char *name; } io_bank_handler_w[16] =
7070{
71   bank1_w, bank2_w, bank3_w, bank4_w,
72   bank5_w, bank6_w, bank7_w, bank8_w,
73   bank9_w, bank10_w, bank11_w, bank12_w,
74   bank13_w, bank14_w, bank15_w, bank16_w
71   { FUNC(bank1_w) }, { FUNC(bank2_w) }, { FUNC(bank3_w) }, { FUNC(bank4_w) },
72   { FUNC(bank5_w) }, { FUNC(bank6_w) }, { FUNC(bank7_w) }, { FUNC(bank8_w) },
73   { FUNC(bank9_w) }, { FUNC(bank10_w) }, { FUNC(bank11_w) }, { FUNC(bank12_w) },
74   { FUNC(bank13_w) }, { FUNC(bank14_w) }, { FUNC(bank15_w) }, { FUNC(bank16_w) }
7575};
7676
7777
r11224r11225
690690   else
691691   {
692692      if (!state->m_active_bank[banknum].bank_handler_r)
693         space->install_legacy_read_handler(bankstart, bankstart + 0x1fff, FUNC(io_bank_handler_r[banknum]));
693         space->install_legacy_read_handler(bankstart, bankstart + 0x1fff, io_bank_handler_r[banknum].func, io_bank_handler_r[banknum].name);
694694   }
695695
696696   /* write handlers (except for the 0xe000-0xffff range) */
r11224r11225
704704      else
705705      {
706706         if (!state->m_active_bank[banknum].bank_handler_r)
707            space->install_legacy_write_handler(bankstart, bankstart + 0x1fff, FUNC(io_bank_handler_w[banknum]));
707            space->install_legacy_write_handler(bankstart, bankstart + 0x1fff, io_bank_handler_w[banknum].func, io_bank_handler_w[banknum].name);
708708      }
709709   }
710710
src/mame/machine/segaic16.c
r11224r11225
314314      offs_t region_end = region_start + ((rgn->length - 1 < region_size) ? rgn->length - 1 : region_size);
315315      const char *writebank = rgn->writebank;
316316      write16_space_func write = rgn->write;
317      const char *writename = rgn->writename;
317318      const char *readbank = rgn->readbank;
318319      read16_space_func read = rgn->read;
320      const char *readname = rgn->readname;
319321
320322      /* ROM areas need extra clamping */
321323      if (rgn->romoffset != ~0)
322324      {
323325         offs_t romsize = chip->cpu->region()->bytes();
324326         if (region_start >= romsize)
325            read = NULL;
327            read = NULL, readname = "(null)";
326328         else if (region_start + rgn->length > romsize)
327329            region_end = romsize - 1;
328330      }
329331
330332      /* map it */
331333      if (read != NULL)
332         space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, FUNC(read));
334         space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, read, readname);
333335      else if (readbank != NULL)
334336         space->install_read_bank(region_start, region_end, 0, region_mirror, readbank);
335337      else
336338         space->install_legacy_read_handler(region_start, region_end, 0, region_mirror, FUNC(segaic16_open_bus_r));
337339
338340      if (write != NULL)
339         space->install_legacy_write_handler(region_start, region_end, 0, region_mirror, FUNC(write));
341         space->install_legacy_write_handler(region_start, region_end, 0, region_mirror, write, writename);
340342      else if (writebank != NULL)
341343         space->install_write_bank(region_start, region_end, 0, region_mirror, writebank);
342344      else
src/mame/machine/segaic16.h
r11224r11225
1919   offs_t         mirror;            /* maximal mirror values (will be truncated) */
2020   offs_t         romoffset;         /* offset within REGION_CPU0, or ~0 for independent entries */
2121   read16_space_func   read;            /* read handler */
22   const char *   readname;
2223   const char *   readbank;         /* bank for reading */
2324   write16_space_func   write;            /* write handler */
25   const char *   writename;
2426   const char *   writebank;         /* bank for writing */
2527   UINT16 **      base;            /* pointer to memory base */
2628   const char *   name;            /* friendly name for debugging */
src/mame/machine/steppers.c
r11224r11225
22//                                                                       //
33// steppers.c steppermotor emulation                                     //
44//                                                                       //
5// Emulates : 48 step motors driven with full step or half step          //
5// Emulates : Stepper motors driven with full step or half step          //
66//            also emulates the index optic                              //
77//                                                                       //
8// 04-04-2011: J. Wallace - Added reverse spin (this is necessary for    //
9//                          accuracy, and improved wraparound logic      //
10//    03-2011:              New 2D array to remove reel bounce and       //
11//                          make more realistic                          //
812// 26-01-2007: J. Wallace - Rewritten to make it more flexible           //
913//                          and to allow indices to be set in drivers    //
1014// 29-12-2006: J. Wallace - Added state save support                     //
1115// 05-03-2004: Re-Animator                                               //
1216//                                                                       //
13// TODO:  add different types of stepper motors if needed                //
14//        Convert the tables to something more like the real thing       //
15//        someone who understands the device system may want to convert  //
17// TODO:  add further different types of stepper motors if needed        //
18//        Someone who understands the device system may want to convert  //
1619//        this                                                           //
1720///////////////////////////////////////////////////////////////////////////
1821
r11224r11225
3134   UINT8    pattern,   /* coil pattern */
3235       old_pattern,   /* old coil pattern */
3336             phase,   /* motor phase */
34            type;   /* reel type */
37            type,   /* reel type */
38          reverse;   /* Does reel spin backwards (construction of unit, not wiring) */
3539   INT16   step_pos,   /* step position 0 - max_steps */
3640         max_steps;   /* maximum step position */
3741
r11224r11225
4347} stepper;
4448
4549static stepper step[MAX_STEPPERS];
46/* step table, use active coils as row, phase as column */
50/* step table, use active coils as row, phase as column*/
4751static const int StarpointStepTab[8][16] =
4852{//   0000  0001  0010  0011  0100  0101  0110  0111  1000  1001  1010  1011  1100  1101  1110  1111    Phase
49   { 0,    0,    4,    0,    2,    1,    3,    0,   -2,   -1,   -3,   0,    0,    0,    0,    0   },// 0
50   { 0,   -1,    3,    0,    1,    0,    2,    0,   -3,   -2,    4,   0,    0,    0,    0,    0   },// 1
51   { 0,   -2,    2,    0,    0,   -1,    1,    0,    4,   -3,    3,   0,    0,    0,    0,    0   },// 2
52   { 0,   -3,    1,    0,   -1,   -2,    0,    0,    3,    4,    2,   0,    0,    0,    0,    0   },// 3
53   { 0,    4,    0,    0,   -2,   -3,   -1,    0,    2,    3,    1,   0,    0,    0,    0,    0   },// 4
54   { 0,    3,   -1,    0,   -3,   -4,   -2,    0,    1,    2,    0,   0,    0,    0,    0,    0   },// 5
55   { 0,    2,   -2,    0,    4,    3,   -3,    0,    0,    1,   -1,   0,    0,    0,    0,    0   },// 6
56   { 0,    1,   -3,    0,    3,    2,   -4,    0,   -1,    0,   -2,   0,    0,    0,    0,    0   },// 7
53   { 0,    2,    0,    0,    2,    1,    3,    0,   -2,   -1,   -1,   0,    0,    0,    0,    0   },// 0
54   { 0,   -1,    3,    0,    1,    2,    2,    0,   -3,   -2,   -2,   0,    0,    0,    0,    0   },// 1
55   { 0,   -2,    2,    0,    2,   -1,    1,    0,    2,   -3,    3,   0,    0,    0,    0,    0   },// 2
56   { 0,   -1,    1,    0,   -1,   -2,   -2,    0,    3,    2,    2,   0,    0,    0,    0,    0   },// 3
57   { 0,   -2,    0,    0,   -2,   -3,   -1,    0,    2,    3,    1,   0,    0,    0,    0,    0   },// 4
58   { 0,    3,   -1,    0,   -1,   -2,   -2,    0,    1,    0,    2,   0,    0,    0,    0,    0   },// 5
59   { 0,    2,   -2,    0,   -2,    3,   -3,    0,   -2,    1,   -1,   0,    0,    0,    0,    0   },// 6
60   { 0,    1,   -3,    0,    3,    2,    2,    0,   -1,   -2,   -2,   0,    0,    0,    0,    0   },// 7
5761};
5862
63
5964static const int MPU3StepTab[8][4] =
6065{//   00  01  10  11  Phase
6166   { 2,  0,  0, -2, },// 0
6267   { 0,  0,  0,  0, },// 1
63   { 0, -2, -2,  0, },// 2
68   { 0, -2, 2,  0, },// 2
6469   { 0,  0,  0,  0, },// 3
6570   {-2,  0,  0,  2, },// 4
6671   { 0,  0,  0,  0, },// 5
r11224r11225
8085   { 0,    2,    0,    3,   -2,    0,   -3,    0,    0,    1,    0,   0,   -1,    0,    0,    0   },// 7
8186};
8287
83/* useful interfaces */
88/* useful interfaces (Starpoint is a very common setup)*/
8489
8590const stepper_interface starpoint_interface_48step =
8691{
r11224r11225
9095   0x09
9196};
9297
98const stepper_interface starpoint_interface_48step_reverse =
99{
100   STARPOINT_48STEP_REEL,
101   16,
102   24,
103   0x09,
104   1
105};
106
93107///////////////////////////////////////////////////////////////////////////
94108void stepper_config(running_machine &machine, int which, const stepper_interface *intf)
95109{
r11224r11225
103117   step[which].index_start = intf->index_start;/* location of first index value in half steps */
104118   step[which].index_end   = intf->index_end;   /* location of last index value in half steps */
105119   step[which].index_patt   = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/
120   step[which].reverse     = intf->reverse;
106121   step[which].phase       = 0;
107122   step[which].pattern     = 0;
108123   step[which].old_pattern = 0;
109124   step[which].step_pos    = 0;
110125
126
111127   switch ( step[which].type )
112128   {   default:
113129      case STARPOINT_48STEP_REEL:  /* STARPOINT RMxxx */
r11224r11225
129145   state_save_register_item(machine, "stepper", NULL, which, step[which].step_pos);
130146   state_save_register_item(machine, "stepper", NULL, which, step[which].max_steps);
131147   state_save_register_item(machine, "stepper", NULL, which, step[which].type);
148   state_save_register_item(machine, "stepper", NULL, which, step[which].reverse);
132149}
133150
134151///////////////////////////////////////////////////////////////////////////
r11224r11225
219236      step[which].phase =   (step[which].step_pos % 8);
220237      step[which].pattern = pattern;
221238
222//      index = (step[which].old_pattern << 4) | pattern;
223239      switch ( step[which].type )
224240      {
225241         default:
226242         case STARPOINT_48STEP_REEL :   /* STARPOINT RMxxx */
227243         case STARPOINT_144STEPS_DICE :  /* STARPOINT 1DCU DICE mechanism */
228         steps = StarpointStepTab[step[which].phase][pattern];
244         steps = StarpointStepTab[step[which].phase][pattern];//[(step[which].old_pattern << 4) | pattern];//
229245         break;
230246         case BARCREST_48STEP_REEL :       /* Barcrest reel units have different windings */
231247         steps = BarcrestStepTab[step[which].phase][pattern];
r11224r11225
233249         case MPU3_48STEP_REEL :       /* Same unit as above, but different interface (2 active lines, not 4)*/
234250         steps = MPU3StepTab[step[which].phase][pattern];
235251      }
236      #if 0 /* Assists with new index generation */
237      if ( which ==3 )logerror("which %d Index %d Steps %d Phase %d Pattern Old %02X New %02X\n",which,index,steps,(step[which].step_pos % 8),step[which].old_pattern,step[which].pattern);
252      #if 1 /* Assists with new index generation */
253      if ( which ==1 )logerror("which %d Steps %d Phase %d Pattern Old %02X New %02X\n",which,steps,(step[which].phase),step[which].old_pattern,step[which].pattern);
238254      #endif
239255
240      if ( steps )
256      if (step[which].reverse)
241257      {
242         pos = step[which].step_pos + steps;
243         if ( pos > step[which].max_steps ) pos -= step[which].max_steps;
244         if ( pos < 0 )                 pos += step[which].max_steps;
258         pos = (step[which].step_pos - steps + step[which].max_steps) % step[which].max_steps;
259      }
260      else
261      {
262         pos = (step[which].step_pos + steps + step[which].max_steps) % step[which].max_steps;
263      }
245264
246         step[which].step_pos = pos;
247         update_optic(which);
248
265      if (pos != step[which].step_pos)
266      {
249267         changed++;
250268      }
269
270      step[which].step_pos = pos;
271      update_optic(which);
251272   }
252273   return changed;
253274}
src/mame/machine/snes.c
r11224r11225
18361836
18371837DIRECT_UPDATE_HANDLER( snes_spc_direct )
18381838{
1839   direct.explicit_configure(0x0000, 0xffff, 0xffff, spc_get_ram(machine->device("spc700")));
1839   direct.explicit_configure(0x0000, 0xffff, 0xffff, spc_get_ram(machine.device("spc700")));
18401840   return ~0;
18411841}
18421842
r11224r11225
18561856   state->m_spc700 = machine.device<snes_sound_device>("spc700");
18571857   state->m_superfx = machine.device<cpu_device>("superfx");
18581858
1859   state->m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_direct, machine));
1860   state->m_soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(snes_spc_direct, machine));
1859   state->m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_direct), &machine));
1860   state->m_soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_spc_direct), &machine));
18611861
18621862   // power-on sets these registers like this
18631863   snes_ram[WRIO] = 0xff;
src/mame/machine/steppers.h
r11224r11225
55// Emulates : 48 step motors driven with full step or half step          //
66//            also emulates the index optic                              //
77//                                                                       //
8// 26-01-2007: J. Wallace - Rewritten to make it more flexible           //
9//                          and to allow indices to be set in drivers    //
10// 29-12-2006: J. Wallace - Added state save support                     //
11// 05-03-2004: Re-Animator                                               //
128//                                                                       //
139// TODO:  add different types of stepper motors if needed                //
1410//        someone who understands the device system may want to convert  //
r11224r11225
3430   INT16 index_start;/* start position of index (in half steps) */
3531   INT16 index_end;  /* end position of index (in half steps) */
3632   INT16 index_patt; /* pattern needed on coils (0=don't care) */
33   UINT8 reverse; /* Reel spins in reverse (symbols appear from the bottom) */
3734};
3835
3936extern const stepper_interface starpoint_interface_48step;
src/mame/machine/atarigen.c
r11224r11225
454454
455455DIRECT_UPDATE_HANDLER( atarigen_slapstic_setdirect )
456456{
457   atarigen_state *state = machine->driver_data<atarigen_state>();
457   atarigen_state *state = machine.driver_data<atarigen_state>();
458458
459459   /* if we jump to an address in the slapstic region, tweak the slapstic
460460       at that address and return ~0; this will cause us to be called on
r11224r11225
511511      state->m_slapstic_mirror = mirror;
512512
513513      address_space *space = downcast<cpu_device *>(device)->space(AS_PROGRAM);
514      space->set_direct_update_handler(direct_update_delegate_create_static(atarigen_slapstic_setdirect, device->machine()));
514      space->set_direct_update_handler(direct_update_delegate(FUNC(atarigen_slapstic_setdirect), &device->machine()));
515515   }
516516}
517517
src/mame/machine/archimds.c
r11224r11225
340340void archimedes_driver_init(running_machine &machine)
341341{
342342//  address_space *space = machine.device<arm_device>("maincpu")->space(AS_PROGRAM);
343//  space->set_direct_update_handler(direct_update_delegate_create_static(a310_setopbase, machine));
343//  space->set_direct_update_handler(direct_update_delegate(FUNC(a310_setopbase), &machine));
344344}
345345
346346static const char *const ioc_regnames[] =
src/mame/machine/beezer.c
r11224r11225
173173      space->install_legacy_write_handler(0xc600, 0xc7ff, FUNC(watchdog_reset_w));
174174      space->install_legacy_write_handler(0xc800, 0xc9ff, FUNC(beezer_map_w));
175175      space->install_legacy_read_handler(0xca00, 0xcbff, FUNC(beezer_line_r));
176      space->install_readwrite_handler(0xce00, 0xcfff, read8_delegate_create(via6522_device, read, *via_0), write8_delegate_create(via6522_device, write, *via_0));
176      space->install_readwrite_handler(0xce00, 0xcfff, read8_delegate(FUNC(via6522_device::read), via_0), write8_delegate(FUNC(via6522_device::write), via_0));
177177   }
178178   else
179179   {
src/mame/machine/mcr68.c
r11224r11225
182182   /* for the most part all MCR/68k games are the same */
183183   mcr68_common_init(machine);
184184   state->m_v493_callback = mcr68_493_callback;
185   state->m_v493_callback_name = "mcr68_493_callback";
185186
186187   /* vectors are 1 and 2 */
187188   state->m_v493_irq_vector = 1;
r11224r11225
201202   /* for the most part all MCR/68k games are the same */
202203   mcr68_common_init(machine);
203204   state->m_v493_callback = zwackery_493_callback;
205   state->m_v493_callback_name = "zwackery_493_callback";
204206
205207   /* vectors are 5 and 6 */
206208   state->m_v493_irq_vector = 5;
r11224r11225
227229   /* also set a timer to generate the 493 signal at a specific time before the next VBLANK */
228230   /* the timing of this is crucial for Blasted and Tri-Sports, which check the timing of */
229231   /* VBLANK and 493 using counter 2 */
230   device->machine().scheduler().timer_set(attotime::from_hz(30) - state->m_timing_factor, FUNC(state->m_v493_callback));
232   device->machine().scheduler().timer_set(attotime::from_hz(30) - state->m_timing_factor, state->m_v493_callback, state->m_v493_callback_name);
231233}
232234
233235
src/mame/includes/4enraya.h
r11224r11225
1111      : driver_device(machine, config) { }
1212
1313   /* memory pointers */
14   UINT8       m_videoram[0x1000];
14   UINT8      m_videoram[0x1000];
1515   UINT8      m_workram[0x1000];
1616
1717   /* video-related */
src/mame/includes/mcr68.h
r11224r11225
3232   UINT8 m_v493_irq_state;
3333   UINT8 m_v493_irq_vector;
3434   timer_expired_func m_v493_callback;
35   const char *m_v493_callback_name;
3536   UINT8 m_zwackery_sound_data;
3637   attotime m_m6840_counter_periods[3];
3738   attotime m_m6840_internal_counter_period;
src/mame/includes/segas24.h
r11224r11225
1#include "video/segaic24.h"
2
13class segas24_state : public driver_device
24{
35public:
r11224r11225
46   segas24_state(running_machine &machine, const driver_device_config_base &config)
57      : driver_device(machine, config) { }
68
7   int m_fdc_status;
8   int m_fdc_track;
9   int m_fdc_sector;
10   int m_fdc_data;
11   int m_fdc_phys_track;
12   int m_fdc_irq;
13   int m_fdc_drq;
14   int m_fdc_span;
15   int m_fdc_index_count;
16   UINT8 *m_fdc_pt;
17   int m_track_size;
18   int m_cur_input_line;
19   UINT8 m_hotrod_ctrl_cur;
20   UINT8 m_resetcontrol;
21   UINT8 m_prev_resetcontrol;
22   UINT8 m_curbank;
23   UINT8 m_mlatch;
24   const UINT8 *m_mlatch_table;
25   UINT16 m_irq_timera;
26   UINT8 m_irq_timerb;
27   UINT8 m_irq_allow0;
28   UINT8 m_irq_allow1;
29   int m_irq_timer_pend0;
30   int m_irq_timer_pend1;
31   int m_irq_yms;
32   int m_irq_vblank;
33   int m_irq_sprite;
34   timer_device *m_irq_timer;
35   timer_device *m_irq_timer_clear;
36   int m_turns;
37   UINT16 *m_system24temp_sys16_shared_ram;
38   UINT8  (*m_system24temp_sys16_io_io_r)(running_machine &machine, int port);
39   void   (*m_system24temp_sys16_io_io_w)(running_machine &machine, int port, UINT8 data);
40   void   (*m_system24temp_sys16_io_cnt_w)(address_space *space, UINT8 data);
41   read16_space_func m_system24temp_sys16_io_iod_r;
42   write16_space_func m_system24temp_sys16_io_iod_w;
43   UINT8 m_system24temp_sys16_io_cnt;
44   UINT8 m_system24temp_sys16_io_dir;
45};
469
10   static const UINT8  mahmajn_mlt[8];
11   static const UINT8 mahmajn2_mlt[8];
12   static const UINT8      qgh_mlt[8];
13   static const UINT8 bnzabros_mlt[8];
14   static const UINT8   qrouka_mlt[8];
15   static const UINT8 quizmeku_mlt[8];
16   static const UINT8   dcclub_mlt[8];
4717
48/*----------- defined in machine/segas24.c -----------*/
18   int fdc_status;
19   int fdc_track;
20   int fdc_sector;
21   int fdc_data;
22   int fdc_phys_track;
23   int fdc_irq;
24   int fdc_drq;
25   int fdc_span;
26   int fdc_index_count;
27   UINT8 *fdc_pt;
28   int track_size;
29   int cur_input_line;
30   UINT8 hotrod_ctrl_cur;
31   UINT8 resetcontrol;
32   UINT8 prev_resetcontrol;
33   UINT8 curbank;
34   UINT8 mlatch;
35   const UINT8 *mlatch_table;
4936
50/* system24temp_ functions / variables are from shared rewrite files,
51   once the rest of the rewrite is complete they can be removed, I
52   just made a copy & renamed them for now to avoid any conflicts
53*/
37   UINT16 irq_tdata, irq_tval;
38   UINT8 irq_tmode, irq_allow0, irq_allow1;
39   int irq_timer_pend0;
40   int irq_timer_pend1;
41   int irq_yms;
42   int irq_vblank;
43   int irq_sprite;
44   attotime irq_synctime, irq_vsynctime;
45   timer_device *irq_timer;
46   timer_device *irq_timer_clear;
5447
55/* New Code */
48   UINT16 *shared_ram;
49   UINT8 (segas24_state::*io_r)(UINT8 port);
50   void (segas24_state::*io_w)(UINT8 port, UINT8 data);
51   UINT8 io_cnt, io_dir;
5652
57void system24temp_sys16_io_set_callbacks(
58   running_machine &machine,
59   UINT8 (*io_r)(running_machine &machine, int port),
60   void  (*io_w)(running_machine &machine, int port, UINT8 data),
61   void  (*cnt_w)(address_space *space, UINT8 data),
62   read16_space_func iod_r,
63   write16_space_func iod_w);
53   segas24_tile *vtile;
54   segas24_sprite *vsprite;
55   segas24_mixer *vmixer;
6456
65READ16_HANDLER ( system24temp_sys16_io_r );
66WRITE16_HANDLER( system24temp_sys16_io_w );
67READ32_HANDLER ( system24temp_sys16_io_dword_r );
57   DECLARE_READ16_MEMBER(  sys16_paletteram_r );
58   DECLARE_WRITE16_MEMBER( sys16_paletteram_w );
59   DECLARE_READ16_MEMBER(  irq_r );
60   DECLARE_WRITE16_MEMBER( irq_w );
61   DECLARE_READ16_MEMBER(  fdc_r );
62   DECLARE_WRITE16_MEMBER( fdc_w );
63   DECLARE_READ16_MEMBER(  fdc_status_r );
64   DECLARE_WRITE16_MEMBER( fdc_ctrl_w );
65   DECLARE_READ16_MEMBER(  curbank_r );
66   DECLARE_WRITE16_MEMBER( curbank_w );
67   DECLARE_READ16_MEMBER(  mlatch_r );
68   DECLARE_WRITE16_MEMBER( mlatch_w );
69   DECLARE_READ16_MEMBER(  hotrod3_ctrl_r );
70   DECLARE_WRITE16_MEMBER( hotrod3_ctrl_w );
71   DECLARE_READ16_MEMBER(  iod_r );
72   DECLARE_WRITE16_MEMBER( iod_w );
73   DECLARE_READ16_MEMBER ( sys16_io_r );
74   DECLARE_WRITE16_MEMBER( sys16_io_w );
6875
69/* End New Code */
76   UINT8 hotrod_io_r(UINT8 port);
77   UINT8 dcclub_io_r(UINT8 port);
78   UINT8 mahmajn_io_r(UINT8 port);
7079
80   void hotrod_io_w(UINT8 port, UINT8 data);
81   void mahmajn_io_w(UINT8 port, UINT8 data);
7182
83   void fdc_init();
84   void reset_reset();
85   void reset_bank();
86   void irq_init();
87   void irq_timer_sync();
88   void irq_timer_start(int old_tmode);
89   void reset_control_w(UINT8 data);
90};
91
7292/*----------- defined in machine/s24fd.c -----------*/
7393
7494extern void s24_fd1094_machine_init(running_machine &machine);
r11224r11225
7797
7898/*----------- defined in video/segas24.c -----------*/
7999
80VIDEO_START(system24);
81100SCREEN_UPDATE(system24);
src/mame/includes/cidelsa.h
r11224r11225
1#pragma once
2
13#ifndef __CIDELSA__
24#define __CIDELSA__
35
6#define ADDRESS_MAP_MODERN
7
8#include "emu.h"
49#include "cpu/cosmac/cosmac.h"
10#include "cpu/cop400/cop400.h"
511#include "sound/cdp1869.h"
12#include "sound/ay8910.h"
13#include "machine/cdp1852.h"
14#include "machine/nvram.h"
615
716#define SCREEN_TAG   "screen"
817#define CDP1802_TAG   "cdp1802"
r11224r11225
3241   cidelsa_state(running_machine &machine, const driver_device_config_base &config)
3342      : driver_device(machine, config),
3443        m_maincpu(*this, CDP1802_TAG),
35        m_vis(*this, CDP1869_TAG),
36        m_psg(*this, AY8910_TAG)
44        m_vis(*this, CDP1869_TAG)
3745   { }
3846
3947   required_device<cosmac_device> m_maincpu;
4048   required_device<cdp1869_device> m_vis;
41   optional_device<device_t> m_psg;
4249
50   virtual void machine_start();
4351   virtual void machine_reset();
4452
4553   virtual void video_start();
4654   virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) { m_vis->update_screen(&bitmap, &cliprect); return false; }
4755
48   DECLARE_READ8_MEMBER( draco_sound_in_r );
49   DECLARE_READ8_MEMBER( draco_sound_ay8910_r );
50
5156   DECLARE_WRITE8_MEMBER( cdp1869_w );
52   DECLARE_WRITE8_MEMBER( draco_sound_bankswitch_w );
53   DECLARE_WRITE8_MEMBER( draco_sound_g_w );
54   DECLARE_WRITE8_MEMBER( draco_sound_ay8910_w );
5557   DECLARE_WRITE8_MEMBER( destryer_out1_w );
5658   DECLARE_WRITE8_MEMBER( altair_out1_w );
57   DECLARE_WRITE8_MEMBER( draco_out1_w );
58   DECLARE_WRITE8_MEMBER( draco_ay8910_port_b_w );
5959
6060   DECLARE_READ_LINE_MEMBER( clear_r );
6161
r11224r11225
7272   UINT8 *m_pageram;
7373   UINT8 *m_pcbram;
7474   UINT8 *m_charram;
75};
7576
77class draco_state : public cidelsa_state
78{
79public:
80   draco_state(running_machine &machine, const driver_device_config_base &config)
81      : cidelsa_state(machine, config),
82        m_psg(*this, AY8910_TAG)
83   { }
84
85   required_device<device_t> m_psg;
86
87   virtual void machine_start();
88
89   DECLARE_READ8_MEMBER( sound_in_r );
90   DECLARE_READ8_MEMBER( psg_r );
91   DECLARE_WRITE8_MEMBER( sound_bankswitch_w );
92   DECLARE_WRITE8_MEMBER( sound_g_w );
93   DECLARE_WRITE8_MEMBER( psg_w );
94   DECLARE_WRITE8_MEMBER( out1_w );
95   DECLARE_WRITE8_MEMBER( psg_pb_w );
96
7697   // sound state
77   int m_draco_sound;
78   int m_draco_ay_latch;
98   int m_sound;
99   int m_psg_latch;
79100};
80101
81102/*----------- defined in video/cidelsa.c -----------*/
src/mame/includes/taito_f3.h
r11224r11225
4848
4949   UINT16 *m_videoram;
5050   UINT16 *m_spriteram;
51//   size_t m_spriteram_size;
51//  size_t m_spriteram_size;
5252   UINT32 m_coin_word[2];
5353   UINT32 *m_f3_ram;
5454   int m_f3_game;
src/mame/mame.mak
r11224r11225
483483   $(DRIVERS)/powerins.o $(VIDEO)/powerins.o \
484484
485485$(MAMEOBJ)/barcrest.a: \
486   $(DRIVERS)/mpu3.o \
486487   $(DRIVERS)/mpu4.o \
487488   $(DRIVERS)/mpu5.o \
488489   $(VIDEO)/awpvid.o \
r11224r11225
11641165   $(DRIVERS)/segas16a.o $(VIDEO)/segas16a.o \
11651166   $(DRIVERS)/segas16b.o $(VIDEO)/segas16b.o \
11661167   $(DRIVERS)/segas18.o $(VIDEO)/segas18.o \
1167   $(DRIVERS)/segas24.o $(MACHINE)/segas24.o $(VIDEO)/segas24.o \
1168   $(DRIVERS)/segas24.o $(VIDEO)/segas24.o \
11681169   $(DRIVERS)/segas32.o $(MACHINE)/segas32.o $(VIDEO)/segas32.o \
11691170   $(DRIVERS)/segaxbd.o $(VIDEO)/segaxbd.o \
11701171   $(DRIVERS)/segaybd.o $(VIDEO)/segaybd.o \
src/mame/video/model1.c
r11224r11225
14521452
14531453   state->m_view = auto_alloc_clear(machine, struct view);
14541454
1455   sys24_tile_vh_start(machine, 0x3fff);
1456
14571455   state->m_poly_rom = (UINT32 *)machine.region("user1")->base();
14581456   state->m_poly_ram = auto_alloc_array_clear(machine, UINT32, 0x400000);
14591457   state->m_tgp_ram = auto_alloc_array_clear(machine, UINT16, 0x100000-0x40000);
r11224r11225
15231521   bitmap_fill(screen->machine().priority_bitmap, NULL, 0);
15241522   bitmap_fill(bitmap, cliprect, screen->machine().pens[0]);
15251523
1526   sys24_tile_draw(screen->machine(), bitmap, cliprect, 6, 0, 0);
1527   sys24_tile_draw(screen->machine(), bitmap, cliprect, 4, 0, 0);
1528   sys24_tile_draw(screen->machine(), bitmap, cliprect, 2, 0, 0);
1529   sys24_tile_draw(screen->machine(), bitmap, cliprect, 0, 0, 0);
1524   segas24_tile *tile = screen->machine().device<segas24_tile>("tile");
1525   tile->draw(bitmap, cliprect, 6, 0, 0);
1526   tile->draw(bitmap, cliprect, 4, 0, 0);
1527   tile->draw(bitmap, cliprect, 2, 0, 0);
1528   tile->draw(bitmap, cliprect, 0, 0, 0);
15301529
15311530   tgp_render(screen->machine(), bitmap, cliprect);
15321531
1533   sys24_tile_draw(screen->machine(), bitmap, cliprect, 7, 0, 0);
1534   sys24_tile_draw(screen->machine(), bitmap, cliprect, 5, 0, 0);
1535   sys24_tile_draw(screen->machine(), bitmap, cliprect, 3, 0, 0);
1536   sys24_tile_draw(screen->machine(), bitmap, cliprect, 1, 0, 0);
1532   tile->draw(bitmap, cliprect, 7, 0, 0);
1533   tile->draw(bitmap, cliprect, 5, 0, 0);
1534   tile->draw(bitmap, cliprect, 3, 0, 0);
1535   tile->draw(bitmap, cliprect, 1, 0, 0);
15371536
15381537   return 0;
15391538}
src/mame/video/model2.c
r11224r11225
27122712   int   width = visarea.max_x - visarea.min_x;
27132713   int   height = visarea.max_y - visarea.min_y;
27142714
2715   sys24_tile_vh_start(machine, 0x3fff);
27162715   state->m_sys24_bitmap = auto_alloc(machine, bitmap_t(width, height+4, BITMAP_FORMAT_INDEXED16));
27172716
27182717   state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
r11224r11225
27502749   bitmap_fill(bitmap, cliprect, screen->machine().pens[0]);
27512750   bitmap_fill(state->m_sys24_bitmap, cliprect, 0);
27522751
2753   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 7, 0, 0);
2754   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 6, 0, 0);
2755   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 5, 0, 0);
2756   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 4, 0, 0);
2752   segas24_tile *tile = screen->machine().device<segas24_tile>("tile");
2753   tile->draw(state->m_sys24_bitmap, cliprect, 7, 0, 0);
2754   tile->draw(state->m_sys24_bitmap, cliprect, 6, 0, 0);
2755   tile->draw(state->m_sys24_bitmap, cliprect, 5, 0, 0);
2756   tile->draw(state->m_sys24_bitmap, cliprect, 4, 0, 0);
27572757
27582758   convert_bitmap(screen->machine(), bitmap, state->m_sys24_bitmap, cliprect);
27592759
r11224r11225
27672767   model2_3d_frame_end( state, bitmap, cliprect );
27682768
27692769   bitmap_fill(state->m_sys24_bitmap, cliprect, 0);
2770   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 3, 0, 0);
2771   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 2, 0, 0);
2772   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 1, 0, 0);
2773   sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 0, 0, 0);
2770   tile->draw(state->m_sys24_bitmap, cliprect, 3, 0, 0);
2771   tile->draw(state->m_sys24_bitmap, cliprect, 2, 0, 0);
2772   tile->draw(state->m_sys24_bitmap, cliprect, 1, 0, 0);
2773   tile->draw(state->m_sys24_bitmap, cliprect, 0, 0, 0);
27742774
27752775   convert_bitmap(screen->machine(), bitmap, state->m_sys24_bitmap, cliprect);
27762776
src/mame/video/segaic24.c
r11224r11225
1212
1313*/
1414
15/*
16 * System 16 color palette formats
17 */
15#include "emu.h"
16#include "segaic24.h"
1817
1918
20/* system24temp_ functions / variables are from shared rewrite files,
21   once the rest of the rewrite is complete they can be removed, I
22   just made a copy & renamed them for now to avoid any conflicts
23*/
19const device_type S24TILE   = segas24_tile_config::static_alloc_device_config;
20const device_type S24SPRITE = segas24_sprite_config::static_alloc_device_config;
21const device_type S24MIXER  = segas24_mixer_config::static_alloc_device_config;
2422
25#include "emu.h"
26#include "segaic24.h"
23segas24_tile_config::segas24_tile_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
24   : device_config(mconfig, static_alloc_device_config, "S24TILE", tag, owner, clock)
25{
26}
2727
28device_config *segas24_tile_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
29{
30   return global_alloc(segas24_tile_config(mconfig, tag, owner, clock));
31}
2832
29static void set_color(running_machine &machine, int color, UINT8 r, UINT8 g, UINT8 b, int highlight)
33void segas24_tile_config::static_set_tile_mask(device_config *device, UINT16 _tile_mask)
3034{
31   palette_set_color (machine, color, MAKE_RGB(r, g, b));
35   segas24_tile_config *dev = downcast<segas24_tile_config *>(device);
36   dev->tile_mask = _tile_mask;
37}
3238
33   if(highlight) {
34      r = 255-0.6*(255-r);
35      g = 255-0.6*(255-g);
36      b = 255-0.6*(255-b);
37   } else {
38      r = 0.6*r;
39      g = 0.6*g;
40      b = 0.6*b;
41   }
42   palette_set_color(machine,color+machine.total_colors()/2, MAKE_RGB(r, g, b));
39device_t *segas24_tile_config::alloc_device(running_machine &machine) const
40{
41   return auto_alloc(machine, segas24_tile(machine, *this));
4342}
4443
45// 315-5242
4644
47// qgh expects to be able to read the palette shared between CPUs
48READ16_HANDLER( system24temp_sys16_paletteram1_r )
45segas24_sprite_config::segas24_sprite_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
46   : device_config(mconfig, static_alloc_device_config, "S24SPRITE", tag, owner, clock)
4947{
50   return space->machine().generic.paletteram.u16[offset];
5148}
5249
50device_config *segas24_sprite_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
51{
52   return global_alloc(segas24_sprite_config(mconfig, tag, owner, clock));
53}
5354
54WRITE16_HANDLER (system24temp_sys16_paletteram1_w)
55device_t *segas24_sprite_config::alloc_device(running_machine &machine) const
5556{
56   int r, g, b;
57   COMBINE_DATA (space->machine().generic.paletteram.u16 + offset);
58   data = space->machine().generic.paletteram.u16[offset];
57   return auto_alloc(machine, segas24_sprite(machine, *this));
58}
5959
60   r = (data & 0x00f) << 4;
61   if(data & 0x1000)
62      r |= 8;
6360
64   g = data & 0x0f0;
65   if(data & 0x2000)
66      g |= 8;
61segas24_mixer_config::segas24_mixer_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
62   : device_config(mconfig, static_alloc_device_config, "S24MIXER", tag, owner, clock)
63{
64}
6765
68   b = (data & 0xf00) >> 4;
69   if(data & 0x4000)
70      b |= 8;
66device_config *segas24_mixer_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
67{
68   return global_alloc(segas24_mixer_config(mconfig, tag, owner, clock));
69}
7170
72   r |= r >> 5;
73   g |= g >> 5;
74   b |= b >> 5;
75   set_color(space->machine(), offset, r, g, b, data & 0x8000);
71device_t *segas24_mixer_config::alloc_device(running_machine &machine) const
72{
73   return auto_alloc(machine, segas24_mixer(machine, *this));
7674}
7775
78// - System 24
7976
80enum {SYS24_TILES = 0x4000};
8177
82static UINT16 *sys24_char_ram, *sys24_tile_ram;
83static UINT16 sys24_tile_mask;
84static int sys24_char_gfx_index;
85static tilemap_t *sys24_tile_layer[4];
78segas24_tile::segas24_tile(running_machine &_machine, const segas24_tile_config &_config)
79   : device_t(_machine, _config),
80     config(_config)
81{
82}
8683
8784#define XOR(a) WORD_XOR_BE(a)
8885
89static const gfx_layout sys24_char_layout = {
86const gfx_layout segas24_tile::char_layout = {
9087   8, 8,
9188   SYS24_TILES,
9289   4,
r11224r11225
9693   8*32
9794};
9895
99static TILE_GET_INFO( sys24_tile_info_0s )
96void segas24_tile::tile_info(int offset, tile_data *tileinfo, tilemap_memory_index tile_index)
10097{
101   UINT16 val = sys24_tile_ram[tile_index];
98   UINT16 val = tile_ram[tile_index|offset];
10299   tileinfo->category = (val & 0x8000) != 0;
103   SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
100   tileinfo_set(machine(), tileinfo, char_gfx_index, val & config.tile_mask, (val >> 7) & 0xff, 0);
104101}
105102
106static TILE_GET_INFO( sys24_tile_info_0w )
103TILE_GET_INFO_DEVICE( segas24_tile::tile_info_0s )
107104{
108   UINT16 val = sys24_tile_ram[tile_index|0x1000];
109   tileinfo->category = (val & 0x8000) != 0;
110   SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
105   downcast<segas24_tile *>(device)->tile_info(0x0000, tileinfo, tile_index);
111106}
112107
113static TILE_GET_INFO( sys24_tile_info_1s )
108TILE_GET_INFO_DEVICE( segas24_tile::tile_info_0w )
114109{
115   UINT16 val = sys24_tile_ram[tile_index|0x2000];
116   tileinfo->category = (val & 0x8000) != 0;
117   SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
110   downcast<segas24_tile *>(device)->tile_info(0x1000, tileinfo, tile_index);
118111}
119112
120static TILE_GET_INFO( sys24_tile_info_1w )
113TILE_GET_INFO_DEVICE( segas24_tile::tile_info_1s )
121114{
122   UINT16 val = sys24_tile_ram[tile_index|0x3000];
123   tileinfo->category = (val & 0x8000) != 0;
124   SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
115   downcast<segas24_tile *>(device)->tile_info(0x2000, tileinfo, tile_index);
125116}
126117
127void sys24_tile_vh_start(running_machine &machine, UINT16 tile_mask)
118TILE_GET_INFO_DEVICE( segas24_tile::tile_info_1w )
128119{
129   sys24_tile_mask = tile_mask;
120   downcast<segas24_tile *>(device)->tile_info(0x3000, tileinfo, tile_index);
121}
130122
131   for(sys24_char_gfx_index = 0; sys24_char_gfx_index < MAX_GFX_ELEMENTS; sys24_char_gfx_index++)
132      if (machine.gfx[sys24_char_gfx_index] == 0)
123void segas24_tile::device_start()
124{
125   for(char_gfx_index = 0; char_gfx_index < MAX_GFX_ELEMENTS; char_gfx_index++)
126      if (machine().gfx[char_gfx_index] == 0)
133127         break;
134   assert(sys24_char_gfx_index != MAX_GFX_ELEMENTS);
128   assert(char_gfx_index != MAX_GFX_ELEMENTS);
135129
136   sys24_char_ram = auto_alloc_array(machine, UINT16, 0x80000/2);
130   char_ram = auto_alloc_array(machine(), UINT16, 0x80000/2);
131   tile_ram = auto_alloc_array(machine(), UINT16, 0x10000/2);
137132
138   sys24_tile_ram = auto_alloc_array(machine, UINT16, 0x10000/2);
133   tile_layer[0] = tilemap_create_device(this, tile_info_0s, tilemap_scan_rows,  8, 8, 64, 64);
134   tile_layer[1] = tilemap_create_device(this, tile_info_0w, tilemap_scan_rows,  8, 8, 64, 64);
135   tile_layer[2] = tilemap_create_device(this, tile_info_1s, tilemap_scan_rows,  8, 8, 64, 64);
136   tile_layer[3] = tilemap_create_device(this, tile_info_1w, tilemap_scan_rows,  8, 8, 64, 64);
139137
140   sys24_tile_layer[0] = tilemap_create(machine, sys24_tile_info_0s, tilemap_scan_rows,  8, 8, 64, 64);
141   sys24_tile_layer[1] = tilemap_create(machine, sys24_tile_info_0w, tilemap_scan_rows,  8, 8, 64, 64);
142   sys24_tile_layer[2] = tilemap_create(machine, sys24_tile_info_1s, tilemap_scan_rows,  8, 8, 64, 64);
143   sys24_tile_layer[3] = tilemap_create(machine, sys24_tile_info_1w, tilemap_scan_rows,  8, 8, 64, 64);
138   tilemap_set_transparent_pen(tile_layer[0], 0);
139   tilemap_set_transparent_pen(tile_layer[1], 0);
140   tilemap_set_transparent_pen(tile_layer[2], 0);
141   tilemap_set_transparent_pen(tile_layer[3], 0);
144142
145   tilemap_set_transparent_pen(sys24_tile_layer[0], 0);
146   tilemap_set_transparent_pen(sys24_tile_layer[1], 0);
147   tilemap_set_transparent_pen(sys24_tile_layer[2], 0);
148   tilemap_set_transparent_pen(sys24_tile_layer[3], 0);
143   memset(char_ram, 0, 0x80000);
144   memset(tile_ram, 0, 0x10000);
149145
150   memset(sys24_char_ram, 0, 0x80000);
151   memset(sys24_tile_ram, 0, 0x10000);
146   machine().gfx[char_gfx_index] = gfx_element_alloc(machine(), &char_layout, (UINT8 *)char_ram, machine().total_colors() / 16, 0);
152147
153   machine.gfx[sys24_char_gfx_index] = gfx_element_alloc(machine, &sys24_char_layout, (UINT8 *)sys24_char_ram, machine.total_colors() / 16, 0);
154
155   state_save_register_global_pointer(machine, sys24_tile_ram, 0x10000/2);
156   state_save_register_global_pointer(machine, sys24_char_ram, 0x80000/2);
148   save_pointer(NAME(tile_ram), 0x10000/2);
149   save_pointer(NAME(char_ram), 0x80000/2);
157150}
158151
159static void sys24_tile_draw_rect(running_machine &machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
160                         UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
152void segas24_tile::draw_rect(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
153                      UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
161154{
162155   int y;
163156   const UINT16 *source  = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
164157   const UINT8  *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
165   UINT8        *prib = (UINT8 *)machine.priority_bitmap->base;
158   UINT8        *prib = (UINT8 *)machine().priority_bitmap->base;
166159   UINT16       *dest = (UINT16 *)dm->base;
167160
168161   tpri |= TILEMAP_PIXEL_LAYER0;
169162
170163   dest += yy1*dm->rowpixels + xx1;
171   prib += yy1*machine.priority_bitmap->rowpixels + xx1;
164   prib += yy1*machine().priority_bitmap->rowpixels + xx1;
172165   mask += yy1*4;
173166   yy2 -= yy1;
174167
r11224r11225
280273      source += bm->rowpixels;
281274      trans  += tm->rowpixels;
282275      dest   += dm->rowpixels;
283      prib   += machine.priority_bitmap->rowpixels;
276      prib   += machine().priority_bitmap->rowpixels;
284277      mask   += 4;
285278   }
286279}
r11224r11225
288281
289282// The rgb version is used by model 1 & 2 which do not need to care
290283// about sprite priority hence the lack of support for the
291// machine.priority_bitmap
284// priority_bitmap
292285
293static void sys24_tile_draw_rect_rgb(running_machine &machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
294                            UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
286void segas24_tile::draw_rect_rgb(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
287                         UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
295288{
296289   int y;
297290   const UINT16 *source  = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
298291   const UINT8  *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
299292   UINT16       *dest = (UINT16 *)dm->base;
300   const pen_t  *pens   = machine.pens;
293   const pen_t  *pens   = machine().pens;
301294
302295   tpri |= TILEMAP_PIXEL_LAYER0;
303296
r11224r11225
402395   }
403396}
404397
405void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
398void segas24_tile::draw(bitmap_t *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
406399{
407   UINT16 hscr = sys24_tile_ram[0x5000+(layer >> 1)];
408   UINT16 vscr = sys24_tile_ram[0x5004+(layer >> 1)];
409   UINT16 ctrl = sys24_tile_ram[0x5004+((layer >> 1) & 2)];
410   UINT16 *mask = sys24_tile_ram + (layer & 4 ? 0x6800 : 0x6000);
400   UINT16 hscr = tile_ram[0x5000+(layer >> 1)];
401   UINT16 vscr = tile_ram[0x5004+(layer >> 1)];
402   UINT16 ctrl = tile_ram[0x5004+((layer >> 1) & 2)];
403   UINT16 *mask = tile_ram + (layer & 4 ? 0x6800 : 0x6000);
411404   UINT16 tpri = layer & 1;
412405
413406   lpri = 1 << lpri;
r11224r11225
422415      if(layer & 1)
423416         return;
424417
425      tilemap_set_scrolly(sys24_tile_layer[layer],   0, vscr & 0x1ff);
426      tilemap_set_scrolly(sys24_tile_layer[layer|1], 0, vscr & 0x1ff);
418      tilemap_set_scrolly(tile_layer[layer],   0, vscr & 0x1ff);
419      tilemap_set_scrolly(tile_layer[layer|1], 0, vscr & 0x1ff);
427420
428421      if(hscr & 0x8000) {
429         UINT16 *hscrtb = sys24_tile_ram + 0x4000 + 0x200*layer;
422         UINT16 *hscrtb = tile_ram + 0x4000 + 0x200*layer;
430423
431424         switch((ctrl & 0x6000) >> 13) {
432425         case 1: {
r11224r11225
446439               hscr = hscrtb[y];
447440
448441               h = hscr & 0x1ff;
449               tilemap_set_scrollx(sys24_tile_layer[l1], 0, -h);
450               tilemap_draw(bitmap, &c, sys24_tile_layer[l1], tpri, lpri);
442               tilemap_set_scrollx(tile_layer[l1], 0, -h);
443               tilemap_draw(bitmap, &c, tile_layer[l1], tpri, lpri);
451444            }
452445            break;
453446         }
r11224r11225
462455               hscr = hscrtb[y];
463456
464457               h = hscr & 0x1ff;
465               tilemap_set_scrollx(sys24_tile_layer[layer],   0, -h);
466               tilemap_set_scrollx(sys24_tile_layer[layer|1], 0, -h);
458               tilemap_set_scrollx(tile_layer[layer],   0, -h);
459               tilemap_set_scrollx(tile_layer[layer|1], 0, -h);
467460
468461               if(c1.max_x >= h)
469462                  c1.max_x = h-1;
r11224r11225
474467
475468               c1.min_y = c1.max_y = c2.min_y = c2.max_y = y;
476469
477               tilemap_draw(bitmap, &c1, sys24_tile_layer[l1],   tpri, lpri);
478               tilemap_draw(bitmap, &c2, sys24_tile_layer[l1^1], tpri, lpri);
470               tilemap_draw(bitmap, &c1, tile_layer[l1],   tpri, lpri);
471               tilemap_draw(bitmap, &c2, tile_layer[l1^1], tpri, lpri);
479472            }
480473            break;
481474         }
482475         }
483476
484477      } else {
485         tilemap_set_scrollx(sys24_tile_layer[layer],   0, -(hscr & 0x1ff));
486         tilemap_set_scrollx(sys24_tile_layer[layer|1], 0, -(hscr & 0x1ff));
478         tilemap_set_scrollx(tile_layer[layer],   0, -(hscr & 0x1ff));
479         tilemap_set_scrollx(tile_layer[layer|1], 0, -(hscr & 0x1ff));
487480
488481         switch((ctrl & 0x6000) >> 13) {
489482         case 1: {
r11224r11225
498491            if(!((-vscr) & 0x200))
499492               layer ^= 1;
500493
501            tilemap_draw(bitmap, &c1, sys24_tile_layer[layer],   tpri, lpri);
502            tilemap_draw(bitmap, &c2, sys24_tile_layer[layer^1], tpri, lpri);
494            tilemap_draw(bitmap, &c1, tile_layer[layer],   tpri, lpri);
495            tilemap_draw(bitmap, &c2, tile_layer[layer^1], tpri, lpri);
503496            break;
504497         }
505498         case 2: case 3: {
r11224r11225
514507            if(!((+hscr) & 0x200))
515508               layer ^= 1;
516509
517            tilemap_draw(bitmap, &c1, sys24_tile_layer[layer],   tpri, lpri);
518            tilemap_draw(bitmap, &c2, sys24_tile_layer[layer^1], tpri, lpri);
510            tilemap_draw(bitmap, &c1, tile_layer[layer],   tpri, lpri);
511            tilemap_draw(bitmap, &c2, tile_layer[layer^1], tpri, lpri);
519512            break;
520513         }
521514         }
r11224r11225
523516
524517   } else {
525518      bitmap_t *bm, *tm;
526      void (*draw)(running_machine &machine, bitmap_t *, bitmap_t *, bitmap_t *, const UINT16 *,
519      void (segas24_tile::*draw)(bitmap_t *, bitmap_t *, bitmap_t *, const UINT16 *,
527520                UINT16, UINT8, int, int, int, int, int, int, int);
528521      int win = layer & 1;
529522
530523      if(bitmap->format != BITMAP_FORMAT_INDEXED16)
531         draw = sys24_tile_draw_rect_rgb;
524         draw = &segas24_tile::draw_rect_rgb;
532525      else
533         draw = sys24_tile_draw_rect;
526         draw = &segas24_tile::draw_rect;
534527
535      bm = tilemap_get_pixmap(sys24_tile_layer[layer]);
536      tm = tilemap_get_flagsmap(sys24_tile_layer[layer]);
528      bm = tilemap_get_pixmap(tile_layer[layer]);
529      tm = tilemap_get_flagsmap(tile_layer[layer]);
537530
538531      if(hscr & 0x8000) {
539532         int y;
540         UINT16 *hscrtb = sys24_tile_ram + 0x4000 + 0x200*layer;
533         UINT16 *hscrtb = tile_ram + 0x4000 + 0x200*layer;
541534         vscr &= 0x1ff;
542535
543536         for(y=0; y<384; y++) {
544537            hscr = (-hscrtb[y]) & 0x1ff;
545538            if(hscr + 496 <= 512) {
546539               // Horizontal split unnecessary
547               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        y,      496,      y+1);
540               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        y,      496,      y+1);
548541            } else {
549542               // Horizontal split necessary
550               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        y, 512-hscr,      y+1);
551               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        y,      496,      y+1);
543               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        y, 512-hscr,      y+1);
544               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        y,      496,      y+1);
552545            }
553546            vscr = (vscr + 1) & 0x1ff;
554547         }
r11224r11225
560553            // Horizontal split unnecessary
561554            if(vscr + 384 <= 512) {
562555               // Vertical split unnecessary
563               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0,      496,      384);
556               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0,      496,      384);
564557            } else {
565558               // Vertical split necessary
566               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0,      496, 512-vscr);
567               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr,    0,        0, 512-vscr,      496,      384);
559               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0,      496, 512-vscr);
560               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr,    0,        0, 512-vscr,      496,      384);
568561
569562            }
570563         } else {
571564            // Horizontal split necessary
572565            if(vscr + 384 <= 512) {
573566               // Vertical split unnecessary
574               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0, 512-hscr,      384);
575               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        0,      496,      384);
567               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0, 512-hscr,      384);
568               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        0,      496,      384);
576569            } else {
577570               // Vertical split necessary
578               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0, 512-hscr, 512-vscr);
579               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        0,      496, 512-vscr);
580               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr,    0,        0, 512-vscr, 512-hscr,      384);
581               draw(machine, bm, tm, bitmap, mask, tpri, lpri, win,    0,    0, 512-hscr, 512-vscr,      496,      384);
571               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr,        0,        0, 512-hscr, 512-vscr);
572               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win,    0, vscr, 512-hscr,        0,      496, 512-vscr);
573               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr,    0,        0, 512-vscr, 512-hscr,      384);
574               (this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win,    0,    0, 512-hscr, 512-vscr,      496,      384);
582575            }
583576         }
584577      }
585578   }
586579}
587580
588READ16_HANDLER(sys24_tile_r)
581READ16_MEMBER(segas24_tile::tile_r)
589582{
590   return sys24_tile_ram[offset];
583   return tile_ram[offset];
591584}
592585
593READ16_HANDLER(sys24_char_r)
586READ16_MEMBER(segas24_tile::char_r)
594587{
595   return sys24_char_ram[offset];
588   return char_ram[offset];
596589}
597590
598WRITE16_HANDLER(sys24_tile_w)
591WRITE16_MEMBER(segas24_tile::tile_w)
599592{
600   COMBINE_DATA(sys24_tile_ram + offset);
593   COMBINE_DATA(tile_ram + offset);
601594   if(offset < 0x4000)
602      tilemap_mark_tile_dirty(sys24_tile_layer[offset >> 12], offset & 0xfff);
595      tilemap_mark_tile_dirty(tile_layer[offset >> 12], offset & 0xfff);
603596}
604597
605WRITE16_HANDLER(sys24_char_w)
598WRITE16_MEMBER(segas24_tile::char_w)
606599{
607   UINT16 old = sys24_char_ram[offset];
608   COMBINE_DATA(sys24_char_ram + offset);
609   if(old != sys24_char_ram[offset]) {
610      gfx_element_mark_dirty(space->machine().gfx[sys24_char_gfx_index], offset / 16);
611   }
600   UINT16 old = char_ram[offset];
601   COMBINE_DATA(char_ram + offset);
602   if(old != char_ram[offset])
603      gfx_element_mark_dirty(machine().gfx[char_gfx_index], offset / 16);
612604}
613605
614READ32_HANDLER(sys24_tile32_r)
606READ32_MEMBER(segas24_tile::tile32_r)
615607{
616   return sys24_tile_r(space, offset*2, mem_mask&0xffff) | sys24_tile_r(space, (offset*2)+1, mem_mask>>16)<<16;
608   return tile_r(space, offset*2, mem_mask&0xffff) | tile_r(space, (offset*2)+1, mem_mask>>16)<<16;
617609}
618610
619READ32_HANDLER(sys24_char32_r)
611READ32_MEMBER(segas24_tile::char32_r)
620612{
621   return sys24_char_r(space, offset*2, mem_mask&0xffff) | sys24_char_r(space, (offset*2)+1, mem_mask>>16)<<16;
613   return char_r(space, offset*2, mem_mask&0xffff) | char_r(space, (offset*2)+1, mem_mask>>16)<<16;
622614}
623615
624WRITE32_HANDLER(sys24_tile32_w)
616WRITE32_MEMBER(segas24_tile::tile32_w)
625617{
626   sys24_tile_w(space, offset*2, data&0xffff, mem_mask&0xffff);
627   sys24_tile_w(space, (offset*2)+1, data>>16, mem_mask>>16);
618   tile_w(space, offset*2, data&0xffff, mem_mask&0xffff);
619   tile_w(space, (offset*2)+1, data>>16, mem_mask>>16);
628620}
629621
630WRITE32_HANDLER(sys24_char32_w)
622WRITE32_MEMBER(segas24_tile::char32_w)
631623{
632   sys24_char_w(space,offset*2, data&0xffff, mem_mask&0xffff);
633   sys24_char_w(space,(offset*2)+1, data>>16, mem_mask>>16);
624   char_w(space, offset*2, data&0xffff, mem_mask&0xffff);
625   char_w(space, (offset*2)+1, data>>16, mem_mask>>16);
634626}
635627
636// - System 24
637628
638static UINT16 *sys24_sprite_ram;
629segas24_sprite::segas24_sprite(running_machine &_machine, const segas24_sprite_config &_config)
630   : device_t(_machine, _config),
631     config(_config)
632{
633}
639634
640void sys24_sprite_vh_start(running_machine &machine)
635void segas24_sprite::device_start()
641636{
642   sys24_sprite_ram = auto_alloc_array(machine, UINT16, 0x40000/2);
637   sprite_ram = auto_alloc_array(machine(), UINT16, 0x40000/2);
643638
644   state_save_register_global_pointer(machine, sys24_sprite_ram, 0x40000/2);
645   //  kc = 0;
639   save_pointer(NAME(sprite_ram), 0x40000/2);
646640}
647641
648642/* System24 sprites
r11224r11225
669663    0   11------    --------
670664*/
671665
672void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const int *spri)
666void segas24_sprite::draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri)
673667{
674668   UINT16 curspr = 0;
675669   int countspr = 0;
r11224r11225
686680      UINT16 *source;
687681      UINT16 type;
688682
689      source = sys24_sprite_ram + (curspr << 3);
683      source = sprite_ram + (curspr << 3);
690684
691685      if(curspr == 0 && source[0] == 0)
692686         break;
r11224r11225
783777      flipy = source[4] & 0x8000;
784778      sy = 1 << ((source[4] & 0x7000) >> 12);
785779
786      pix = &sys24_sprite_ram[(source[3] & 0x3fff)* 0x8];
780      pix = &sprite_ram[(source[3] & 0x3fff)* 0x8];
787781      for(px=0; px<8; px++) {
788782         int c;
789783         c              = pix[px] >> 8;
r11224r11225
830824                           if(xpos2 >= min_x && xpos2 <= max_x) {
831825                              int zx1 = flipx ? 7-zx : zx;
832826                              UINT32 neweroffset = (newoffset+(zx1>>2))&0x1ffff; // crackdown sometimes attempts to use data past the end of spriteram
833                              int c = (sys24_sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf;
834                              UINT8 *pri = BITMAP_ADDR8(machine.priority_bitmap, ypos1, xpos2);
827                              int c = (sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf;
828                              UINT8 *pri = BITMAP_ADDR8(machine().priority_bitmap, ypos1, xpos2);
835829                              if(!(*pri & pm[c])) {
836830                                 c = colors[c];
837831                                 if(c) {
r11224r11225
868862}
869863
870864
871WRITE16_HANDLER(sys24_sprite_w)
865WRITE16_MEMBER(segas24_sprite::write)
872866{
873   COMBINE_DATA(sys24_sprite_ram + offset);
867   COMBINE_DATA(sprite_ram + offset);
874868}
875869
876READ16_HANDLER(sys24_sprite_r)
870READ16_MEMBER(segas24_sprite::read)
877871{
878   return sys24_sprite_ram[offset];
872   return sprite_ram[offset];
879873}
880874
881// Programmable mixers
882//   System 24
883875
884static UINT16 sys24_mixer_reg[0x10];
876segas24_mixer::segas24_mixer(running_machine &_machine, const segas24_mixer_config &_config)
877   : device_t(_machine, _config),
878     config(_config)
879{
880}
885881
886void sys24_mixer_vh_start(running_machine &machine)
882void segas24_mixer::device_start()
887883{
888   memset(sys24_mixer_reg, 0, sizeof(sys24_mixer_reg));
889   state_save_register_global_array(machine, sys24_mixer_reg);
884   memset(mixer_reg, 0, sizeof(mixer_reg));
885   save_item(NAME(mixer_reg));
890886}
891887
892WRITE16_HANDLER (sys24_mixer_w)
888WRITE16_MEMBER(segas24_mixer::write)
893889{
894   COMBINE_DATA(sys24_mixer_reg + offset);
890   COMBINE_DATA(mixer_reg + offset);
895891}
896892
897READ16_HANDLER (sys24_mixer_r)
893READ16_MEMBER(segas24_mixer::read)
898894{
899   return sys24_mixer_reg[offset];
895   return mixer_reg[offset];
900896}
901897
902int sys24_mixer_get_reg(int reg)
898UINT16 segas24_mixer::get_reg(int reg)
903899{
904   return sys24_mixer_reg[reg];
900   return mixer_reg[reg];
905901}
906902
src/mame/video/segaic24.h
r11224r11225
1#ifndef __SEGAIC_H
2#define __SEGAIC_H
1#ifndef __SEGAIC24_H
2#define __SEGAIC24_H
33
4/* system24temp_ functions / variables are from shared rewrite files,
5   once the rest of the rewrite is complete they can be removed, I
6   just made a copy & renamed them for now to avoid any conflicts
7*/
4#define MCFG_S24TILE_DEVICE_ADD(_tag, tile_mask) \
5   MCFG_DEVICE_ADD(_tag, S24TILE, 0) \
6   segas24_tile_config::static_set_tile_mask(device, tile_mask);
87
9READ16_HANDLER (system24temp_sys16_paletteram1_r);
10WRITE16_HANDLER (system24temp_sys16_paletteram1_w);
8#define MCFG_S24SPRITE_DEVICE_ADD(_tag) \
9   MCFG_DEVICE_ADD(_tag, S24SPRITE, 0)
1110
12// Tilemaps
13//  System24
14void sys24_tile_vh_start(running_machine &machine, UINT16 tile_mask);
15void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
11#define MCFG_S24MIXER_DEVICE_ADD(_tag) \
12   MCFG_DEVICE_ADD(_tag, S24MIXER, 0)
1613
17READ16_HANDLER(sys24_tile_r);
18READ16_HANDLER(sys24_char_r);
19WRITE16_HANDLER(sys24_tile_w);
20WRITE16_HANDLER(sys24_char_w);
14class segas24_tile;
15class segas24_sprite;
16class segas24_mixer;
2117
22READ32_HANDLER(sys24_tile32_r);
23READ32_HANDLER(sys24_char32_r);
24WRITE32_HANDLER(sys24_tile32_w);
25WRITE32_HANDLER(sys24_char32_w);
18class segas24_tile_config : public device_config
19{
20   friend class segas24_tile;
2621
27// Sprites
28//  System24
29void sys24_sprite_vh_start(running_machine &machine);
30void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const int *spri);
22protected:
23   segas24_tile_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
3124
32WRITE16_HANDLER (sys24_sprite_w);
33READ16_HANDLER (sys24_sprite_r);
25public:
26   static void static_set_tile_mask(device_config *device, UINT16 tile_mask);
3427
35// Programmable mixers
36//  System24
37void sys24_mixer_vh_start(running_machine &machine);
38int sys24_mixer_get_reg(int reg);
28   static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
29   virtual device_t *alloc_device(running_machine &machine) const;
3930
40WRITE16_HANDLER (sys24_mixer_w);
41READ16_HANDLER (sys24_mixer_r);
31private:
32   UINT16 tile_mask;
33};
4234
35class segas24_sprite_config : public device_config
36{
37   friend class segas24_sprite;
38
39protected:
40   segas24_sprite_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
41
42public:
43   static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
44   virtual device_t *alloc_device(running_machine &machine) const;
45};
46
47class segas24_mixer_config : public device_config
48{
49   friend class segas24_mixer;
50
51protected:
52   segas24_mixer_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
53
54public:
55   static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
56   virtual device_t *alloc_device(running_machine &machine) const;
57};
58
59
60class segas24_tile : public device_t
61{
62   friend class segas24_tile_config;
63
64   segas24_tile(running_machine &_machine, const segas24_tile_config &config);
65
66public:
67   DECLARE_READ16_MEMBER(tile_r);
68   DECLARE_WRITE16_MEMBER(tile_w);
69   DECLARE_READ16_MEMBER(char_r);
70   DECLARE_WRITE16_MEMBER(char_w);
71
72   DECLARE_READ32_MEMBER(tile32_r);
73   DECLARE_WRITE32_MEMBER(tile32_w);
74   DECLARE_READ32_MEMBER(char32_r);
75   DECLARE_WRITE32_MEMBER(char32_w);
76
77   void draw(bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
78
79protected:
80   virtual void device_start();
81
82   const segas24_tile_config &config;
83
84private:
85   enum {
86      SYS24_TILES = 0x4000
87   };
88
89   UINT16 *char_ram, *tile_ram;
90   int char_gfx_index;
91   tilemap_t *tile_layer[4];
92
93   static const gfx_layout char_layout;
94
95   void tile_info(int offset, tile_data *tileinfo, tilemap_memory_index tile_index);
96   static TILE_GET_INFO_DEVICE(tile_info_0s);
97   static TILE_GET_INFO_DEVICE(tile_info_0w);
98   static TILE_GET_INFO_DEVICE(tile_info_1s);
99   static TILE_GET_INFO_DEVICE(tile_info_1w);
100
101   void draw_rect(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
102               UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);
103   void draw_rect_rgb(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
104                  UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);
105
106};
107
108class segas24_sprite : public device_t
109{
110   friend class segas24_sprite_config;
111
112   segas24_sprite(running_machine &_machine, const segas24_sprite_config &config);
113
114public:
115   DECLARE_READ16_MEMBER(read);
116   DECLARE_WRITE16_MEMBER(write);
117
118   void draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri);
119
120protected:
121   virtual void device_start();
122
123   const segas24_sprite_config &config;
124
125private:
126   UINT16 *sprite_ram;
127};
128
129
130class segas24_mixer : public device_t
131{
132   friend class segas24_mixer_config;
133
134   segas24_mixer(running_machine &_machine, const segas24_mixer_config &config);
135
136public:
137   DECLARE_READ16_MEMBER(read);
138   DECLARE_WRITE16_MEMBER(write);
139
140   UINT16 get_reg(int reg);
141
142protected:
143   virtual void device_start();
144
145   const segas24_mixer_config &config;
146
147private:
148   UINT16 mixer_reg[16];
149};
150
151extern const device_type S24TILE, S24SPRITE, S24MIXER;
152
43153#endif
src/mame/video/victory.c
r11224r11225
5757   state->m_scrollx = state->m_scrolly = 0;
5858   state->m_video_control = 0;
5959   memset(&state->m_micro, 0, sizeof(state->m_micro));
60   state->m_micro.timer = machine.scheduler().timer_alloc(FUNC(NULL));
60   state->m_micro.timer = machine.scheduler().timer_alloc(FUNC_NULL);
6161
6262   /* register for state saving */
6363   state_save_register_global_array(machine, state->m_paletteram);
src/mame/video/segas24.c
r11224r11225
1#include <vector>
2#include <algorithm>
3
14#include "emu.h"
25#include "video/segaic24.h"
36#include "includes/segas24.h"
r11224r11225
25
3VIDEO_START(system24)
4{
5   sys24_tile_vh_start(machine, 0xfff);
6   sys24_sprite_vh_start(machine);
7   sys24_mixer_vh_start(machine);
8}
96
10static int layer_cmp(const void *pl1, const void *pl2)
11{
12   static const int default_pri[12] = { 0, 1, 2, 3, 4, 5, 6, 7, -4, -3, -2, -1 };
13   int l1 = *(int *)pl1;
14   int l2 = *(int *)pl2;
15   int p1 = sys24_mixer_get_reg(l1) & 7;
16   int p2 = sys24_mixer_get_reg(l2) & 7;
17   if(p1 != p2)
18      return p1 - p2;
19   return default_pri[l2] - default_pri[l1];
20}
7namespace {
8   struct layer_sort {
9      layer_sort(segas24_mixer *_mixer) { mixer = _mixer; }
2110
11      bool operator()(int l1, int l2) {
12         static const int default_pri[12] = { 0, 1, 2, 3, 4, 5, 6, 7, -4, -3, -2, -1 };
13         int p1 = mixer->get_reg(l1) & 7;
14         int p2 = mixer->get_reg(l2) & 7;
15         if(p1 != p2)
16            return p1 - p2 < 0;
17         return default_pri[l2] - default_pri[l1] < 0;
18      }
19
20      segas24_mixer *mixer;
21   };
22};
23
2224SCREEN_UPDATE(system24)
2325{
24   int i, level;
25   int order[12], spri[4];
26   segas24_state *state = screen->machine().driver_data<segas24_state>();
2627
27   if(sys24_mixer_get_reg(13) & 1) {
28   if(state->vmixer->get_reg(13) & 1) {
2829      bitmap_fill(bitmap, 0, get_black_pen(screen->machine()));
r11224r11225
3435   bitmap_fill(screen->machine().priority_bitmap, 0, 0);
3536   bitmap_fill(bitmap, cliprect, 0);
3637
37   for(i=0; i<12; i++)
38   std::vector<int> order;
39   order.resize(12);
40   for(int i=0; i<12; i++)
3841      order[i] = i;
39   qsort(order, 12, sizeof(int), layer_cmp);
4042
41   level = 0;
42   for(i=0; i<12; i++)
43   std::sort(order.begin(), order.end(), layer_sort(state->vmixer));
44
45   int spri[4];
46   int level = 0;
47   for(int i=0; i<12; i++)
4348      if(order[i] < 8)
44         sys24_tile_draw(screen->machine(), bitmap, cliprect, order[i], level, 0);
49         state->vtile->draw(bitmap, cliprect, order[i], level, 0);
4550      else {
4651         spri[order[i]-8] = level;
4752         level++;
4853      }
4954
50   sys24_sprite_draw(screen->machine(), bitmap, cliprect, spri);
55   state->vsprite->draw(bitmap, cliprect, spri);
5156   return 0;
5257}
src/mame/video/cidelsa.c
r11224r11225
107107WRITE_LINE_MEMBER( cidelsa_state::prd_w )
108108{
109109   /* invert PRD signal */
110   device_set_input_line(m_maincpu, COSMAC_INPUT_LINE_INT, state ? CLEAR_LINE : ASSERT_LINE);
111   device_set_input_line(m_maincpu, COSMAC_INPUT_LINE_EF1, state ? CLEAR_LINE : ASSERT_LINE);
110   m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, state ? CLEAR_LINE : ASSERT_LINE);
111   m_maincpu->set_input_line(COSMAC_INPUT_LINE_EF1, state ? CLEAR_LINE : ASSERT_LINE);
112112}
113113
114114/* Page RAM */
r11224r11225
125125
126126/* CDP1869 Interface */
127127
128static CDP1869_INTERFACE( destryer_cdp1869_intf )
128static CDP1869_INTERFACE( destryer_vis_intf )
129129{
130130   SCREEN_TAG,
131131   0,
r11224r11225
136136   DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, prd_w)
137137};
138138
139static CDP1869_INTERFACE( altair_cdp1869_intf )
139static CDP1869_INTERFACE( altair_vis_intf )
140140{
141141   SCREEN_TAG,
142142   0,
r11224r11225
147147   DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, prd_w)
148148};
149149
150static CDP1869_INTERFACE( draco_cdp1869_intf )
150static CDP1869_INTERFACE( draco_vis_intf )
151151{
152152   SCREEN_TAG,
153153   0,
r11224r11225
167167   m_charram = auto_alloc_array(m_machine, UINT8, CIDELSA_CHARRAM_SIZE);
168168
169169   // register for state saving
170   state_save_register_global(m_machine, m_cdp1869_pcb);
171   state_save_register_global_pointer(m_machine, m_pcbram, CIDELSA_CHARRAM_SIZE);
172   state_save_register_global_pointer(m_machine, m_charram, CIDELSA_CHARRAM_SIZE);
170   save_item(NAME(m_cdp1869_pcb));
171   save_pointer(NAME(m_pcbram), CIDELSA_CHARRAM_SIZE);
172   save_pointer(NAME(m_charram), CIDELSA_CHARRAM_SIZE);
173173}
174174
175175/* AY-3-8910 */
176176
177WRITE8_MEMBER( cidelsa_state::draco_ay8910_port_b_w )
177WRITE8_MEMBER( draco_state::psg_pb_w )
178178{
179179   /*
180180
r11224r11225
192192    */
193193}
194194
195static const ay8910_interface ay8910_config =
195static const ay8910_interface psg_intf =
196196{
197197   AY8910_SINGLE_OUTPUT,
198198   AY8910_DEFAULT_LOADS,
199199   DEVCB_NULL,
200200   DEVCB_NULL,
201201   DEVCB_NULL,
202   DEVCB_DRIVER_MEMBER(cidelsa_state, draco_ay8910_port_b_w)
202   DEVCB_DRIVER_MEMBER(draco_state, psg_pb_w)
203203};
204204
205205/* Machine Drivers */
r11224r11225
209209   MCFG_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044)
210210
211211   MCFG_SPEAKER_STANDARD_MONO("mono")
212   MCFG_CDP1869_ADD(CDP1869_TAG, DESTRYER_CHR2, destryer_cdp1869_intf, cidelsa_page_ram)
212   MCFG_CDP1869_ADD(CDP1869_TAG, DESTRYER_CHR2, destryer_vis_intf, cidelsa_page_ram)
213213   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
214214MACHINE_CONFIG_END
215215
r11224r11225
218218   MCFG_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044)
219219
220220   MCFG_SPEAKER_STANDARD_MONO("mono")
221   MCFG_CDP1869_ADD(CDP1869_TAG, ALTAIR_CHR2, altair_cdp1869_intf, cidelsa_page_ram)
221   MCFG_CDP1869_ADD(CDP1869_TAG, ALTAIR_CHR2, altair_vis_intf, cidelsa_page_ram)
222222   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
223223MACHINE_CONFIG_END
224224
r11224r11225
227227   MCFG_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.360, 0.024)
228228
229229   MCFG_SPEAKER_STANDARD_MONO("mono")
230   MCFG_CDP1869_ADD(CDP1869_TAG, DRACO_CHR2, draco_cdp1869_intf, draco_page_ram)
230   MCFG_CDP1869_ADD(CDP1869_TAG, DRACO_CHR2, draco_vis_intf, draco_page_ram)
231231   MCFG_SOUND_ADD(AY8910_TAG, AY8910, DRACO_SND_CHR1)
232   MCFG_SOUND_CONFIG(ay8910_config)
232   MCFG_SOUND_CONFIG(psg_intf)
233233   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
234234MACHINE_CONFIG_END
src/mame/video/taito_f3.c
r11224r11225
631631      tilemap_set_transparent_pen(state->m_pf1_tilemap,0);
632632      tilemap_set_transparent_pen(state->m_pf2_tilemap,0);
633633      tilemap_set_transparent_pen(state->m_pf3_tilemap,0);
634      tilemap_set_transparent_pen(state->m_pf4_tilemap,0);   
634      tilemap_set_transparent_pen(state->m_pf4_tilemap,0);
635635      tilemap_set_transparent_pen(state->m_pf5_tilemap,0);
636636      tilemap_set_transparent_pen(state->m_pf6_tilemap,0);
637637      tilemap_set_transparent_pen(state->m_pf7_tilemap,0);
r11224r11225
747747   COMBINE_DATA(&state->m_f3_pf_data[offset]);
748748
749749   if (state->m_f3_game_config->extend) {
750      if       (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0xfff) >> 1);
750      if      (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0xfff) >> 1);
751751      else if (offset<0x2000) tilemap_mark_tile_dirty(state->m_pf2_tilemap,(offset & 0xfff) >> 1);
752752      else if (offset<0x3000) tilemap_mark_tile_dirty(state->m_pf3_tilemap,(offset & 0xfff) >> 1);
753753      else if (offset<0x4000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,(offset & 0xfff) >> 1);
754754   } else {
755      if       (offset<0x0800) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0x7ff) >> 1);
755      if      (offset<0x0800) tilemap_mark_tile_dirty(state->m_pf1_tilemap,(offset & 0x7ff) >> 1);
756756      else if (offset<0x1000) tilemap_mark_tile_dirty(state->m_pf2_tilemap,(offset & 0x7ff) >> 1);
757757      else if (offset<0x1800) tilemap_mark_tile_dirty(state->m_pf3_tilemap,(offset & 0x7ff) >> 1);
758758      else if (offset<0x2000) tilemap_mark_tile_dirty(state->m_pf4_tilemap,(offset & 0x7ff) >> 1);
r11224r11225
19481948      _colscroll[y]=colscroll;
19491949      _x_offset[y]=(x_offset&0xffff0000) - (x_offset&0x0000ffff);
19501950      _y_zoom[y] = (line_zoom&0xff) << 9;
1951   
1951
19521952      /* Evaluate clipping */
19531953      if (pri&0x0800)
19541954         line_enable=0;
r11224r11225
19861986
19871987      /* The football games use values in the range 0x200-0x3ff where the crowd should be drawn - !?
19881988
1989         This appears to cause it to reference outside of the normal tilemap RAM area into the unused
1990         area on the 32x32 tilemap configuration.. but exactly how isn't understood
1989           This appears to cause it to reference outside of the normal tilemap RAM area into the unused
1990           area on the 32x32 tilemap configuration.. but exactly how isn't understood
19911991
19921992            Until this is understood we're creating additional tilemaps for the otherwise unused area of
1993         RAM and forcing it to look up there.
1993            RAM and forcing it to look up there.
19941994
1995         the crowd area still seems to 'lag' behind the pitch area however.. but these are the values
1996         in ram??
1995            the crowd area still seems to 'lag' behind the pitch area however.. but these are the values
1996            in ram??
19971997        */
19981998      int cs = _colscroll[y];
1999     
1999
20002000      if (cs&0x200)
20012001      {
20022002         if (state->m_pf5_tilemap && state->m_pf6_tilemap)
src/mame/layout/bfm_sc1.lay
r11224r11225
20892089      </screen>
20902090   </view>
20912091</mamelayout>
2092
2093<?xml version="1.0"?>
2094<mamelayout version="2">
2095   <element name="matrixlamp">
2096      <rect state ="0">
2097         <bounds x="0" y="0" width="7" height="7" />
2098         <color red="0.7" green="0.7" blue="0.7" />
2099      </rect>
2100      <rect state ="1">
2101         <bounds x="0" y="0" width="7" height="7" />
2102         <color red="0.0" green="0.0" blue="1.0" />
2103      </rect>
2104      <rect state ="2">
2105         <bounds x="0" y="0" width="7" height="7" />
2106         <color red="0.0" green="1.0" blue="0.0" />
2107      </rect>
2108   </element>
2109   <element name="vfd0">
2110   <led14segsc>
2111         <color red="0" green="0.6" blue="1.0" />
2112   </led14segsc>
2113   </element>
2114   <element name="Steppers" defstate="96">
2115      <text string="00" state="0">
2116         <color red="1.0" green="1.0" blue="1.0" />
2117         <bounds x="0" y="0.1" width="1" height="1" />
2118      </text>
2119      <text string="01" state="1">
2120         <color red="1.0" green="1.0" blue="1.0" />
2121         <bounds x="0" y="0.1" width="1" height="1" />
2122      </text>
2123      <text string="02" state="2">
2124         <color red="1.0" green="1.0" blue="1.0" />
2125         <bounds x="0" y="0.1" width="1" height="1" />
2126      </text>
2127      <text string="03" state="3">
2128         <color red="1.0" green="1.0" blue="1.0" />
2129         <bounds x="0" y="0.1" width="1" height="1" />
2130      </text>
2131      <text string="04" state="4">
2132         <color red="1.0" green="1.0" blue="1.0" />
2133         <bounds x="0" y="0.1" width="1" height="1" />
2134      </text>
2135      <text string="05" state="5">
2136         <color red="1.0" green="1.0" blue="1.0" />
2137         <bounds x="0" y="0.1" width="1" height="1" />
2138      </text>
2139      <text string="06" state="6">
2140         <color red="1.0" green="1.0" blue="1.0" />
2141         <bounds x="0" y="0.1" width="1" height="1" />
2142      </text>
2143      <text string="07" state="7">
2144         <color red="1.0" green="1.0" blue="1.0" />
2145         <bounds x="0" y="0.1" width="1" height="1" />
2146      </text>
2147      <text string="08" state="8">
2148         <color red="1.0" green="1.0" blue="1.0" />
2149         <bounds x="0" y="0.1" width="1" height="1" />
2150      </text>
2151      <text string="09" state="9">
2152         <color red="1.0" green="1.0" blue="1.0" />
2153         <bounds x="0" y="0.1" width="1" height="1" />
2154      </text>
2155      <text string="10" state="10">
2156         <color red="1.0" green="1.0" blue="1.0" />
2157         <bounds x="0" y="0.1" width="1" height="1" />
2158      </text>
2159      <text string="11" state="11">
2160         <color red="1.0" green="1.0" blue="1.0" />
2161         <bounds x="0" y="0.1" width="1" height="1" />
2162      </text>
2163      <text string="12" state="12">
2164         <color red="1.0" green="1.0" blue="1.0" />
2165         <bounds x="0" y="0.1" width="1" height="1" />
2166      </text>
2167      <text string="13" state="13">
2168         <color red="1.0" green="1.0" blue="1.0" />
2169         <bounds x="0" y="0.1" width="1" height="1" />
2170      </text>
2171      <text string="14" state="14">
2172         <color red="1.0" green="1.0" blue="1.0" />
2173         <bounds x="0" y="0.1" width="1" height="1" />
2174      </text>
2175      <text string="15" state="15">
2176         <color red="1.0" green="1.0" blue="1.0" />
2177         <bounds x="0" y="0.1" width="1" height="1" />
2178      </text>
2179      <text string="16" state="16">
2180         <color red="1.0" green="1.0" blue="1.0" />
2181         <bounds x="0" y="0.1" width="1" height="1" />
2182      </text>
2183      <text string="17" state="17">
2184         <color red="1.0" green="1.0" blue="1.0" />
2185         <bounds x="0" y="0.1" width="1" height="1" />
2186      </text>
2187      <text string="18" state="18">
2188         <color red="1.0" green="1.0" blue="1.0" />
2189         <bounds x="0" y="0.1" width="1" height="1" />
2190      </text>
2191      <text string="19" state="19">
2192         <color red="1.0" green="1.0" blue="1.0" />
2193         <bounds x="0" y="0.1" width="1" height="1" />
2194      </text>
2195      <text string="20" state="20">
2196         <color red="1.0" green="1.0" blue="1.0" />
2197         <bounds x="0" y="0.1" width="1" height="1" />
2198      </text>
2199      <text string="21" state="21">
2200         <color red="1.0" green="1.0" blue="1.0" />
2201         <bounds x="0" y="0.1" width="1" height="1" />
2202      </text>
2203      <text string="22" state="22">
2204         <color red="1.0" green="1.0" blue="1.0" />
2205         <bounds x="0" y="0.1" width="1" height="1" />
2206      </text>
2207      <text string="23" state="23">
2208         <color red="1.0" green="1.0" blue="1.0" />
2209         <bounds x="0" y="0.1" width="1" height="1" />
2210      </text>
2211      <text string="24" state="24">
2212         <color red="1.0" green="1.0" blue="1.0" />
2213         <bounds x="0" y="0.1" width="1" height="1" />
2214      </text>
2215      <text string="25" state="25">
2216         <color red="1.0" green="1.0" blue="1.0" />
2217         <bounds x="0" y="0.1" width="1" height="1" />
2218      </text>
2219      <text string="26" state="26">
2220         <color red="1.0" green="1.0" blue="1.0" />
2221         <bounds x="0" y="0.1" width="1" height="1" />
2222      </text>
2223      <text string="27" state="27">
2224         <color red="1.0" green="1.0" blue="1.0" />
2225         <bounds x="0" y="0.1" width="1" height="1" />
2226      </text>
2227      <text string="28" state="28">
2228         <color red="1.0" green="1.0" blue="1.0" />
2229         <bounds x="0" y="0.1" width="1" height="1" />
2230      </text>
2231      <text string="29" state="29">
2232         <color red="1.0" green="1.0" blue="1.0" />
2233         <bounds x="0" y="0.1" width="1" height="1" />
2234      </text>
2235      <text string="30" state="30">
2236         <color red="1.0" green="1.0" blue="1.0" />
2237         <bounds x="0" y="0.1" width="1" height="1" />
2238      </text>
2239      <text string="31" state="31">
2240         <color red="1.0" green="1.0" blue="1.0" />
2241         <bounds x="0" y="0.1" width="1" height="1" />
2242      </text>
2243      <text string="32" state="32">
2244         <color red="1.0" green="1.0" blue="1.0" />
2245         <bounds x="0" y="0.1" width="1" height="1" />
2246      </text>
2247      <text string="33" state="33">
2248         <color red="1.0" green="1.0" blue="1.0" />
2249         <bounds x="0" y="0.1" width="1" height="1" />
2250      </text>
2251      <text string="34" state="34">
2252         <color red="1.0" green="1.0" blue="1.0" />
2253         <bounds x="0" y="0.1" width="1" height="1" />
2254      </text>
2255      <text string="35" state="35">
2256         <color red="1.0" green="1.0" blue="1.0" />
2257         <bounds x="0" y="0.1" width="1" height="1" />
2258      </text>
2259      <text string="36" state="36">
2260         <color red="1.0" green="1.0" blue="1.0" />
2261         <bounds x="0" y="0.1" width="1" height="1" />
2262      </text>
2263      <text string="37" state="37">
2264         <color red="1.0" green="1.0" blue="1.0" />
2265         <bounds x="0" y="0.1" width="1" height="1" />
2266      </text>
2267      <text string="38" state="38">
2268         <color red="1.0" green="1.0" blue="1.0" />
2269         <bounds x="0" y="0.1" width="1" height="1" />
2270      </text>
2271      <text string="39" state="39">
2272         <color red="1.0" green="1.0" blue="1.0" />
2273         <bounds x="0" y="0.1" width="1" height="1" />
2274      </text>
2275      <text string="40" state="40">
2276         <color red="1.0" green="1.0" blue="1.0" />
2277         <bounds x="0" y="0.1" width="1" height="1" />
2278      </text>
2279      <text string="41" state="41">
2280         <color red="1.0" green="1.0" blue="1.0" />
2281         <bounds x="0" y="0.1" width="1" height="1" />
2282      </text>
2283      <text string="42" state="42">
2284         <color red="1.0" green="1.0" blue="1.0" />
2285         <bounds x="0" y="0.1" width="1" height="1" />
2286      </text>
2287      <text string="43" state="43">
2288         <color red="1.0" green="1.0" blue="1.0" />
2289         <bounds x="0" y="0.1" width="1" height="1" />
2290      </text>
2291      <text string="44" state="44">
2292         <color red="1.0" green="1.0" blue="1.0" />
2293         <bounds x="0" y="0.1" width="1" height="1" />
2294      </text>
2295      <text string="45" state="45">
2296         <color red="1.0" green="1.0" blue="1.0" />
2297         <bounds x="0" y="0.1" width="1" height="1" />
2298      </text>
2299      <text string="46" state="46">
2300         <color red="1.0" green="1.0" blue="1.0" />
2301         <bounds x="0" y="0.1" width="1" height="1" />
2302      </text>
2303      <text string="47" state="47">
2304         <color red="1.0" green="1.0" blue="1.0" />
2305         <bounds x="0" y="0.1" width="1" height="1" />
2306      </text>
2307      <text string="48" state="48">
2308         <color red="1.0" green="1.0" blue="1.0" />
2309         <bounds x="0" y="0.1" width="1" height="1" />
2310      </text>
2311      <text string="49" state="49">
2312         <color red="1.0" green="1.0" blue="1.0" />
2313         <bounds x="0" y="0.1" width="1" height="1" />
2314      </text>
2315      <text string="50" state="50">
2316         <color red="1.0" green="1.0" blue="1.0" />
2317         <bounds x="0" y="0.1" width="1" height="1" />
2318      </text>
2319      <text string="51" state="51">
2320         <color red="1.0" green="1.0" blue="1.0" />
2321         <bounds x="0" y="0.1" width="1" height="1" />
2322      </text>
2323      <text string="52" state="52">
2324         <color red="1.0" green="1.0" blue="1.0" />
2325         <bounds x="0" y="0.1" width="1" height="1" />
2326      </text>
2327      <text string="53" state="53">
2328         <color red="1.0" green="1.0" blue="1.0" />
2329         <bounds x="0" y="0.1" width="1" height="1" />
2330      </text>
2331      <text string="54" state="54">
2332         <color red="1.0" green="1.0" blue="1.0" />
2333         <bounds x="0" y="0.1" width="1" height="1" />
2334      </text>
2335      <text string="55" state="55">
2336         <color red="1.0" green="1.0" blue="1.0" />
2337         <bounds x="0" y="0.1" width="1" height="1" />
2338      </text>
2339      <text string="56" state="56">
2340         <color red="1.0" green="1.0" blue="1.0" />
2341         <bounds x="0" y="0.1" width="1" height="1" />
2342      </text>
2343      <text string="57" state="57">
2344         <color red="1.0" green="1.0" blue="1.0" />
2345         <bounds x="0" y="0.1" width="1" height="1" />
2346      </text>
2347      <text string="58" state="58">
2348         <color red="1.0" green="1.0" blue="1.0" />
2349         <bounds x="0" y="0.1" width="1" height="1" />
2350      </text>
2351      <text string="59" state="59">
2352         <color red="1.0" green="1.0" blue="1.0" />
2353         <bounds x="0" y="0.1" width="1" height="1" />
2354      </text>
2355      <text string="60" state="60">
2356         <color red="1.0" green="1.0" blue="1.0" />
2357         <bounds x="0" y="0.1" width="1" height="1" />
2358      </text>
2359      <text string="61" state="61">
2360         <color red="1.0" green="1.0" blue="1.0" />
2361         <bounds x="0" y="0.1" width="1" height="1" />
2362      </text>
2363      <text string="62" state="62">
2364         <color red="1.0" green="1.0" blue="1.0" />
2365         <bounds x="0" y="0.1" width="1" height="1" />
2366      </text>
2367      <text string="63" state="63">
2368         <color red="1.0" green="1.0" blue="1.0" />
2369         <bounds x="0" y="0.1" width="1" height="1" />
2370      </text>
2371      <text string="64" state="64">
2372         <color red="1.0" green="1.0" blue="1.0" />
2373         <bounds x="0" y="0.1" width="1" height="1" />
2374      </text>
2375      <text string="65" state="65">
2376         <color red="1.0" green="1.0" blue="1.0" />
2377         <bounds x="0" y="0.1" width="1" height="1" />
2378      </text>
2379      <text string="66" state="66">
2380         <color red="1.0" green="1.0" blue="1.0" />
2381         <bounds x="0" y="0.1" width="1" height="1" />
2382      </text>
2383      <text string="67" state="67">
2384         <color red="1.0" green="1.0" blue="1.0" />
2385         <bounds x="0" y="0.1" width="1" height="1" />
2386      </text>
2387      <text string="68" state="68">
2388         <color red="1.0" green="1.0" blue="1.0" />
2389         <bounds x="0" y="0.1" width="1" height="1" />
2390      </text>
2391      <text string="69" state="69">
2392         <color red="1.0" green="1.0" blue="1.0" />
2393         <bounds x="0" y="0.1" width="1" height="1" />
2394      </text>
2395      <text string="70" state="70">
2396         <color red="1.0" green="1.0" blue="1.0" />
2397         <bounds x="0" y="0.1" width="1" height="1" />
2398      </text>
2399      <text string="71" state="71">
2400         <color red="1.0" green="1.0" blue="1.0" />
2401         <bounds x="0" y="0.1" width="1" height="1" />
2402      </text>
2403      <text string="72" state="72">
2404         <color red="1.0" green="1.0" blue="1.0" />
2405         <bounds x="0" y="0.1" width="1" height="1" />
2406      </text>
2407      <text string="73" state="73">
2408         <color red="1.0" green="1.0" blue="1.0" />
2409         <bounds x="0" y="0.1" width="1" height="1" />
2410      </text>
2411      <text string="74" state="74">
2412         <color red="1.0" green="1.0" blue="1.0" />
2413         <bounds x="0" y="0.1" width="1" height="1" />
2414      </text>
2415      <text string="75" state="75">
2416         <color red="1.0" green="1.0" blue="1.0" />
2417         <bounds x="0" y="0.1" width="1" height="1" />
2418      </text>
2419      <text string="76" state="76">
2420         <color red="1.0" green="1.0" blue="1.0" />
2421         <bounds x="0" y="0.1" width="1" height="1" />
2422      </text>
2423      <text string="77" state="77">
2424         <color red="1.0" green="1.0" blue="1.0" />
2425         <bounds x="0" y="0.1" width="1" height="1" />
2426      </text>
2427      <text string="78" state="78">
2428         <color red="1.0" green="1.0" blue="1.0" />
2429         <bounds x="0" y="0.1" width="1" height="1" />
2430      </text>
2431      <text string="79" state="79">
2432         <color red="1.0" green="1.0" blue="1.0" />
2433         <bounds x="0" y="0.1" width="1" height="1" />
2434      </text>
2435      <text string="80" state="80">
2436         <color red="1.0" green="1.0" blue="1.0" />
2437         <bounds x="0" y="0.1" width="1" height="1" />
2438      </text>
2439      <text string="81" state="81">
2440         <color red="1.0" green="1.0" blue="1.0" />
2441         <bounds x="0" y="0.1" width="1" height="1" />
2442      </text>
2443      <text string="82" state="82">
2444         <color red="1.0" green="1.0" blue="1.0" />
2445         <bounds x="0" y="0.1" width="1" height="1" />
2446      </text>
2447      <text string="83" state="83">
2448         <color red="1.0" green="1.0" blue="1.0" />
2449         <bounds x="0" y="0.1" width="1" height="1" />
2450      </text>
2451      <text string="84" state="84">
2452         <color red="1.0" green="1.0" blue="1.0" />
2453         <bounds x="0" y="0.1" width="1" height="1" />
2454      </text>
2455      <text string="85" state="85">
2456         <color red="1.0" green="1.0" blue="1.0" />
2457         <bounds x="0" y="0.1" width="1" height="1" />
2458      </text>
2459      <text string="86" state="86">
2460         <color red="1.0" green="1.0" blue="1.0" />
2461         <bounds x="0" y="0.1" width="1" height="1" />
2462      </text>
2463      <text string="87" state="87">
2464         <color red="1.0" green="1.0" blue="1.0" />
2465         <bounds x="0" y="0.1" width="1" height="1" />
2466      </text>
2467      <text string="88" state="88">
2468         <color red="1.0" green="1.0" blue="1.0" />
2469         <bounds x="0" y="0.1" width="1" height="1" />
2470      </text>
2471      <text string="89" state="89">
2472         <color red="1.0" green="1.0" blue="1.0" />
2473         <bounds x="0" y="0.1" width="1" height="1" />
2474      </text>
2475      <text string="90" state="90">
2476         <color red="1.0" green="1.0" blue="1.0" />
2477         <bounds x="0" y="0.1" width="1" height="1" />
2478      </text>
2479      <text string="91" state="91">
2480         <color red="1.0" green="1.0" blue="1.0" />
2481         <bounds x="0" y="0.1" width="1" height="1" />
2482      </text>
2483      <text string="92" state="92">
2484         <color red="1.0" green="1.0" blue="1.0" />
2485         <bounds x="0" y="0.1" width="1" height="1" />
2486      </text>
2487      <text string="93" state="93">
2488         <color red="1.0" green="1.0" blue="1.0" />
2489         <bounds x="0" y="0.1" width="1" height="1" />
2490      </text>
2491      <text string="94" state="94">
2492         <color red="1.0" green="1.0" blue="1.0" />
2493         <bounds x="0" y="0.1" width="1" height="1" />
2494      </text>
2495      <text string="95" state="95">
2496         <color red="1.0" green="1.0" blue="1.0" />
2497         <bounds x="0" y="0.1" width="1" height="1" />
2498      </text>
2499   </element>
2500
2501   <view name="Full Output">
2502      <screen index="0">
2503         <bounds x="127" y="0" width="400" height="280" />
2504      </screen>
2505      <backdrop name="vfd0" element="vfd0" state="0">
2506         <bounds x="10" y="280" width="9" height="17"/>
2507      </backdrop>
2508      <backdrop name="vfd1" element="vfd0" state="0">
2509         <bounds x="19" y="280" width="9" height="17"/>
2510      </backdrop>
2511      <backdrop name="vfd2" element="vfd0" state="0">
2512         <bounds x="28" y="280" width="9" height="17"/>
2513      </backdrop>
2514      <backdrop name="vfd3" element="vfd0" state="0">
2515         <bounds x="37" y="280" width="9" height="17"/>
2516      </backdrop>
2517      <backdrop name="vfd4" element="vfd0" state="0">
2518         <bounds x="46" y="280" width="9" height="17"/>
2519      </backdrop>
2520      <backdrop name="vfd5" element="vfd0" state="0">
2521         <bounds x="55" y="280" width="9" height="17"/>
2522      </backdrop>
2523      <backdrop name="vfd6" element="vfd0" state="0">
2524         <bounds x="64" y="280" width="9" height="17"/>
2525      </backdrop>
2526      <backdrop name="vfd7" element="vfd0" state="0">
2527         <bounds x="73" y="280" width="9" height="17"/>
2528      </backdrop>
2529      <backdrop name="vfd8" element="vfd0" state="0">
2530         <bounds x="82" y="280" width="9" height="17"/>
2531      </backdrop>
2532      <backdrop name="vfd9" element="vfd0" state="0">
2533         <bounds x="91" y="280" width="9" height="17"/>
2534      </backdrop>
2535      <backdrop name="vfd10" element="vfd0" state="0">
2536         <bounds x="100" y="280" width="9" height="17"/>
2537      </backdrop>
2538      <backdrop name="vfd11" element="vfd0" state="0">
2539         <bounds x="109" y="280" width="9" height="17"/>
2540      </backdrop>
2541      <backdrop name="vfd12" element="vfd0" state="0">
2542         <bounds x="118" y="280" width="9" height="17"/>
2543      </backdrop>
2544      <backdrop name="vfd13" element="vfd0" state="0">
2545         <bounds x="127" y="280" width="9" height="17"/>
2546      </backdrop>
2547      <backdrop name="vfd14" element="vfd0" state="0">
2548         <bounds x="136" y="280" width="9" height="17"/>
2549      </backdrop>
2550      <backdrop name="vfd15" element="vfd0" state="0">
2551         <bounds x="145" y="280" width="9" height="17"/>
2552      </backdrop>
2553      <backdrop name="reel1" element="Steppers" state="0">
2554         <bounds x="10" y="320" width="50" height="50"/>
2555      </backdrop>
2556      <backdrop name="reel2" element="Steppers" state="0">
2557         <bounds x="60" y="320" width="50" height="50"/>
2558      </backdrop>
2559      <backdrop name="reel3" element="Steppers" state="0">
2560         <bounds x="110" y="320" width="50" height="50"/>
2561      </backdrop>
2562      <backdrop name="reel4" element="Steppers" state="0">
2563         <bounds x="160" y="320" width="50" height="50"/>
2564      </backdrop>
2565      <backdrop name="reel5" element="Steppers" state="0">
2566         <bounds x="220" y="320" width="50" height="50"/>
2567      </backdrop>
2568      <backdrop name="reel6" element="Steppers" state="0">
2569         <bounds x="280" y="320" width="50" height="50"/>
2570      </backdrop>
2571      <backdrop name="lamp0" element="matrixlamp" state="0">
2572         <bounds x="0" y="0" width="7" height="7"/>
2573      </backdrop>
2574      <backdrop name="lamp1" element="matrixlamp" state="0">
2575         <bounds x="8" y="0" width="7" height="7"/>
2576      </backdrop>
2577      <backdrop name="lamp2" element="matrixlamp" state="0">
2578         <bounds x="16" y="0" width="7" height="7"/>
2579      </backdrop>
2580      <backdrop name="lamp3" element="matrixlamp" state="0">
2581         <bounds x="24" y="0" width="7" height="7"/>
2582      </backdrop>
2583      <backdrop name="lamp4" element="matrixlamp" state="0">
2584         <bounds x="32" y="0" width="7" height="7"/>
2585      </backdrop>
2586      <backdrop name="lamp5" element="matrixlamp" state="0">
2587         <bounds x="40" y="0" width="7" height="7"/>
2588      </backdrop>
2589      <backdrop name="lamp6" element="matrixlamp" state="0">
2590         <bounds x="48" y="0" width="7" height="7"/>
2591      </backdrop>
2592      <backdrop name="lamp7" element="matrixlamp" state="0">
2593         <bounds x="56" y="0" width="7" height="7"/>
2594      </backdrop>
2595      <backdrop name="lamp8" element="matrixlamp" state="0">
2596         <bounds x="64" y="0" width="7" height="7"/>
2597      </backdrop>
2598      <backdrop name="lamp9" element="matrixlamp" state="0">
2599         <bounds x="72" y="0" width="7" height="7"/>
2600      </backdrop>
2601      <backdrop name="lamp10" element="matrixlamp" state="0">
2602         <bounds x="80" y="0" width="7" height="7"/>
2603      </backdrop>
2604      <backdrop name="lamp11" element="matrixlamp" state="0">
2605         <bounds x="88" y="0" width="7" height="7"/>
2606      </backdrop>
2607      <backdrop name="lamp12" element="matrixlamp" state="0">
2608         <bounds x="96" y="0" width="7" height="7"/>
2609      </backdrop>
2610      <backdrop name="lamp13" element="matrixlamp" state="0">
2611         <bounds x="104" y="0" width="7" height="7"/>
2612      </backdrop>
2613      <backdrop name="lamp14" element="matrixlamp" state="0">
2614         <bounds x="112" y="0" width="7" height="7"/>
2615      </backdrop>
2616      <backdrop name="lamp15" element="matrixlamp" state="0">
2617         <bounds x="120" y="0" width="7" height="7"/>
2618      </backdrop>
2619      <backdrop name="lamp16" element="matrixlamp" state="0">
2620         <bounds x="0" y="8" width="7" height="7"/>
2621      </backdrop>
2622      <backdrop name="lamp17" element="matrixlamp" state="0">
2623         <bounds x="8" y="8" width="7" height="7"/>
2624      </backdrop>
2625      <backdrop name="lamp18" element="matrixlamp" state="0">
2626         <bounds x="16" y="8" width="7" height="7"/>
2627      </backdrop>
2628      <backdrop name="lamp19" element="matrixlamp" state="0">
2629         <bounds x="24" y="8" width="7" height="7"/>
2630      </backdrop>
2631      <backdrop name="lamp20" element="matrixlamp" state="0">
2632         <bounds x="32" y="8" width="7" height="7"/>
2633      </backdrop>
2634      <backdrop name="lamp21" element="matrixlamp" state="0">
2635         <bounds x="40" y="8" width="7" height="7"/>
2636      </backdrop>
2637      <backdrop name="lamp22" element="matrixlamp" state="0">
2638         <bounds x="48" y="8" width="7" height="7"/>
2639      </backdrop>
2640      <backdrop name="lamp23" element="matrixlamp" state="0">
2641         <bounds x="56" y="8" width="7" height="7"/>
2642      </backdrop>
2643      <backdrop name="lamp24" element="matrixlamp" state="0">
2644         <bounds x="64" y="8" width="7" height="7"/>
2645      </backdrop>
2646      <backdrop name="lamp25" element="matrixlamp" state="0">
2647         <bounds x="72" y="8" width="7" height="7"/>
2648      </backdrop>
2649      <backdrop name="lamp26" element="matrixlamp" state="0">
2650         <bounds x="80" y="8" width="7" height="7"/>
2651      </backdrop>
2652      <backdrop name="lamp27" element="matrixlamp" state="0">
2653         <bounds x="88" y="8" width="7" height="7"/>
2654      </backdrop>
2655      <backdrop name="lamp28" element="matrixlamp" state="0">
2656         <bounds x="96" y="8" width="7" height="7"/>
2657      </backdrop>
2658      <backdrop name="lamp29" element="matrixlamp" state="0">
2659         <bounds x="104" y="8" width="7" height="7"/>
2660      </backdrop>
2661      <backdrop name="lamp30" element="matrixlamp" state="0">
2662         <bounds x="112" y="8" width="7" height="7"/>
2663      </backdrop>
2664      <backdrop name="lamp31" element="matrixlamp" state="0">
2665         <bounds x="120" y="8" width="7" height="7"/>
2666      </backdrop>
2667      <backdrop name="lamp32" element="matrixlamp" state="0">
2668         <bounds x="0" y="16" width="7" height="7"/>
2669      </backdrop>
2670      <backdrop name="lamp33" element="matrixlamp" state="0">
2671         <bounds x="8" y="16" width="7" height="7"/>
2672      </backdrop>
2673      <backdrop name="lamp34" element="matrixlamp" state="0">
2674         <bounds x="16" y="16" width="7" height="7"/>
2675      </backdrop>
2676      <backdrop name="lamp35" element="matrixlamp" state="0">
2677         <bounds x="24" y="16" width="7" height="7"/>
2678      </backdrop>
2679      <backdrop name="lamp36" element="matrixlamp" state="0">
2680         <bounds x="32" y="16" width="7" height="7"/>
2681      </backdrop>
2682      <backdrop name="lamp37" element="matrixlamp" state="0">
2683         <bounds x="40" y="16" width="7" height="7"/>
2684      </backdrop>
2685      <backdrop name="lamp38" element="matrixlamp" state="0">
2686         <bounds x="48" y="16" width="7" height="7"/>
2687      </backdrop>
2688      <backdrop name="lamp39" element="matrixlamp" state="0">
2689         <bounds x="56" y="16" width="7" height="7"/>
2690      </backdrop>
2691      <backdrop name="lamp40" element="matrixlamp" state="0">
2692         <bounds x="64" y="16" width="7" height="7"/>
2693      </backdrop>
2694      <backdrop name="lamp41" element="matrixlamp" state="0">
2695         <bounds x="72" y="16" width="7" height="7"/>
2696      </backdrop>
2697      <backdrop name="lamp42" element="matrixlamp" state="0">
2698         <bounds x="80" y="16" width="7" height="7"/>
2699      </backdrop>
2700      <backdrop name="lamp43" element="matrixlamp" state="0">
2701         <bounds x="88" y="16" width="7" height="7"/>
2702      </backdrop>
2703      <backdrop name="lamp44" element="matrixlamp" state="0">
2704         <bounds x="96" y="16" width="7" height="7"/>
2705      </backdrop>
2706      <backdrop name="lamp45" element="matrixlamp" state="0">
2707         <bounds x="104" y="16" width="7" height="7"/>
2708      </backdrop>
2709      <backdrop name="lamp46" element="matrixlamp" state="0">
2710         <bounds x="112" y="16" width="7" height="7"/>
2711      </backdrop>
2712      <backdrop name="lamp47" element="matrixlamp" state="0">
2713         <bounds x="120" y="16" width="7" height="7"/>
2714      </backdrop>
2715      <backdrop name="lamp48" element="matrixlamp" state="0">
2716         <bounds x="0" y="24" width="7" height="7"/>
2717      </backdrop>
2718      <backdrop name="lamp49" element="matrixlamp" state="0">
2719         <bounds x="8" y="24" width="7" height="7"/>
2720      </backdrop>
2721      <backdrop name="lamp50" element="matrixlamp" state="0">
2722         <bounds x="16" y="24" width="7" height="7"/>
2723      </backdrop>
2724      <backdrop name="lamp51" element="matrixlamp" state="0">
2725         <bounds x="24" y="24" width="7" height="7"/>
2726      </backdrop>
2727      <backdrop name="lamp52" element="matrixlamp" state="0">
2728         <bounds x="32" y="24" width="7" height="7"/>
2729      </backdrop>
2730      <backdrop name="lamp53" element="matrixlamp" state="0">
2731         <bounds x="40" y="24" width="7" height="7"/>
2732      </backdrop>
2733      <backdrop name="lamp54" element="matrixlamp" state="0">
2734         <bounds x="48" y="24" width="7" height="7"/>
2735      </backdrop>
2736      <backdrop name="lamp55" element="matrixlamp" state="0">
2737         <bounds x="56" y="24" width="7" height="7"/>
2738      </backdrop>
2739      <backdrop name="lamp56" element="matrixlamp" state="0">
2740         <bounds x="64" y="24" width="7" height="7"/>
2741      </backdrop>
2742      <backdrop name="lamp57" element="matrixlamp" state="0">
2743         <bounds x="72" y="24" width="7" height="7"/>
2744      </backdrop>
2745      <backdrop name="lamp58" element="matrixlamp" state="0">
2746         <bounds x="80" y="24" width="7" height="7"/>
2747      </backdrop>
2748      <backdrop name="lamp59" element="matrixlamp" state="0">
2749         <bounds x="88" y="24" width="7" height="7"/>
2750      </backdrop>
2751      <backdrop name="lamp60" element="matrixlamp" state="0">
2752         <bounds x="96" y="24" width="7" height="7"/>
2753      </backdrop>
2754      <backdrop name="lamp61" element="matrixlamp" state="0">
2755         <bounds x="104" y="24" width="7" height="7"/>
2756      </backdrop>
2757      <backdrop name="lamp62" element="matrixlamp" state="0">
2758         <bounds x="112" y="24" width="7" height="7"/>
2759      </backdrop>
2760      <backdrop name="lamp63" element="matrixlamp" state="0">
2761         <bounds x="120" y="24" width="7" height="7"/>
2762      </backdrop>
2763      <backdrop name="lamp64" element="matrixlamp" state="0">
2764         <bounds x="0" y="32" width="7" height="7"/>
2765      </backdrop>
2766      <backdrop name="lamp65" element="matrixlamp" state="0">
2767         <bounds x="8" y="32" width="7" height="7"/>
2768      </backdrop>
2769      <backdrop name="lamp66" element="matrixlamp" state="0">
2770         <bounds x="16" y="32" width="7" height="7"/>
2771      </backdrop>
2772      <backdrop name="lamp67" element="matrixlamp" state="0">
2773         <bounds x="24" y="32" width="7" height="7"/>
2774      </backdrop>
2775      <backdrop name="lamp68" element="matrixlamp" state="0">
2776         <bounds x="32" y="32" width="7" height="7"/>
2777      </backdrop>
2778      <backdrop name="lamp69" element="matrixlamp" state="0">
2779         <bounds x="40" y="32" width="7" height="7"/>
2780      </backdrop>
2781      <backdrop name="lamp70" element="matrixlamp" state="0">
2782         <bounds x="48" y="32" width="7" height="7"/>
2783      </backdrop>
2784      <backdrop name="lamp71" element="matrixlamp" state="0">
2785         <bounds x="56" y="32" width="7" height="7"/>
2786      </backdrop>
2787      <backdrop name="lamp72" element="matrixlamp" state="0">
2788         <bounds x="64" y="32" width="7" height="7"/>
2789      </backdrop>
2790      <backdrop name="lamp73" element="matrixlamp" state="0">
2791         <bounds x="72" y="32" width="7" height="7"/>
2792      </backdrop>
2793      <backdrop name="lamp74" element="matrixlamp" state="0">
2794         <bounds x="80" y="32" width="7" height="7"/>
2795      </backdrop>
2796      <backdrop name="lamp75" element="matrixlamp" state="0">
2797         <bounds x="88" y="32" width="7" height="7"/>
2798      </backdrop>
2799      <backdrop name="lamp76" element="matrixlamp" state="0">
2800         <bounds x="96" y="32" width="7" height="7"/>
2801      </backdrop>
2802      <backdrop name="lamp77" element="matrixlamp" state="0">
2803         <bounds x="104" y="32" width="7" height="7"/>
2804      </backdrop>
2805      <backdrop name="lamp78" element="matrixlamp" state="0">
2806         <bounds x="112" y="32" width="7" height="7"/>
2807      </backdrop>
2808      <backdrop name="lamp79" element="matrixlamp" state="0">
2809         <bounds x="120" y="32" width="7" height="7"/>
2810      </backdrop>
2811      <backdrop name="lamp80" element="matrixlamp" state="0">
2812         <bounds x="0" y="40" width="7" height="7"/>
2813      </backdrop>
2814      <backdrop name="lamp81" element="matrixlamp" state="0">
2815         <bounds x="8" y="40" width="7" height="7"/>
2816      </backdrop>
2817      <backdrop name="lamp82" element="matrixlamp" state="0">
2818         <bounds x="16" y="40" width="7" height="7"/>
2819      </backdrop>
2820      <backdrop name="lamp83" element="matrixlamp" state="0">
2821         <bounds x="24" y="40" width="7" height="7"/>
2822      </backdrop>
2823      <backdrop name="lamp84" element="matrixlamp" state="0">
2824         <bounds x="32" y="40" width="7" height="7"/>
2825      </backdrop>
2826      <backdrop name="lamp85" element="matrixlamp" state="0">
2827         <bounds x="40" y="40" width="7" height="7"/>
2828      </backdrop>
2829      <backdrop name="lamp86" element="matrixlamp" state="0">
2830         <bounds x="48" y="40" width="7" height="7"/>
2831      </backdrop>
2832      <backdrop name="lamp87" element="matrixlamp" state="0">
2833         <bounds x="56" y="40" width="7" height="7"/>
2834      </backdrop>
2835      <backdrop name="lamp88" element="matrixlamp" state="0">
2836         <bounds x="64" y="40" width="7" height="7"/>
2837      </backdrop>
2838      <backdrop name="lamp89" element="matrixlamp" state="0">
2839         <bounds x="72" y="40" width="7" height="7"/>
2840      </backdrop>
2841      <backdrop name="lamp90" element="matrixlamp" state="0">
2842         <bounds x="80" y="40" width="7" height="7"/>
2843      </backdrop>
2844      <backdrop name="lamp91" element="matrixlamp" state="0">
2845         <bounds x="88" y="40" width="7" height="7"/>
2846      </backdrop>
2847      <backdrop name="lamp92" element="matrixlamp" state="0">
2848         <bounds x="96" y="40" width="7" height="7"/>
2849      </backdrop>
2850      <backdrop name="lamp93" element="matrixlamp" state="0">
2851         <bounds x="104" y="40" width="7" height="7"/>
2852      </backdrop>
2853      <backdrop name="lamp94" element="matrixlamp" state="0">
2854         <bounds x="112" y="40" width="7" height="7"/>
2855      </backdrop>
2856      <backdrop name="lamp95" element="matrixlamp" state="0">
2857         <bounds x="120" y="40" width="7" height="7"/>
2858      </backdrop>
2859      <backdrop name="lamp96" element="matrixlamp" state="0">
2860         <bounds x="0" y="48" width="7" height="7"/>
2861      </backdrop>
2862      <backdrop name="lamp97" element="matrixlamp" state="0">
2863         <bounds x="8" y="48" width="7" height="7"/>
2864      </backdrop>
2865      <backdrop name="lamp98" element="matrixlamp" state="0">
2866         <bounds x="16" y="48" width="7" height="7"/>
2867      </backdrop>
2868      <backdrop name="lamp99" element="matrixlamp" state="0">
2869         <bounds x="24" y="48" width="7" height="7"/>
2870      </backdrop>
2871      <backdrop name="lamp100" element="matrixlamp" state="0">
2872         <bounds x="32" y="48" width="7" height="7"/>
2873      </backdrop>
2874      <backdrop name="lamp101" element="matrixlamp" state="0">
2875         <bounds x="40" y="48" width="7" height="7"/>
2876      </backdrop>
2877      <backdrop name="lamp102" element="matrixlamp" state="0">
2878         <bounds x="48" y="48" width="7" height="7"/>
2879      </backdrop>
2880      <backdrop name="lamp103" element="matrixlamp" state="0">
2881         <bounds x="56" y="48" width="7" height="7"/>
2882      </backdrop>
2883      <backdrop name="lamp104" element="matrixlamp" state="0">
2884         <bounds x="64" y="48" width="7" height="7"/>
2885      </backdrop>
2886      <backdrop name="lamp105" element="matrixlamp" state="0">
2887         <bounds x="72" y="48" width="7" height="7"/>
2888      </backdrop>
2889      <backdrop name="lamp106" element="matrixlamp" state="0">
2890         <bounds x="80" y="48" width="7" height="7"/>
2891      </backdrop>
2892      <backdrop name="lamp107" element="matrixlamp" state="0">
2893         <bounds x="88" y="48" width="7" height="7"/>
2894      </backdrop>
2895      <backdrop name="lamp108" element="matrixlamp" state="0">
2896         <bounds x="96" y="48" width="7" height="7"/>
2897      </backdrop>
2898      <backdrop name="lamp109" element="matrixlamp" state="0">
2899         <bounds x="104" y="48" width="7" height="7"/>
2900      </backdrop>
2901      <backdrop name="lamp110" element="matrixlamp" state="0">
2902         <bounds x="112" y="48" width="7" height="7"/>
2903      </backdrop>
2904      <backdrop name="lamp111" element="matrixlamp" state="0">
2905         <bounds x="120" y="48" width="7" height="7"/>
2906      </backdrop>
2907      <backdrop name="lamp112" element="matrixlamp" state="0">
2908         <bounds x="0" y="56" width="7" height="7"/>
2909      </backdrop>
2910      <backdrop name="lamp113" element="matrixlamp" state="0">
2911         <bounds x="8" y="56" width="7" height="7"/>
2912      </backdrop>
2913      <backdrop name="lamp114" element="matrixlamp" state="0">
2914         <bounds x="16" y="56" width="7" height="7"/>
2915      </backdrop>
2916      <backdrop name="lamp115" element="matrixlamp" state="0">
2917         <bounds x="24" y="56" width="7" height="7"/>
2918      </backdrop>
2919      <backdrop name="lamp116" element="matrixlamp" state="0">
2920         <bounds x="32" y="56" width="7" height="7"/>
2921      </backdrop>
2922      <backdrop name="lamp117" element="matrixlamp" state="0">
2923         <bounds x="40" y="56" width="7" height="7"/>
2924      </backdrop>
2925      <backdrop name="lamp118" element="matrixlamp" state="0">
2926         <bounds x="48" y="56" width="7" height="7"/>
2927      </backdrop>
2928      <backdrop name="lamp119" element="matrixlamp" state="0">
2929         <bounds x="56" y="56" width="7" height="7"/>
2930      </backdrop>
2931      <backdrop name="lamp120" element="matrixlamp" state="0">
2932         <bounds x="64" y="56" width="7" height="7"/>
2933      </backdrop>
2934      <backdrop name="lamp121" element="matrixlamp" state="0">
2935         <bounds x="72" y="56" width="7" height="7"/>
2936      </backdrop>
2937      <backdrop name="lamp122" element="matrixlamp" state="0">
2938         <bounds x="80" y="56" width="7" height="7"/>
2939      </backdrop>
2940      <backdrop name="lamp123" element="matrixlamp" state="0">
2941         <bounds x="88" y="56" width="7" height="7"/>
2942      </backdrop>
2943      <backdrop name="lamp124" element="matrixlamp" state="0">
2944         <bounds x="96" y="56" width="7" height="7"/>
2945      </backdrop>
2946      <backdrop name="lamp125" element="matrixlamp" state="0">
2947         <bounds x="104" y="56" width="7" height="7"/>
2948      </backdrop>
2949      <backdrop name="lamp126" element="matrixlamp" state="0">
2950         <bounds x="112" y="56" width="7" height="7"/>
2951      </backdrop>
2952      <backdrop name="lamp127" element="matrixlamp" state="0">
2953         <bounds x="120" y="56" width="7" height="7"/>
2954      </backdrop>
2955      <backdrop name="lamp128" element="matrixlamp" state="0">
2956         <bounds x="0" y="64" width="7" height="7"/>
2957      </backdrop>
2958      <backdrop name="lamp129" element="matrixlamp" state="0">
2959         <bounds x="8" y="64" width="7" height="7"/>
2960      </backdrop>
2961      <backdrop name="lamp130" element="matrixlamp" state="0">
2962         <bounds x="16" y="64" width="7" height="7"/>
2963      </backdrop>
2964      <backdrop name="lamp131" element="matrixlamp" state="0">
2965         <bounds x="24" y="64" width="7" height="7"/>
2966      </backdrop>
2967      <backdrop name="lamp132" element="matrixlamp" state="0">
2968         <bounds x="32" y="64" width="7" height="7"/>
2969      </backdrop>
2970      <backdrop name="lamp133" element="matrixlamp" state="0">
2971         <bounds x="40" y="64" width="7" height="7"/>
2972      </backdrop>
2973      <backdrop name="lamp134" element="matrixlamp" state="0">
2974         <bounds x="48" y="64" width="7" height="7"/>
2975      </backdrop>
2976      <backdrop name="lamp135" element="matrixlamp" state="0">
2977         <bounds x="56" y="64" width="7" height="7"/>
2978      </backdrop>
2979      <backdrop name="lamp136" element="matrixlamp" state="0">
2980         <bounds x="64" y="64" width="7" height="7"/>
2981      </backdrop>
2982      <backdrop name="lamp137" element="matrixlamp" state="0">
2983         <bounds x="72" y="64" width="7" height="7"/>
2984      </backdrop>
2985      <backdrop name="lamp138" element="matrixlamp" state="0">
2986         <bounds x="80" y="64" width="7" height="7"/>
2987      </backdrop>
2988      <backdrop name="lamp139" element="matrixlamp" state="0">
2989         <bounds x="88" y="64" width="7" height="7"/>
2990      </backdrop>
2991      <backdrop name="lamp140" element="matrixlamp" state="0">
2992         <bounds x="96" y="64" width="7" height="7"/>
2993      </backdrop>
2994      <backdrop name="lamp141" element="matrixlamp" state="0">
2995         <bounds x="104" y="64" width="7" height="7"/>
2996      </backdrop>
2997      <backdrop name="lamp142" element="matrixlamp" state="0">
2998         <bounds x="112" y="64" width="7" height="7"/>
2999      </backdrop>
3000      <backdrop name="lamp143" element="matrixlamp" state="0">
3001         <bounds x="120" y="64" width="7" height="7"/>
3002      </backdrop>
3003      <backdrop name="lamp144" element="matrixlamp" state="0">
3004         <bounds x="0" y="72" width="7" height="7"/>
3005      </backdrop>
3006      <backdrop name="lamp145" element="matrixlamp" state="0">
3007         <bounds x="8" y="72" width="7" height="7"/>
3008      </backdrop>
3009      <backdrop name="lamp146" element="matrixlamp" state="0">
3010         <bounds x="16" y="72" width="7" height="7"/>
3011      </backdrop>
3012      <backdrop name="lamp147" element="matrixlamp" state="0">
3013         <bounds x="24" y="72" width="7" height="7"/>
3014      </backdrop>
3015      <backdrop name="lamp148" element="matrixlamp" state="0">
3016         <bounds x="32" y="72" width="7" height="7"/>
3017      </backdrop>
3018      <backdrop name="lamp149" element="matrixlamp" state="0">
3019         <bounds x="40" y="72" width="7" height="7"/>
3020      </backdrop>
3021      <backdrop name="lamp150" element="matrixlamp" state="0">
3022         <bounds x="48" y="72" width="7" height="7"/>
3023      </backdrop>
3024      <backdrop name="lamp151" element="matrixlamp" state="0">
3025         <bounds x="56" y="72" width="7" height="7"/>
3026      </backdrop>
3027      <backdrop name="lamp152" element="matrixlamp" state="0">
3028         <bounds x="64" y="72" width="7" height="7"/>
3029      </backdrop>
3030      <backdrop name="lamp153" element="matrixlamp" state="0">
3031         <bounds x="72" y="72" width="7" height="7"/>
3032      </backdrop>
3033      <backdrop name="lamp154" element="matrixlamp" state="0">
3034         <bounds x="80" y="72" width="7" height="7"/>
3035      </backdrop>
3036      <backdrop name="lamp155" element="matrixlamp" state="0">
3037         <bounds x="88" y="72" width="7" height="7"/>
3038      </backdrop>
3039      <backdrop name="lamp156" element="matrixlamp" state="0">
3040         <bounds x="96" y="72" width="7" height="7"/>
3041      </backdrop>
3042      <backdrop name="lamp157" element="matrixlamp" state="0">
3043         <bounds x="104" y="72" width="7" height="7"/>
3044      </backdrop>
3045      <backdrop name="lamp158" element="matrixlamp" state="0">
3046         <bounds x="112" y="72" width="7" height="7"/>
3047      </backdrop>
3048      <backdrop name="lamp159" element="matrixlamp" state="0">
3049         <bounds x="120" y="72" width="7" height="7"/>
3050      </backdrop>
3051      <backdrop name="lamp160" element="matrixlamp" state="0">
3052         <bounds x="0" y="80" width="7" height="7"/>
3053      </backdrop>
3054      <backdrop name="lamp161" element="matrixlamp" state="0">
3055         <bounds x="8" y="80" width="7" height="7"/>
3056      </backdrop>
3057      <backdrop name="lamp162" element="matrixlamp" state="0">
3058         <bounds x="16" y="80" width="7" height="7"/>
3059      </backdrop>
3060      <backdrop name="lamp163" element="matrixlamp" state="0">
3061         <bounds x="24" y="80" width="7" height="7"/>
3062      </backdrop>
3063      <backdrop name="lamp164" element="matrixlamp" state="0">
3064         <bounds x="32" y="80" width="7" height="7"/>
3065      </backdrop>
3066      <backdrop name="lamp165" element="matrixlamp" state="0">
3067         <bounds x="40" y="80" width="7" height="7"/>
3068      </backdrop>
3069      <backdrop name="lamp166" element="matrixlamp" state="0">
3070         <bounds x="48" y="80" width="7" height="7"/>
3071      </backdrop>
3072      <backdrop name="lamp167" element="matrixlamp" state="0">
3073         <bounds x="56" y="80" width="7" height="7"/>
3074      </backdrop>
3075      <backdrop name="lamp168" element="matrixlamp" state="0">
3076         <bounds x="64" y="80" width="7" height="7"/>
3077      </backdrop>
3078      <backdrop name="lamp169" element="matrixlamp" state="0">
3079         <bounds x="72" y="80" width="7" height="7"/>
3080      </backdrop>
3081      <backdrop name="lamp170" element="matrixlamp" state="0">
3082         <bounds x="80" y="80" width="7" height="7"/>
3083      </backdrop>
3084      <backdrop name="lamp171" element="matrixlamp" state="0">
3085         <bounds x="88" y="80" width="7" height="7"/>
3086      </backdrop>
3087      <backdrop name="lamp172" element="matrixlamp" state="0">
3088         <bounds x="96" y="80" width="7" height="7"/>
3089      </backdrop>
3090      <backdrop name="lamp173" element="matrixlamp" state="0">
3091         <bounds x="104" y="80" width="7" height="7"/>
3092      </backdrop>
3093      <backdrop name="lamp174" element="matrixlamp" state="0">
3094         <bounds x="112" y="80" width="7" height="7"/>
3095      </backdrop>
3096      <backdrop name="lamp175" element="matrixlamp" state="0">
3097         <bounds x="120" y="80" width="7" height="7"/>
3098      </backdrop>
3099      <backdrop name="lamp176" element="matrixlamp" state="0">
3100         <bounds x="0" y="88" width="7" height="7"/>
3101      </backdrop>
3102      <backdrop name="lamp177" element="matrixlamp" state="0">
3103         <bounds x="8" y="88" width="7" height="7"/>
3104      </backdrop>
3105      <backdrop name="lamp178" element="matrixlamp" state="0">
3106         <bounds x="16" y="88" width="7" height="7"/>
3107      </backdrop>
3108      <backdrop name="lamp179" element="matrixlamp" state="0">
3109         <bounds x="24" y="88" width="7" height="7"/>
3110      </backdrop>
3111      <backdrop name="lamp180" element="matrixlamp" state="0">
3112         <bounds x="32" y="88" width="7" height="7"/>
3113      </backdrop>
3114      <backdrop name="lamp181" element="matrixlamp" state="0">
3115         <bounds x="40" y="88" width="7" height="7"/>
3116      </backdrop>
3117      <backdrop name="lamp182" element="matrixlamp" state="0">
3118         <bounds x="48" y="88" width="7" height="7"/>
3119      </backdrop>
3120      <backdrop name="lamp183" element="matrixlamp" state="0">
3121         <bounds x="56" y="88" width="7" height="7"/>
3122      </backdrop>
3123      <backdrop name="lamp184" element="matrixlamp" state="0">
3124         <bounds x="64" y="88" width="7" height="7"/>
3125      </backdrop>
3126      <backdrop name="lamp185" element="matrixlamp" state="0">
3127         <bounds x="72" y="88" width="7" height="7"/>
3128      </backdrop>
3129      <backdrop name="lamp186" element="matrixlamp" state="0">
3130         <bounds x="80" y="88" width="7" height="7"/>
3131      </backdrop>
3132      <backdrop name="lamp187" element="matrixlamp" state="0">
3133         <bounds x="88" y="88" width="7" height="7"/>
3134      </backdrop>
3135      <backdrop name="lamp188" element="matrixlamp" state="0">
3136         <bounds x="96" y="88" width="7" height="7"/>
3137      </backdrop>
3138      <backdrop name="lamp189" element="matrixlamp" state="0">
3139         <bounds x="104" y="88" width="7" height="7"/>
3140      </backdrop>
3141      <backdrop name="lamp190" element="matrixlamp" state="0">
3142         <bounds x="112" y="88" width="7" height="7"/>
3143      </backdrop>
3144      <backdrop name="lamp191" element="matrixlamp" state="0">
3145         <bounds x="120" y="88" width="7" height="7"/>
3146      </backdrop>
3147      <backdrop name="lamp192" element="matrixlamp" state="0">
3148         <bounds x="0" y="96" width="7" height="7"/>
3149      </backdrop>
3150      <backdrop name="lamp193" element="matrixlamp" state="0">
3151         <bounds x="8" y="96" width="7" height="7"/>
3152      </backdrop>
3153      <backdrop name="lamp194" element="matrixlamp" state="0">
3154         <bounds x="16" y="96" width="7" height="7"/>
3155      </backdrop>
3156      <backdrop name="lamp195" element="matrixlamp" state="0">
3157         <bounds x="24" y="96" width="7" height="7"/>
3158      </backdrop>
3159      <backdrop name="lamp196" element="matrixlamp" state="0">
3160         <bounds x="32" y="96" width="7" height="7"/>
3161      </backdrop>
3162      <backdrop name="lamp197" element="matrixlamp" state="0">
3163         <bounds x="40" y="96" width="7" height="7"/>
3164      </backdrop>
3165      <backdrop name="lamp198" element="matrixlamp" state="0">
3166         <bounds x="48" y="96" width="7" height="7"/>
3167      </backdrop>
3168      <backdrop name="lamp199" element="matrixlamp" state="0">
3169         <bounds x="56" y="96" width="7" height="7"/>
3170      </backdrop>
3171      <backdrop name="lamp200" element="matrixlamp" state="0">
3172         <bounds x="64" y="96" width="7" height="7"/>
3173      </backdrop>
3174      <backdrop name="lamp201" element="matrixlamp" state="0">
3175         <bounds x="72" y="96" width="7" height="7"/>
3176      </backdrop>
3177      <backdrop name="lamp202" element="matrixlamp" state="0">
3178         <bounds x="80" y="96" width="7" height="7"/>
3179      </backdrop>
3180      <backdrop name="lamp203" element="matrixlamp" state="0">
3181         <bounds x="88" y="96" width="7" height="7"/>
3182      </backdrop>
3183      <backdrop name="lamp204" element="matrixlamp" state="0">
3184         <bounds x="96" y="96" width="7" height="7"/>
3185      </backdrop>
3186      <backdrop name="lamp205" element="matrixlamp" state="0">
3187         <bounds x="104" y="96" width="7" height="7"/>
3188      </backdrop>
3189      <backdrop name="lamp206" element="matrixlamp" state="0">
3190         <bounds x="112" y="96" width="7" height="7"/>
3191      </backdrop>
3192      <backdrop name="lamp207" element="matrixlamp" state="0">
3193         <bounds x="120" y="96" width="7" height="7"/>
3194      </backdrop>
3195      <backdrop name="lamp208" element="matrixlamp" state="0">
3196         <bounds x="0" y="104" width="7" height="7"/>
3197      </backdrop>
3198      <backdrop name="lamp209" element="matrixlamp" state="0">
3199         <bounds x="8" y="104" width="7" height="7"/>
3200      </backdrop>
3201      <backdrop name="lamp210" element="matrixlamp" state="0">
3202         <bounds x="16" y="104" width="7" height="7"/>
3203      </backdrop>
3204      <backdrop name="lamp211" element="matrixlamp" state="0">
3205         <bounds x="24" y="104" width="7" height="7"/>
3206      </backdrop>
3207      <backdrop name="lamp212" element="matrixlamp" state="0">
3208         <bounds x="32" y="104" width="7" height="7"/>
3209      </backdrop>
3210      <backdrop name="lamp213" element="matrixlamp" state="0">
3211         <bounds x="40" y="104" width="7" height="7"/>
3212      </backdrop>
3213      <backdrop name="lamp214" element="matrixlamp" state="0">
3214         <bounds x="48" y="104" width="7" height="7"/>
3215      </backdrop>
3216      <backdrop name="lamp215" element="matrixlamp" state="0">
3217         <bounds x="56" y="104" width="7" height="7"/>
3218      </backdrop>
3219      <backdrop name="lamp216" element="matrixlamp" state="0">
3220         <bounds x="64" y="104" width="7" height="7"/>
3221      </backdrop>
3222      <backdrop name="lamp217" element="matrixlamp" state="0">
3223         <bounds x="72" y="104" width="7" height="7"/>
3224      </backdrop>
3225      <backdrop name="lamp218" element="matrixlamp" state="0">
3226         <bounds x="80" y="104" width="7" height="7"/>
3227      </backdrop>
3228      <backdrop name="lamp219" element="matrixlamp" state="0">
3229         <bounds x="88" y="104" width="7" height="7"/>
3230      </backdrop>
3231      <backdrop name="lamp220" element="matrixlamp" state="0">
3232         <bounds x="96" y="104" width="7" height="7"/>
3233      </backdrop>
3234      <backdrop name="lamp221" element="matrixlamp" state="0">
3235         <bounds x="104" y="104" width="7" height="7"/>
3236      </backdrop>
3237      <backdrop name="lamp222" element="matrixlamp" state="0">
3238         <bounds x="112" y="104" width="7" height="7"/>
3239      </backdrop>
3240      <backdrop name="lamp223" element="matrixlamp" state="0">
3241         <bounds x="120" y="104" width="7" height="7"/>
3242      </backdrop>
3243      <backdrop name="lamp224" element="matrixlamp" state="0">
3244         <bounds x="0" y="112" width="7" height="7"/>
3245      </backdrop>
3246      <backdrop name="lamp225" element="matrixlamp" state="0">
3247         <bounds x="8" y="112" width="7" height="7"/>
3248      </backdrop>
3249      <backdrop name="lamp226" element="matrixlamp" state="0">
3250         <bounds x="16" y="112" width="7" height="7"/>
3251      </backdrop>
3252      <backdrop name="lamp227" element="matrixlamp" state="0">
3253         <bounds x="24" y="112" width="7" height="7"/>
3254      </backdrop>
3255      <backdrop name="lamp228" element="matrixlamp" state="0">
3256         <bounds x="32" y="112" width="7" height="7"/>
3257      </backdrop>
3258      <backdrop name="lamp229" element="matrixlamp" state="0">
3259         <bounds x="40" y="112" width="7" height="7"/>
3260      </backdrop>
3261      <backdrop name="lamp230" element="matrixlamp" state="0">
3262         <bounds x="48" y="112" width="7" height="7"/>
3263      </backdrop>
3264      <backdrop name="lamp231" element="matrixlamp" state="0">
3265         <bounds x="56" y="112" width="7" height="7"/>
3266      </backdrop>
3267      <backdrop name="lamp232" element="matrixlamp" state="0">
3268         <bounds x="64" y="112" width="7" height="7"/>
3269      </backdrop>
3270      <backdrop name="lamp233" element="matrixlamp" state="0">
3271         <bounds x="72" y="112" width="7" height="7"/>
3272      </backdrop>
3273      <backdrop name="lamp234" element="matrixlamp" state="0">
3274         <bounds x="80" y="112" width="7" height="7"/>
3275      </backdrop>
3276      <backdrop name="lamp235" element="matrixlamp" state="0">
3277         <bounds x="88" y="112" width="7" height="7"/>
3278      </backdrop>
3279      <backdrop name="lamp236" element="matrixlamp" state="0">
3280         <bounds x="96" y="112" width="7" height="7"/>
3281      </backdrop>
3282      <backdrop name="lamp237" element="matrixlamp" state="0">
3283         <bounds x="104" y="112" width="7" height="7"/>
3284      </backdrop>
3285      <backdrop name="lamp238" element="matrixlamp" state="0">
3286         <bounds x="112" y="112" width="7" height="7"/>
3287      </backdrop>
3288      <backdrop name="lamp239" element="matrixlamp" state="0">
3289         <bounds x="120" y="112" width="7" height="7"/>
3290      </backdrop>
3291      <backdrop name="lamp240" element="matrixlamp" state="0">
3292         <bounds x="0" y="120" width="7" height="7"/>
3293      </backdrop>
3294      <backdrop name="lamp241" element="matrixlamp" state="0">
3295         <bounds x="8" y="120" width="7" height="7"/>
3296      </backdrop>
3297      <backdrop name="lamp242" element="matrixlamp" state="0">
3298         <bounds x="16" y="120" width="7" height="7"/>
3299      </backdrop>
3300      <backdrop name="lamp243" element="matrixlamp" state="0">
3301         <bounds x="24" y="120" width="7" height="7"/>
3302      </backdrop>
3303      <backdrop name="lamp244" element="matrixlamp" state="0">
3304         <bounds x="32" y="120" width="7" height="7"/>
3305      </backdrop>
3306      <backdrop name="lamp245" element="matrixlamp" state="0">
3307         <bounds x="40" y="120" width="7" height="7"/>
3308      </backdrop>
3309      <backdrop name="lamp246" element="matrixlamp" state="0">
3310         <bounds x="48" y="120" width="7" height="7"/>
3311      </backdrop>
3312      <backdrop name="lamp247" element="matrixlamp" state="0">
3313         <bounds x="56" y="120" width="7" height="7"/>
3314      </backdrop>
3315      <backdrop name="lamp248" element="matrixlamp" state="0">
3316         <bounds x="64" y="120" width="7" height="7"/>
3317      </backdrop>
3318      <backdrop name="lamp249" element="matrixlamp" state="0">
3319         <bounds x="72" y="120" width="7" height="7"/>
3320      </backdrop>
3321      <backdrop name="lamp250" element="matrixlamp" state="0">
3322         <bounds x="80" y="120" width="7" height="7"/>
3323      </backdrop>
3324      <backdrop name="lamp251" element="matrixlamp" state="0">
3325         <bounds x="88" y="120" width="7" height="7"/>
3326      </backdrop>
3327      <backdrop name="lamp252" element="matrixlamp" state="0">
3328         <bounds x="96" y="120" width="7" height="7"/>
3329      </backdrop>
3330      <backdrop name="lamp253" element="matrixlamp" state="0">
3331         <bounds x="104" y="120" width="7" height="7"/>
3332      </backdrop>
3333      <backdrop name="lamp254" element="matrixlamp" state="0">
3334         <bounds x="112" y="120" width="7" height="7"/>
3335      </backdrop>
3336      <backdrop name="lamp255" element="matrixlamp" state="0">
3337         <bounds x="120" y="120" width="7" height="7"/>
3338      </backdrop>
3339   </view>
3340
3341   <view name="AWP Simulated Video (No Artwork)">
3342      <backdrop name="vfd0" element="vfd0" state="0">
3343         <bounds x="10" y="280" width="9" height="17"/>
3344      </backdrop>
3345      <backdrop name="vfd1" element="vfd0" state="0">
3346         <bounds x="19" y="280" width="9" height="17"/>
3347      </backdrop>
3348      <backdrop name="vfd2" element="vfd0" state="0">
3349         <bounds x="28" y="280" width="9" height="17"/>
3350      </backdrop>
3351      <backdrop name="vfd3" element="vfd0" state="0">
3352         <bounds x="37" y="280" width="9" height="17"/>
3353      </backdrop>
3354      <backdrop name="vfd4" element="vfd0" state="0">
3355         <bounds x="46" y="280" width="9" height="17"/>
3356      </backdrop>
3357      <backdrop name="vfd5" element="vfd0" state="0">
3358         <bounds x="55" y="280" width="9" height="17"/>
3359      </backdrop>
3360      <backdrop name="vfd6" element="vfd0" state="0">
3361         <bounds x="64" y="280" width="9" height="17"/>
3362      </backdrop>
3363      <backdrop name="vfd7" element="vfd0" state="0">
3364         <bounds x="73" y="280" width="9" height="17"/>
3365      </backdrop>
3366      <backdrop name="vfd8" element="vfd0" state="0">
3367         <bounds x="82" y="280" width="9" height="17"/>
3368      </backdrop>
3369      <backdrop name="vfd9" element="vfd0" state="0">
3370         <bounds x="91" y="280" width="9" height="17"/>
3371      </backdrop>
3372      <backdrop name="vfd10" element="vfd0" state="0">
3373         <bounds x="100" y="280" width="9" height="17"/>
3374      </backdrop>
3375      <backdrop name="vfd11" element="vfd0" state="0">
3376         <bounds x="109" y="280" width="9" height="17"/>
3377      </backdrop>
3378      <backdrop name="vfd12" element="vfd0" state="0">
3379         <bounds x="118" y="280" width="9" height="17"/>
3380      </backdrop>
3381      <backdrop name="vfd13" element="vfd0" state="0">
3382         <bounds x="127" y="280" width="9" height="17"/>
3383      </backdrop>
3384      <backdrop name="vfd14" element="vfd0" state="0">
3385         <bounds x="136" y="280" width="9" height="17"/>
3386      </backdrop>
3387      <backdrop name="vfd15" element="vfd0" state="0">
3388         <bounds x="145" y="280" width="9" height="17"/>
3389      </backdrop>
3390      <backdrop name="reel1" element="Steppers" state="0">
3391         <bounds x="10" y="320" width="50" height="50"/>
3392      </backdrop>
3393      <backdrop name="reel2" element="Steppers" state="0">
3394         <bounds x="60" y="320" width="50" height="50"/>
3395      </backdrop>
3396      <backdrop name="reel3" element="Steppers" state="0">
3397         <bounds x="110" y="320" width="50" height="50"/>
3398      </backdrop>
3399      <backdrop name="reel4" element="Steppers" state="0">
3400         <bounds x="160" y="320" width="50" height="50"/>
3401      </backdrop>
3402      <backdrop name="reel5" element="Steppers" state="0">
3403         <bounds x="220" y="320" width="50" height="50"/>
3404      </backdrop>
3405      <backdrop name="reel6" element="Steppers" state="0">
3406         <bounds x="280" y="320" width="50" height="50"/>
3407      </backdrop>
3408      <backdrop name="lamp0" element="matrixlamp" state="0">
3409         <bounds x="0" y="0" width="7" height="7"/>
3410      </backdrop>
3411      <backdrop name="lamp1" element="matrixlamp" state="0">
3412         <bounds x="8" y="0" width="7" height="7"/>
3413      </backdrop>
3414      <backdrop name="lamp2" element="matrixlamp" state="0">
3415         <bounds x="16" y="0" width="7" height="7"/>
3416      </backdrop>
3417      <backdrop name="lamp3" element="matrixlamp" state="0">
3418         <bounds x="24" y="0" width="7" height="7"/>
3419      </backdrop>
3420      <backdrop name="lamp4" element="matrixlamp" state="0">
3421         <bounds x="32" y="0" width="7" height="7"/>
3422      </backdrop>
3423      <backdrop name="lamp5" element="matrixlamp" state="0">
3424         <bounds x="40" y="0" width="7" height="7"/>
3425      </backdrop>
3426      <backdrop name="lamp6" element="matrixlamp" state="0">
3427         <bounds x="48" y="0" width="7" height="7"/>
3428      </backdrop>
3429      <backdrop name="lamp7" element="matrixlamp" state="0">
3430         <bounds x="56" y="0" width="7" height="7"/>
3431      </backdrop>
3432      <backdrop name="lamp8" element="matrixlamp" state="0">
3433         <bounds x="64" y="0" width="7" height="7"/>
3434      </backdrop>
3435      <backdrop name="lamp9" element="matrixlamp" state="0">
3436         <bounds x="72" y="0" width="7" height="7"/>
3437      </backdrop>
3438      <backdrop name="lamp10" element="matrixlamp" state="0">
3439         <bounds x="80" y="0" width="7" height="7"/>
3440      </backdrop>
3441      <backdrop name="lamp11" element="matrixlamp" state="0">
3442         <bounds x="88" y="0" width="7" height="7"/>
3443      </backdrop>
3444      <backdrop name="lamp12" element="matrixlamp" state="0">
3445         <bounds x="96" y="0" width="7" height="7"/>
3446      </backdrop>
3447      <backdrop name="lamp13" element="matrixlamp" state="0">
3448         <bounds x="104" y="0" width="7" height="7"/>
3449      </backdrop>
3450      <backdrop name="lamp14" element="matrixlamp" state="0">
3451         <bounds x="112" y="0" width="7" height="7"/>
3452      </backdrop>
3453      <backdrop name="lamp15" element="matrixlamp" state="0">
3454         <bounds x="120" y="0" width="7" height="7"/>
3455      </backdrop>
3456      <backdrop name="lamp16" element="matrixlamp" state="0">
3457         <bounds x="0" y="8" width="7" height="7"/>
3458      </backdrop>
3459      <backdrop name="lamp17" element="matrixlamp" state="0">
3460         <bounds x="8" y="8" width="7" height="7"/>
3461      </backdrop>
3462      <backdrop name="lamp18" element="matrixlamp" state="0">
3463         <bounds x="16" y="8" width="7" height="7"/>
3464      </backdrop>
3465      <backdrop name="lamp19" element="matrixlamp" state="0">
3466         <bounds x="24" y="8" width="7" height="7"/>
3467      </backdrop>
3468      <backdrop name="lamp20" element="matrixlamp" state="0">
3469         <bounds x="32" y="8" width="7" height="7"/>
3470      </backdrop>
3471      <backdrop name="lamp21" element="matrixlamp" state="0">
3472         <bounds x="40" y="8" width="7" height="7"/>
3473      </backdrop>
3474      <backdrop name="lamp22" element="matrixlamp" state="0">
3475         <bounds x="48" y="8" width="7" height="7"/>
3476      </backdrop>
3477      <backdrop name="lamp23" element="matrixlamp" state="0">
3478         <bounds x="56" y="8" width="7" height="7"/>
3479      </backdrop>
3480      <backdrop name="lamp24" element="matrixlamp" state="0">
3481         <bounds x="64" y="8" width="7" height="7"/>
3482      </backdrop>
3483      <backdrop name="lamp25" element="matrixlamp" state="0">
3484         <bounds x="72" y="8" width="7" height="7"/>
3485      </backdrop>
3486      <backdrop name="lamp26" element="matrixlamp" state="0">
3487         <bounds x="80" y="8" width="7" height="7"/>
3488      </backdrop>
3489      <backdrop name="lamp27" element="matrixlamp" state="0">
3490         <bounds x="88" y="8" width="7" height="7"/>
3491      </backdrop>
3492      <backdrop name="lamp28" element="matrixlamp" state="0">
3493         <bounds x="96" y="8" width="7" height="7"/>
3494      </backdrop>
3495      <backdrop name="lamp29" element="matrixlamp" state="0">
3496         <bounds x="104" y="8" width="7" height="7"/>
3497      </backdrop>
3498      <backdrop name="lamp30" element="matrixlamp" state="0">
3499         <bounds x="112" y="8" width="7" height="7"/>
3500      </backdrop>
3501      <backdrop name="lamp31" element="matrixlamp" state="0">
3502         <bounds x="120" y="8" width="7" height="7"/>
3503      </backdrop>
3504      <backdrop name="lamp32" element="matrixlamp" state="0">
3505         <bounds x="0" y="16" width="7" height="7"/>
3506      </backdrop>
3507      <backdrop name="lamp33" element="matrixlamp" state="0">
3508         <bounds x="8" y="16" width="7" height="7"/>
3509      </backdrop>
3510      <backdrop name="lamp34" element="matrixlamp" state="0">
3511         <bounds x="16" y="16" width="7" height="7"/>
3512      </backdrop>
3513      <backdrop name="lamp35" element="matrixlamp" state="0">
3514         <bounds x="24" y="16" width="7" height="7"/>
3515      </backdrop>
3516      <backdrop name="lamp36" element="matrixlamp" state="0">
3517         <bounds x="32" y="16" width="7" height="7"/>
3518      </backdrop>
3519      <backdrop name="lamp37" element="matrixlamp" state="0">
3520         <bounds x="40" y="16" width="7" height="7"/>
3521      </backdrop>
3522      <backdrop name="lamp38" element="matrixlamp" state="0">
3523         <bounds x="48" y="16" width="7" height="7"/>
3524      </backdrop>
3525      <backdrop name="lamp39" element="matrixlamp" state="0">
3526         <bounds x="56" y="16" width="7" height="7"/>
3527      </backdrop>
3528      <backdrop name="lamp40" element="matrixlamp" state="0">
3529         <bounds x="64" y="16" width="7" height="7"/>
3530      </backdrop>
3531      <backdrop name="lamp41" element="matrixlamp" state="0">
3532         <bounds x="72" y="16" width="7" height="7"/>
3533      </backdrop>
3534      <backdrop name="lamp42" element="matrixlamp" state="0">
3535         <bounds x="80" y="16" width="7" height="7"/>
3536      </backdrop>
3537      <backdrop name="lamp43" element="matrixlamp" state="0">
3538         <bounds x="88" y="16" width="7" height="7"/>
3539      </backdrop>
3540      <backdrop name="lamp44" element="matrixlamp" state="0">
3541         <bounds x="96" y="16" width="7" height="7"/>
3542      </backdrop>
3543      <backdrop name="lamp45" element="matrixlamp" state="0">
3544         <bounds x="104" y="16" width="7" height="7"/>
3545      </backdrop>
3546      <backdrop name="lamp46" element="matrixlamp" state="0">
3547         <bounds x="112" y="16" width="7" height="7"/>
3548      </backdrop>
3549      <backdrop name="lamp47" element="matrixlamp" state="0">
3550         <bounds x="120" y="16" width="7" height="7"/>
3551      </backdrop>
3552      <backdrop name="lamp48" element="matrixlamp" state="0">
3553         <bounds x="0" y="24" width="7" height="7"/>
3554      </backdrop>
3555      <backdrop name="lamp49" element="matrixlamp" state="0">
3556         <bounds x="8" y="24" width="7" height="7"/>
3557      </backdrop>
3558      <backdrop name="lamp50" element="matrixlamp" state="0">
3559         <bounds x="16" y="24" width="7" height="7"/>
3560      </backdrop>
3561      <backdrop name="lamp51" element="matrixlamp" state="0">
3562         <bounds x="24" y="24" width="7" height="7"/>
3563      </backdrop>
3564      <backdrop name="lamp52" element="matrixlamp" state="0">
3565         <bounds x="32" y="24" width="7" height="7"/>
3566      </backdrop>
3567      <backdrop name="lamp53" element="matrixlamp" state="0">
3568         <bounds x="40" y="24" width="7" height="7"/>
3569      </backdrop>
3570      <backdrop name="lamp54" element="matrixlamp" state="0">
3571         <bounds x="48" y="24" width="7" height="7"/>
3572      </backdrop>
3573      <backdrop name="lamp55" element="matrixlamp" state="0">
3574         <bounds x="56" y="24" width="7" height="7"/>
3575      </backdrop>
3576      <backdrop name="lamp56" element="matrixlamp" state="0">
3577         <bounds x="64" y="24" width="7" height="7"/>
3578      </backdrop>
3579      <backdrop name="lamp57" element="matrixlamp" state="0">
3580         <bounds x="72" y="24" width="7" height="7"/>
3581      </backdrop>
3582      <backdrop name="lamp58" element="matrixlamp" state="0">
3583         <bounds x="80" y="24" width="7" height="7"/>
3584      </backdrop>
3585      <backdrop name="lamp59" element="matrixlamp" state="0">
3586         <bounds x="88" y="24" width="7" height="7"/>
3587      </backdrop>
3588      <backdrop name="lamp60" element="matrixlamp" state="0">
3589         <bounds x="96" y="24" width="7" height="7"/>
3590      </backdrop>
3591      <backdrop name="lamp61" element="matrixlamp" state="0">
3592         <bounds x="104" y="24" width="7" height="7"/>
3593      </backdrop>
3594      <backdrop name="lamp62" element="matrixlamp" state="0">
3595         <bounds x="112" y="24" width="7" height="7"/>
3596      </backdrop>
3597      <backdrop name="lamp63" element="matrixlamp" state="0">
3598         <bounds x="120" y="24" width="7" height="7"/>
3599      </backdrop>
3600      <backdrop name="lamp64" element="matrixlamp" state="0">
3601         <bounds x="0" y="32" width="7" height="7"/>
3602      </backdrop>
3603      <backdrop name="lamp65" element="matrixlamp" state="0">
3604         <bounds x="8" y="32" width="7" height="7"/>
3605      </backdrop>
3606      <backdrop name="lamp66" element="matrixlamp" state="0">
3607         <bounds x="16" y="32" width="7" height="7"/>
3608      </backdrop>
3609      <backdrop name="lamp67" element="matrixlamp" state="0">
3610         <bounds x="24" y="32" width="7" height="7"/>
3611      </backdrop>
3612      <backdrop name="lamp68" element="matrixlamp" state="0">
3613         <bounds x="32" y="32" width="7" height="7"/>
3614      </backdrop>
3615      <backdrop name="lamp69" element="matrixlamp" state="0">
3616         <bounds x="40" y="32" width="7" height="7"/>
3617      </backdrop>
3618      <backdrop name="lamp70" element="matrixlamp" state="0">
3619         <bounds x="48" y="32" width="7" height="7"/>
3620      </backdrop>
3621      <backdrop name="lamp71" element="matrixlamp" state="0">
3622         <bounds x="56" y="32" width="7" height="7"/>
3623      </backdrop>
3624      <backdrop name="lamp72" element="matrixlamp" state="0">
3625         <bounds x="64" y="32" width="7" height="7"/>
3626      </backdrop>
3627      <backdrop name="lamp73" element="matrixlamp" state="0">
3628         <bounds x="72" y="32" width="7" height="7"/>
3629      </backdrop>
3630      <backdrop name="lamp74" element="matrixlamp" state="0">
3631         <bounds x="80" y="32" width="7" height="7"/>
3632      </backdrop>
3633      <backdrop name="lamp75" element="matrixlamp" state="0">
3634         <bounds x="88" y="32" width="7" height="7"/>
3635      </backdrop>
3636      <backdrop name="lamp76" element="matrixlamp" state="0">
3637         <bounds x="96" y="32" width="7" height="7"/>
3638      </backdrop>
3639      <backdrop name="lamp77" element="matrixlamp" state="0">
3640         <bounds x="104" y="32" width="7" height="7"/>
3641      </backdrop>
3642      <backdrop name="lamp78" element="matrixlamp" state="0">
3643         <bounds x="112" y="32" width="7" height="7"/>
3644      </backdrop>
3645      <backdrop name="lamp79" element="matrixlamp" state="0">
3646         <bounds x="120" y="32" width="7" height="7"/>
3647      </backdrop>
3648      <backdrop name="lamp80" element="matrixlamp" state="0">
3649         <bounds x="0" y="40" width="7" height="7"/>
3650      </backdrop>
3651      <backdrop name="lamp81" element="matrixlamp" state="0">
3652         <bounds x="8" y="40" width="7" height="7"/>
3653      </backdrop>
3654      <backdrop name="lamp82" element="matrixlamp" state="0">
3655         <bounds x="16" y="40" width="7" height="7"/>
3656      </backdrop>
3657      <backdrop name="lamp83" element="matrixlamp" state="0">
3658         <bounds x="24" y="40" width="7" height="7"/>
3659      </backdrop>
3660      <backdrop name="lamp84" element="matrixlamp" state="0">
3661         <bounds x="32" y="40" width="7" height="7"/>
3662      </backdrop>
3663      <backdrop name="lamp85" element="matrixlamp" state="0">
3664         <bounds x="40" y="40" width="7" height="7"/>
3665      </backdrop>
3666      <backdrop name="lamp86" element="matrixlamp" state="0">
3667         <bounds x="48" y="40" width="7" height="7"/>
3668      </backdrop>
3669      <backdrop name="lamp87" element="matrixlamp" state="0">
3670         <bounds x="56" y="40" width="7" height="7"/>
3671      </backdrop>
3672      <backdrop name="lamp88" element="matrixlamp" state="0">
3673         <bounds x="64" y="40" width="7" height="7"/>
3674      </backdrop>
3675      <backdrop name="lamp89" element="matrixlamp" state="0">
3676         <bounds x="72" y="40" width="7" height="7"/>
3677      </backdrop>
3678      <backdrop name="lamp90" element="matrixlamp" state="0">
3679         <bounds x="80" y="40" width="7" height="7"/>
3680      </backdrop>
3681      <backdrop name="lamp91" element="matrixlamp" state="0">
3682         <bounds x="88" y="40" width="7" height="7"/>
3683      </backdrop>
3684      <backdrop name="lamp92" element="matrixlamp" state="0">
3685         <bounds x="96" y="40" width="7" height="7"/>
3686      </backdrop>
3687      <backdrop name="lamp93" element="matrixlamp" state="0">
3688         <bounds x="104" y="40" width="7" height="7"/>
3689      </backdrop>
3690      <backdrop name="lamp94" element="matrixlamp" state="0">
3691         <bounds x="112" y="40" width="7" height="7"/>
3692      </backdrop>
3693      <backdrop name="lamp95" element="matrixlamp" state="0">
3694         <bounds x="120" y="40" width="7" height="7"/>
3695      </backdrop>
3696      <backdrop name="lamp96" element="matrixlamp" state="0">
3697         <bounds x="0" y="48" width="7" height="7"/>
3698      </backdrop>
3699      <backdrop name="lamp97" element="matrixlamp" state="0">
3700         <bounds x="8" y="48" width="7" height="7"/>
3701      </backdrop>
3702      <backdrop name="lamp98" element="matrixlamp" state="0">
3703         <bounds x="16" y="48" width="7" height="7"/>
3704      </backdrop>
3705      <backdrop name="lamp99" element="matrixlamp" state="0">
3706         <bounds x="24" y="48" width="7" height="7"/>
3707      </backdrop>
3708      <backdrop name="lamp100" element="matrixlamp" state="0">
3709         <bounds x="32" y="48" width="7" height="7"/>
3710      </backdrop>
3711      <backdrop name="lamp101" element="matrixlamp" state="0">
3712         <bounds x="40" y="48" width="7" height="7"/>
3713      </backdrop>
3714      <backdrop name="lamp102" element="matrixlamp" state="0">
3715         <bounds x="48" y="48" width="7" height="7"/>
3716      </backdrop>
3717      <backdrop name="lamp103" element="matrixlamp" state="0">
3718         <bounds x="56" y="48" width="7" height="7"/>
3719      </backdrop>
3720      <backdrop name="lamp104" element="matrixlamp" state="0">
3721         <bounds x="64" y="48" width="7" height="7"/>
3722      </backdrop>
3723      <backdrop name="lamp105" element="matrixlamp" state="0">
3724         <bounds x="72" y="48" width="7" height="7"/>
3725      </backdrop>
3726      <backdrop name="lamp106" element="matrixlamp" state="0">
3727         <bounds x="80" y="48" width="7" height="7"/>
3728      </backdrop>
3729      <backdrop name="lamp107" element="matrixlamp" state="0">
3730         <bounds x="88" y="48" width="7" height="7"/>
3731      </backdrop>
3732      <backdrop name="lamp108" element="matrixlamp" state="0">
3733         <bounds x="96" y="48" width="7" height="7"/>
3734      </backdrop>
3735      <backdrop name="lamp109" element="matrixlamp" state="0">
3736         <bounds x="104" y="48" width="7" height="7"/>
3737      </backdrop>
3738      <backdrop name="lamp110" element="matrixlamp" state="0">
3739         <bounds x="112" y="48" width="7" height="7"/>
3740      </backdrop>
3741      <backdrop name="lamp111" element="matrixlamp" state="0">
3742         <bounds x="120" y="48" width="7" height="7"/>
3743      </backdrop>
3744      <backdrop name="lamp112" element="matrixlamp" state="0">
3745         <bounds x="0" y="56" width="7" height="7"/>
3746      </backdrop>
3747      <backdrop name="lamp113" element="matrixlamp" state="0">
3748         <bounds x="8" y="56" width="7" height="7"/>
3749      </backdrop>
3750      <backdrop name="lamp114" element="matrixlamp" state="0">
3751         <bounds x="16" y="56" width="7" height="7"/>
3752      </backdrop>
3753      <backdrop name="lamp115" element="matrixlamp" state="0">
3754         <bounds x="24" y="56" width="7" height="7"/>
3755      </backdrop>
3756      <backdrop name="lamp116" element="matrixlamp" state="0">
3757         <bounds x="32" y="56" width="7" height="7"/>
3758      </backdrop>
3759      <backdrop name="lamp117" element="matrixlamp" state="0">
3760         <bounds x="40" y="56" width="7" height="7"/>
3761      </backdrop>
3762      <backdrop name="lamp118" element="matrixlamp" state="0">
3763         <bounds x="48" y="56" width="7" height="7"/>
3764      </backdrop>
3765      <backdrop name="lamp119" element="matrixlamp" state="0">
3766         <bounds x="56" y="56" width="7" height="7"/>
3767      </backdrop>
3768      <backdrop name="lamp120" element="matrixlamp" state="0">
3769         <bounds x="64" y="56" width="7" height="7"/>
3770      </backdrop>
3771      <backdrop name="lamp121" element="matrixlamp" state="0">
3772         <bounds x="72" y="56" width="7" height="7"/>
3773      </backdrop>
3774      <backdrop name="lamp122" element="matrixlamp" state="0">
3775         <bounds x="80" y="56" width="7" height="7"/>
3776      </backdrop>
3777      <backdrop name="lamp123" element="matrixlamp" state="0">
3778         <bounds x="88" y="56" width="7" height="7"/>
3779      </backdrop>
3780      <backdrop name="lamp124" element="matrixlamp" state="0">
3781         <bounds x="96" y="56" width="7" height="7"/>
3782      </backdrop>
3783      <backdrop name="lamp125" element="matrixlamp" state="0">
3784         <bounds x="104" y="56" width="7" height="7"/>
3785      </backdrop>
3786      <backdrop name="lamp126" element="matrixlamp" state="0">
3787         <bounds x="112" y="56" width="7" height="7"/>
3788      </backdrop>
3789      <backdrop name="lamp127" element="matrixlamp" state="0">
3790         <bounds x="120" y="56" width="7" height="7"/>
3791      </backdrop>
3792      <backdrop name="lamp128" element="matrixlamp" state="0">
3793         <bounds x="0" y="64" width="7" height="7"/>
3794      </backdrop>
3795      <backdrop name="lamp129" element="matrixlamp" state="0">
3796         <bounds x="8" y="64" width="7" height="7"/>
3797      </backdrop>
3798      <backdrop name="lamp130" element="matrixlamp" state="0">
3799         <bounds x="16" y="64" width="7" height="7"/>
3800      </backdrop>
3801      <backdrop name="lamp131" element="matrixlamp" state="0">
3802         <bounds x="24" y="64" width="7" height="7"/>
3803      </backdrop>
3804      <backdrop name="lamp132" element="matrixlamp" state="0">
3805         <bounds x="32" y="64" width="7" height="7"/>
3806      </backdrop>
3807      <backdrop name="lamp133" element="matrixlamp" state="0">
3808         <bounds x="40" y="64" width="7" height="7"/>
3809      </backdrop>
3810      <backdrop name="lamp134" element="matrixlamp" state="0">
3811         <bounds x="48" y="64" width="7" height="7"/>
3812      </backdrop>
3813      <backdrop name="lamp135" element="matrixlamp" state="0">
3814         <bounds x="56" y="64" width="7" height="7"/>
3815      </backdrop>
3816      <backdrop name="lamp136" element="matrixlamp" state="0">
3817         <bounds x="64" y="64" width="7" height="7"/>
3818      </backdrop>
3819      <backdrop name="lamp137" element="matrixlamp" state="0">
3820         <bounds x="72" y="64" width="7" height="7"/>
3821      </backdrop>
3822      <backdrop name="lamp138" element="matrixlamp" state="0">
3823         <bounds x="80" y="64" width="7" height="7"/>
3824      </backdrop>
3825      <backdrop name="lamp139" element="matrixlamp" state="0">
3826         <bounds x="88" y="64" width="7" height="7"/>
3827      </backdrop>
3828      <backdrop name="lamp140" element="matrixlamp" state="0">
3829         <bounds x="96" y="64" width="7" height="7"/>
3830      </backdrop>
3831      <backdrop name="lamp141" element="matrixlamp" state="0">
3832         <bounds x="104" y="64" width="7" height="7"/>
3833      </backdrop>
3834      <backdrop name="lamp142" element="matrixlamp" state="0">
3835         <bounds x="112" y="64" width="7" height="7"/>
3836      </backdrop>
3837      <backdrop name="lamp143" element="matrixlamp" state="0">
3838         <bounds x="120" y="64" width="7" height="7"/>
3839      </backdrop>
3840      <backdrop name="lamp144" element="matrixlamp" state="0">
3841         <bounds x="0" y="72" width="7" height="7"/>
3842      </backdrop>
3843      <backdrop name="lamp145" element="matrixlamp" state="0">
3844         <bounds x="8" y="72" width="7" height="7"/>
3845      </backdrop>
3846      <backdrop name="lamp146" element="matrixlamp" state="0">
3847         <bounds x="16" y="72" width="7" height="7"/>
3848      </backdrop>
3849      <backdrop name="lamp147" element="matrixlamp" state="0">
3850         <bounds x="24" y="72" width="7" height="7"/>
3851      </backdrop>
3852      <backdrop name="lamp148" element="matrixlamp" state="0">
3853         <bounds x="32" y="72" width="7" height="7"/>
3854      </backdrop>
3855      <backdrop name="lamp149" element="matrixlamp" state="0">
3856         <bounds x="40" y="72" width="7" height="7"/>
3857      </backdrop>
3858      <backdrop name="lamp150" element="matrixlamp" state="0">
3859         <bounds x="48" y="72" width="7" height="7"/>
3860      </backdrop>
3861      <backdrop name="lamp151" element="matrixlamp" state="0">
3862         <bounds x="56" y="72" width="7" height="7"/>
3863      </backdrop>
3864      <backdrop name="lamp152" element="matrixlamp" state="0">
3865         <bounds x="64" y="72" width="7" height="7"/>
3866      </backdrop>
3867      <backdrop name="lamp153" element="matrixlamp" state="0">
3868         <bounds x="72" y="72" width="7" height="7"/>
3869      </backdrop>
3870      <backdrop name="lamp154" element="matrixlamp" state="0">
3871         <bounds x="80" y="72" width="7" height="7"/>
3872      </backdrop>
3873      <backdrop name="lamp155" element="matrixlamp" state="0">
3874         <bounds x="88" y="72" width="7" height="7"/>
3875      </backdrop>
3876      <backdrop name="lamp156" element="matrixlamp" state="0">
3877         <bounds x="96" y="72" width="7" height="7"/>
3878      </backdrop>
3879      <backdrop name="lamp157" element="matrixlamp" state="0">
3880         <bounds x="104" y="72" width="7" height="7"/>
3881      </backdrop>
3882      <backdrop name="lamp158" element="matrixlamp" state="0">
3883         <bounds x="112" y="72" width="7" height="7"/>
3884      </backdrop>
3885      <backdrop name="lamp159" element="matrixlamp" state="0">
3886         <bounds x="120" y="72" width="7" height="7"/>
3887      </backdrop>
3888      <backdrop name="lamp160" element="matrixlamp" state="0">
3889         <bounds x="0" y="80" width="7" height="7"/>
3890      </backdrop>
3891      <backdrop name="lamp161" element="matrixlamp" state="0">
3892         <bounds x="8" y="80" width="7" height="7"/>
3893      </backdrop>
3894      <backdrop name="lamp162" element="matrixlamp" state="0">
3895         <bounds x="16" y="80" width="7" height="7"/>
3896      </backdrop>
3897      <backdrop name="lamp163" element="matrixlamp" state="0">
3898         <bounds x="24" y="80" width="7" height="7"/>
3899      </backdrop>
3900      <backdrop name="lamp164" element="matrixlamp" state="0">
3901         <bounds x="32" y="80" width="7" height="7"/>
3902      </backdrop>
3903      <backdrop name="lamp165" element="matrixlamp" state="0">
3904         <bounds x="40" y="80" width="7" height="7"/>
3905      </backdrop>
3906      <backdrop name="lamp166" element="matrixlamp" state="0">
3907         <bounds x="48" y="80" width="7" height="7"/>
3908      </backdrop>
3909      <backdrop name="lamp167" element="matrixlamp" state="0">
3910         <bounds x="56" y="80" width="7" height="7"/>
3911      </backdrop>
3912      <backdrop name="lamp168" element="matrixlamp" state="0">
3913         <bounds x="64" y="80" width="7" height="7"/>
3914      </backdrop>
3915      <backdrop name="lamp169" element="matrixlamp" state="0">
3916         <bounds x="72" y="80" width="7" height="7"/>
3917      </backdrop>
3918      <backdrop name="lamp170" element="matrixlamp" state="0">
3919         <bounds x="80" y="80" width="7" height="7"/>
3920      </backdrop>
3921      <backdrop name="lamp171" element="matrixlamp" state="0">
3922         <bounds x="88" y="80" width="7" height="7"/>
3923      </backdrop>
3924      <backdrop name="lamp172" element="matrixlamp" state="0">
3925         <bounds x="96" y="80" width="7" height="7"/>
3926      </backdrop>
3927      <backdrop name="lamp173" element="matrixlamp" state="0">
3928         <bounds x="104" y="80" width="7" height="7"/>
3929      </backdrop>
3930      <backdrop name="lamp174" element="matrixlamp" state="0">
3931         <bounds x="112" y="80" width="7" height="7"/>
3932      </backdrop>
3933      <backdrop name="lamp175" element="matrixlamp" state="0">
3934         <bounds x="120" y="80" width="7" height="7"/>
3935      </backdrop>
3936      <backdrop name="lamp176" element="matrixlamp" state="0">
3937         <bounds x="0" y="88" width="7" height="7"/>
3938      </backdrop>
3939      <backdrop name="lamp177" element="matrixlamp" state="0">
3940         <bounds x="8" y="88" width="7" height="7"/>
3941      </backdrop>
3942      <backdrop name="lamp178" element="matrixlamp" state="0">
3943         <bounds x="16" y="88" width="7" height="7"/>
3944      </backdrop>
3945      <backdrop name="lamp179" element="matrixlamp" state="0">
3946         <bounds x="24" y="88" width="7" height="7"/>
3947      </backdrop>
3948      <backdrop name="lamp180" element="matrixlamp" state="0">
3949         <bounds x="32" y="88" width="7" height="7"/>
3950      </backdrop>
3951      <backdrop name="lamp181" element="matrixlamp" state="0">
3952         <bounds x="40" y="88" width="7" height="7"/>
3953      </backdrop>
3954      <backdrop name="lamp182" element="matrixlamp" state="0">
3955         <bounds x="48" y="88" width="7" height="7"/>
3956      </backdrop>
3957      <backdrop name="lamp183" element="matrixlamp" state="0">
3958         <bounds x="56" y="88" width="7" height="7"/>
3959      </backdrop>
3960      <backdrop name="lamp184" element="matrixlamp" state="0">
3961         <bounds x="64" y="88" width="7" height="7"/>
3962      </backdrop>
3963      <backdrop name="lamp185" element="matrixlamp" state="0">
3964         <bounds x="72" y="88" width="7" height="7"/>
3965      </backdrop>
3966      <backdrop name="lamp186" element="matrixlamp" state="0">
3967         <bounds x="80" y="88" width="7" height="7"/>
3968      </backdrop>
3969      <backdrop name="lamp187" element="matrixlamp" state="0">
3970         <bounds x="88" y="88" width="7" height="7"/>
3971      </backdrop>
3972      <backdrop name="lamp188" element="matrixlamp" state="0">
3973         <bounds x="96" y="88" width="7" height="7"/>
3974      </backdrop>
3975      <backdrop name="lamp189" element="matrixlamp" state="0">
3976         <bounds x="104" y="88" width="7" height="7"/>
3977      </backdrop>
3978      <backdrop name="lamp190" element="matrixlamp" state="0">
3979         <bounds x="112" y="88" width="7" height="7"/>
3980      </backdrop>
3981      <backdrop name="lamp191" element="matrixlamp" state="0">
3982         <bounds x="120" y="88" width="7" height="7"/>
3983      </backdrop>
3984      <backdrop name="lamp192" element="matrixlamp" state="0">
3985         <bounds x="0" y="96" width="7" height="7"/>
3986      </backdrop>
3987      <backdrop name="lamp193" element="matrixlamp" state="0">
3988         <bounds x="8" y="96" width="7" height="7"/>
3989      </backdrop>
3990      <backdrop name="lamp194" element="matrixlamp" state="0">
3991         <bounds x="16" y="96" width="7" height="7"/>
3992      </backdrop>
3993      <backdrop name="lamp195" element="matrixlamp" state="0">
3994         <bounds x="24" y="96" width="7" height="7"/>
3995      </backdrop>
3996      <backdrop name="lamp196" element="matrixlamp" state="0">
3997         <bounds x="32" y="96" width="7" height="7"/>
3998      </backdrop>
3999      <backdrop name="lamp197" element="matrixlamp" state="0">
4000         <bounds x="40" y="96" width="7" height="7"/>
4001      </backdrop>
4002      <backdrop name="lamp198" element="matrixlamp" state="0">
4003         <bounds x="48" y="96" width="7" height="7"/>
4004      </backdrop>
4005      <backdrop name="lamp199" element="matrixlamp" state="0">
4006         <bounds x="56" y="96" width="7" height="7"/>
4007      </backdrop>
4008      <backdrop name="lamp200" element="matrixlamp" state="0">
4009         <bounds x="64" y="96" width="7" height="7"/>
4010      </backdrop>
4011      <backdrop name="lamp201" element="matrixlamp" state="0">
4012         <bounds x="72" y="96" width="7" height="7"/>
4013      </backdrop>
4014      <backdrop name="lamp202" element="matrixlamp" state="0">
4015         <bounds x="80" y="96" width="7" height="7"/>
4016      </backdrop>
4017      <backdrop name="lamp203" element="matrixlamp" state="0">
4018         <bounds x="88" y="96" width="7" height="7"/>
4019      </backdrop>
4020      <backdrop name="lamp204" element="matrixlamp" state="0">
4021         <bounds x="96" y="96" width="7" height="7"/>
4022      </backdrop>
4023      <backdrop name="lamp205" element="matrixlamp" state="0">
4024         <bounds x="104" y="96" width="7" height="7"/>
4025      </backdrop>
4026      <backdrop name="lamp206" element="matrixlamp" state="0">
4027         <bounds x="112" y="96" width="7" height="7"/>
4028      </backdrop>
4029      <backdrop name="lamp207" element="matrixlamp" state="0">
4030         <bounds x="120" y="96" width="7" height="7"/>
4031      </backdrop>
4032      <backdrop name="lamp208" element="matrixlamp" state="0">
4033         <bounds x="0" y="104" width="7" height="7"/>
4034      </backdrop>
4035      <backdrop name="lamp209" element="matrixlamp" state="0">
4036         <bounds x="8" y="104" width="7" height="7"/>
4037      </backdrop>
4038      <backdrop name="lamp210" element="matrixlamp" state="0">
4039         <bounds x="16" y="104" width="7" height="7"/>
4040      </backdrop>
4041      <backdrop name="lamp211" element="matrixlamp" state="0">
4042         <bounds x="24" y="104" width="7" height="7"/>
4043      </backdrop>
4044      <backdrop name="lamp212" element="matrixlamp" state="0">
4045         <bounds x="32" y="104" width="7" height="7"/>
4046      </backdrop>
4047      <backdrop name="lamp213" element="matrixlamp" state="0">
4048         <bounds x="40" y="104" width="7" height="7"/>
4049      </backdrop>
4050      <backdrop name="lamp214" element="matrixlamp" state="0">
4051         <bounds x="48" y="104" width="7" height="7"/>
4052      </backdrop>
4053      <backdrop name="lamp215" element="matrixlamp" state="0">
4054         <bounds x="56" y="104" width="7" height="7"/>
4055      </backdrop>
4056      <backdrop name="lamp216" element="matrixlamp" state="0">
4057         <bounds x="64" y="104" width="7" height="7"/>
4058      </backdrop>
4059      <backdrop name="lamp217" element="matrixlamp" state="0">
4060         <bounds x="72" y="104" width="7" height="7"/>
4061      </backdrop>
4062      <backdrop name="lamp218" element="matrixlamp" state="0">
4063         <bounds x="80" y="104" width="7" height="7"/>
4064      </backdrop>
4065      <backdrop name="lamp219" element="matrixlamp" state="0">
4066         <bounds x="88" y="104" width="7" height="7"/>
4067      </backdrop>
4068      <backdrop name="lamp220" element="matrixlamp" state="0">
4069         <bounds x="96" y="104" width="7" height="7"/>
4070      </backdrop>
4071      <backdrop name="lamp221" element="matrixlamp" state="0">
4072         <bounds x="104" y="104" width="7" height="7"/>
4073      </backdrop>
4074      <backdrop name="lamp222" element="matrixlamp" state="0">
4075         <bounds x="112" y="104" width="7" height="7"/>
4076      </backdrop>
4077      <backdrop name="lamp223" element="matrixlamp" state="0">
4078         <bounds x="120" y="104" width="7" height="7"/>
4079      </backdrop>
4080      <backdrop name="lamp224" element="matrixlamp" state="0">
4081         <bounds x="0" y="112" width="7" height="7"/>
4082      </backdrop>
4083      <backdrop name="lamp225" element="matrixlamp" state="0">
4084         <bounds x="8" y="112" width="7" height="7"/>
4085      </backdrop>
4086      <backdrop name="lamp226" element="matrixlamp" state="0">
4087         <bounds x="16" y="112" width="7" height="7"/>
4088      </backdrop>
4089      <backdrop name="lamp227" element="matrixlamp" state="0">
4090         <bounds x="24" y="112" width="7" height="7"/>
4091      </backdrop>
4092      <backdrop name="lamp228" element="matrixlamp" state="0">
4093         <bounds x="32" y="112" width="7" height="7"/>
4094      </backdrop>
4095      <backdrop name="lamp229" element="matrixlamp" state="0">
4096         <bounds x="40" y="112" width="7" height="7"/>
4097      </backdrop>
4098      <backdrop name="lamp230" element="matrixlamp" state="0">
4099         <bounds x="48" y="112" width="7" height="7"/>
4100      </backdrop>
4101      <backdrop name="lamp231" element="matrixlamp" state="0">
4102         <bounds x="56" y="112" width="7" height="7"/>
4103      </backdrop>
4104      <backdrop name="lamp232" element="matrixlamp" state="0">
4105         <bounds x="64" y="112" width="7" height="7"/>
4106      </backdrop>
4107      <backdrop name="lamp233" element="matrixlamp" state="0">
4108         <bounds x="72" y="112" width="7" height="7"/>
4109      </backdrop>
4110      <backdrop name="lamp234" element="matrixlamp" state="0">
4111         <bounds x="80" y="112" width="7" height="7"/>
4112      </backdrop>
4113      <backdrop name="lamp235" element="matrixlamp" state="0">
4114         <bounds x="88" y="112" width="7" height="7"/>
4115      </backdrop>
4116      <backdrop name="lamp236" element="matrixlamp" state="0">
4117         <bounds x="96" y="112" width="7" height="7"/>
4118      </backdrop>
4119      <backdrop name="lamp237" element="matrixlamp" state="0">
4120         <bounds x="104" y="112" width="7" height="7"/>
4121      </backdrop>
4122      <backdrop name="lamp238" element="matrixlamp" state="0">
4123         <bounds x="112" y="112" width="7" height="7"/>
4124      </backdrop>
4125      <backdrop name="lamp239" element="matrixlamp" state="0">
4126         <bounds x="120" y="112" width="7" height="7"/>
4127      </backdrop>
4128      <backdrop name="lamp240" element="matrixlamp" state="0">
4129         <bounds x="0" y="120" width="7" height="7"/>
4130      </backdrop>
4131      <backdrop name="lamp241" element="matrixlamp" state="0">
4132         <bounds x="8" y="120" width="7" height="7"/>
4133      </backdrop>
4134      <backdrop name="lamp242" element="matrixlamp" state="0">
4135         <bounds x="16" y="120" width="7" height="7"/>
4136      </backdrop>
4137      <backdrop name="lamp243" element="matrixlamp" state="0">
4138         <bounds x="24" y="120" width="7" height="7"/>
4139      </backdrop>
4140      <backdrop name="lamp244" element="matrixlamp" state="0">
4141         <bounds x="32" y="120" width="7" height="7"/>
4142      </backdrop>
4143      <backdrop name="lamp245" element="matrixlamp" state="0">
4144         <bounds x="40" y="120" width="7" height="7"/>
4145      </backdrop>
4146      <backdrop name="lamp246" element="matrixlamp" state="0">
4147         <bounds x="48" y="120" width="7" height="7"/>
4148      </backdrop>
4149      <backdrop name="lamp247" element="matrixlamp" state="0">
4150         <bounds x="56" y="120" width="7" height="7"/>
4151      </backdrop>
4152      <backdrop name="lamp248" element="matrixlamp" state="0">
4153         <bounds x="64" y="120" width="7" height="7"/>
4154      </backdrop>
4155      <backdrop name="lamp249" element="matrixlamp" state="0">
4156         <bounds x="72" y="120" width="7" height="7"/>
4157      </backdrop>
4158      <backdrop name="lamp250" element="matrixlamp" state="0">
4159         <bounds x="80" y="120" width="7" height="7"/>
4160      </backdrop>
4161      <backdrop name="lamp251" element="matrixlamp" state="0">
4162         <bounds x="88" y="120" width="7" height="7"/>
4163      </backdrop>
4164      <backdrop name="lamp252" element="matrixlamp" state="0">
4165         <bounds x="96" y="120" width="7" height="7"/>
4166      </backdrop>
4167      <backdrop name="lamp253" element="matrixlamp" state="0">
4168         <bounds x="104" y="120" width="7" height="7"/>
4169      </backdrop>
4170      <backdrop name="lamp254" element="matrixlamp" state="0">
4171         <bounds x="112" y="120" width="7" height="7"/>
4172      </backdrop>
4173      <backdrop name="lamp255" element="matrixlamp" state="0">
4174         <bounds x="120" y="120" width="7" height="7"/>
4175      </backdrop>
4176   </view>
4177
4178   <view name="Adder 2 Output Only (400:280, No Artwork)">
4179      <screen index="0">
4180         <bounds left="0" top="0" right="400" bottom="280" />
4181      </screen>
4182   </view>
4183</mamelayout>
4184
src/mame/drivers/bfm_sc1.c
r11224r11225
207207{
208208   bfm_sc1_state *state = space->machine().driver_data<bfm_sc1_state>();
209209   if ( state->m_locked & 0x01 )
210   {   // hardware is still state->m_locked,
210   {   // hardware is still locked,
211211      if ( data == 0x46 ) state->m_locked &= ~0x01;
212212   }
213213   else
r11224r11225
230230{
231231   bfm_sc1_state *state = space->machine().driver_data<bfm_sc1_state>();
232232   if ( state->m_locked & 0x02 )
233   {   // hardware is still state->m_locked,
233   {   // hardware is still locked,
234234      if ( data == 0x42 ) state->m_locked &= ~0x02;
235235   }
236236   else
r11224r11225
272272   bfm_sc1_state *state = space->machine().driver_data<bfm_sc1_state>();
273273   int i;
274274   if ( state->m_locked & 0x04 )
275   {   // hardware is still state->m_locked,
275   {   // hardware is still locked,
276276      state->m_locked &= ~0x04;
277277   }
278278   else
r11224r11225
745745   }
746746
747747   state->m_acia_status   = 0x02; // MC6850 transmit buffer empty !!!
748   state->m_locked        = 0x07; // hardware is state->m_locked
748   state->m_locked        = 0x07; // hardware is locked
749749
750750// init rom bank ////////////////////////////////////////////////////////////////////
751751   {
r11224r11225
797797
798798   AM_RANGE(0x4000, 0x5FFF) AM_ROM                     // 8k  ROM
799799   AM_RANGE(0x6000, 0x7FFF) AM_ROMBANK("bank1")               // 8k  paged ROM (4 pages)
800   AM_RANGE(0x8000, 0xFFFF) AM_RAM_WRITE(watchdog_w)   // 32k ROM
800   AM_RANGE(0x8000, 0xFFFF) AM_ROM AM_WRITE (watchdog_w)//AM_RAM_WRITE(watchdog_w) // 32k ROM
801801
802802ADDRESS_MAP_END
803803
src/mame/drivers/mediagx.c
r11224r11225
12321232static READ32_HANDLER( speedup10_r ) { return generic_speedup(space, 10); }
12331233static READ32_HANDLER( speedup11_r ) { return generic_speedup(space, 11); }
12341234
1235static const read32_space_func speedup_handlers[] =
1235static const struct { read32_space_func func; const char *name; } speedup_handlers[] =
12361236{
1237   speedup0_r,      speedup1_r,      speedup2_r,      speedup3_r,
1238   speedup4_r,      speedup5_r,      speedup6_r,      speedup7_r,
1239   speedup8_r,      speedup9_r,      speedup10_r,   speedup11_r
1237   { FUNC(speedup0_r) },   { FUNC(speedup1_r) },   { FUNC(speedup2_r) },   { FUNC(speedup3_r) },
1238   { FUNC(speedup4_r) },   { FUNC(speedup5_r) },   { FUNC(speedup6_r) },   { FUNC(speedup7_r) },
1239   { FUNC(speedup8_r) },   { FUNC(speedup9_r) },   { FUNC(speedup10_r) },   { FUNC(speedup11_r) }
12401240};
12411241
12421242#ifdef MAME_DEBUG
r11224r11225
12611261   state->m_speedup_count = count;
12621262
12631263   for (i = 0; i < count; i++)
1264      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, FUNC(speedup_handlers[i]));
1264      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, speedup_handlers[i].func, speedup_handlers[i].name);
12651265
12661266#ifdef MAME_DEBUG
12671267   machine.add_notifier(MACHINE_NOTIFY_EXIT, report_speedups);
src/mame/drivers/midzeus.c
r11224r11225
7878
7979static MACHINE_START( midzeus )
8080{
81   timer[0] = machine.scheduler().timer_alloc(FUNC(NULL));
82   timer[1] = machine.scheduler().timer_alloc(FUNC(NULL));
81   timer[0] = machine.scheduler().timer_alloc(FUNC_NULL);
82   timer[1] = machine.scheduler().timer_alloc(FUNC_NULL);
8383
8484   gun_timer[0] = machine.scheduler().timer_alloc(FUNC(invasn_gun_callback));
8585   gun_timer[1] = machine.scheduler().timer_alloc(FUNC(invasn_gun_callback));
src/mame/drivers/cesclass.c
r11224r11225
11/*
22
3   CES Classic wall games
3    CES Classic wall games
44
55*/
66
r11224r11225
7777ROM_END
7878
7979ROM_START(tsclass)
80   ROM_REGION( 0x100000, "maincpu", 0 )   
80   ROM_REGION( 0x100000, "maincpu", 0 )
8181   ROM_LOAD("tsclassic-v100-u43u44.bin", 0x000000, 0x100000, CRC(a820ec9a) SHA1(84e38c7e54bb9e80142ed4e7763c9e36df560f42) )
8282
8383   ROM_REGION( 0x80000, "oki", 0 )
src/mame/drivers/mpu4.c
r11224r11225
44  This is the core driver, no video specific stuff should go in here.
55  This driver holds all the mechanical games.
66
7     01-2011: Adding the missing 'OKI' sound card, and documented it.
8     05-2009: Miscellaneous lamp fixes, based on data from FME Forever.
7     04-2011: More accurate gamball code, fixed ROM banking (Project Amber), added BwB CHR simulator (Amber)
8              This is still a hard coded system, but significantly different to Barcrest's version.
9     03-2011: Lamp timing fixes, support for all known expansion cards added.
10     01-2011: Adding the missing 'OKI' sound card, and documented it, but needs 6376 rewrite.
911     09-2007: Haze: Added Deal 'Em video support.
1012  03-08-2007: J Wallace: Removed audio filter for now, since sound is more accurate without them.
1113                         Connect 4 now has the right sound.
1214  03-07-2007: J Wallace: Several major changes, including input relabelling, and system timer improvements.
1315     06-2007: Atari Ace, many cleanups and optimizations of I/O routines
1416  09-06-2007: J Wallace: Fixed 50Hz detection circuit.
15  09-04-2007: J Wallace: Corrected a lot of out of date info in this revision history.
16                         Revisionism, if you will.
1717  17-02-2007: J Wallace: Added Deal 'Em - still needs some work.
1818  10-02-2007: J Wallace: Improved input timing.
1919  30-01-2007: J Wallace: Characteriser rewritten to run the 'extra' data needed by some games.
r11224r11225
256256static TIMER_CALLBACK( ic24_timeout );
257257
258258
259static const UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used
259static const UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used, this is basically a wire swap
260260static const UINT8 reel_mux_table7[8]= {3,1,5,6,4,2,0,7};
261261
262static const UINT8 bwb_chr_table_common[10]= {0x00,0x04,0x04,0x0c,0x0c,0x1c,0x14,0x2c,0x5c,0x2c};
263
262264#define STANDARD_REEL  0   /* As originally designed 3/4 reels*/
263265#define FIVE_REEL_5TO8 1   /* Interfaces to meter port, allows some mechanical metering, but there is significant 'bounce' in the extra reel*/
264266#define FIVE_REEL_8TO5 2   /* Mounted backwards for space reasons, but different board*/
r11224r11225
293295   UINT8 response;
294296};
295297
298struct bwb_chr_table//dynamic populated table
299{
300   UINT8 response;
301};
302
296303/* Video stuff */
297304struct ef9369_t
298305{
r11224r11225
358365   int m_card_live;
359366   int m_led_extender;
360367   int m_bwb_bank;
368   int m_chr_state;
369   int m_chr_counter;
370   int m_chr_value;
371   int m_bwb_return;
372   int m_pageval;
373   int m_pageset;
361374   int m_hopper;
362375   const mpu4_chr_table* m_current_chr_table;
363
376   const bwb_chr_table* m_bwb_chr_table1;
364377   //Video
365378   UINT8 m_m6840_irq_state;
366379   UINT8 m_m6850_irq_state;
r11224r11225
608621   for (reel = 0; reel < 6; reel++)
609622   {
610623      stepper_reset_position(reel);
611      if (stepper_optic_state(reel)) pattern |= 1<<reel;
624      if(!state->m_reel_mux)
625      {
626         if (stepper_optic_state(reel)) pattern |= 1<<reel;
627      }
612628   }
613629   state->m_optic_pattern = pattern;
614630}
r11224r11225
633649   state->m_IC23G2B   = 0;
634650
635651   state->m_prot_col  = 0;
652   state->m_chr_counter    = 0;
653   state->m_chr_value      = 0;
636654
637/* init rom bank, some games don't set this */
655   /* init rom bank, some games don't set this, and will assume bank 0,set 0 */
638656   {
639657      UINT8 *rom = machine.region("maincpu")->base();
640658
r11224r11225
643661      memory_set_bank(machine, "bank1",0);
644662      machine.device("maincpu")->reset();
645663   }
646
647664}
648665
649666
r11224r11225
680697   }
681698}
682699
683/* Bankswitching */
700/* Bankswitching
701The MOD 4 ROM cards are set up to handle 8 separate ROM pages, arranged as 2 sets of 4.
702The bankswitch selects which of the 4 pages in the set is active, while the bankset
703switches between the sets.
704It appears that the cards were originally intended to be used in a 'half' page setup,
705where the two halves of the ROM space could be mixed and matched as appropriate.
706However, there is no evidence to suggest this was ever implemented.
707The controls for it exist however, in the form of the Soundboard PIA CB2 pin, which is
708used in some cabinets instead of the main control.
709*/
684710static WRITE8_HANDLER( bankswitch_w )
685711{
686   memory_set_bank(space->machine(), "bank1",data & 0x07);
712   mpu4_state *state = space->machine().driver_data<mpu4_state>();
713   state->m_pageval=(data&0x03);
714   memory_set_bank(space->machine(), "bank1",state->m_pageval + (state->m_pageset?4:0));
687715}
688716
689717
r11224r11225
693721}
694722
695723
724static WRITE8_HANDLER( bankset_w )
725{
726   mpu4_state *state = space->machine().driver_data<mpu4_state>();
727   state->m_pageval=(data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
728   memory_set_bank(space->machine(), "bank1",state->m_pageval + (state->m_pageset?4:0));
729}
730
731
696732/* IC2 6840 PTM handler */
697733static WRITE8_DEVICE_HANDLER( ic2_o1_callback )
698734{
r11224r11225
810846static WRITE_LINE_DEVICE_HANDLER( pia_ic3_cb2_w )
811847{
812848   LOG_IC3(("%s: IC3 PIA Write CB (alpha reset), %02X\n",device->machine().describe_context(),state));
813
849// DM Data pin A
814850   if ( state ) ROC10937_reset(0);
815851   ROC10937_draw_16seg(0);
816852}
r11224r11225
11171153   }
11181154
11191155      if (mame_stricmp(device->machine().system().name, "m_gmball") == 0)
1120   {
1156      {
11211157      /* The 'Gamball' device is a unique piece of mechanical equipment, designed to
11221158        provide a truly fair hi-lo gamble for an AWP machine. Functionally, it consists of
11231159        a ping-pong ball or similar enclosed in the machine's backbox, on a platform with 12
11241160        holes. When the low 4 bytes of AUX1 are triggered, this fires the ball out from the
1125        hole it's currently in, to land in another. Landing in the same hole cause the machine to
1161        hole it's currently in, to land in another. Landing in the same hole causes the machine to
11261162        refire the ball. The ball detection is done by the high 4 bytes of AUX1.
1127        Here we call the MAME RNG, clamping it to 16 values, with the unused
1128        values effectively asking the machine to 'roll again'. We then trigger the switches corresponding to
1129        the correct number. This appears to be the best way of making the game fair, short of simulating
1130        the physics of a bouncing ball ;)*/
1163        Here we call the MAME RNG, once to pick a row, once to pick from the four pockets within it. We
1164        then trigger the switches corresponding to the correct number. This appears to be the best way
1165        of making the game fair, short of simulating the physics of a bouncing ball ;)*/
11311166      if (data & 0x0f)
11321167      {
1133         switch (device->machine().rand() & 0xf)
1168         switch (device->machine().rand() & 0x2)
11341169         {
1135         case 0x00:
1136         default:
1137         break;// stay where we are if we roll a zero, or roll more than 12
1138         case 0x01:
1139         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1140         state->m_aux1_input|= 0x50;
1141         break;
1142         case 0x02:
1143         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1144         state->m_aux1_input|= 0x90;
1145         break;
1146         case 0x03:
1147         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1148         state->m_aux1_input|= 0x20;
1149         break;
1150         case 0x04:
1151         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1152         state->m_aux1_input|= 0xb0;
1153         break;
1154         case 0x05:
1155         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1156         state->m_aux1_input|= 0x00;
1157         break;
1158         case 0x06:
1159         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1160         state->m_aux1_input|= 0x30;
1161         break;
1162         case 0x07:
1163         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1164         state->m_aux1_input|= 0xa0;
1165         break;
1166         case 0x08:
1167         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1168         state->m_aux1_input|= 0xd0;
1169         break;
1170         case 0x09:
1171         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1172         state->m_aux1_input|= 0xd0;
1173         break;
1174         case 0x0a:
1175         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1176         state->m_aux1_input|= 0x10;
1177         break;
1178         case 0xb:
1179         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1180         state->m_aux1_input|= 0x80;
1181         break;
1182         case 0xc:
1183         state->m_aux1_input = (state->m_aux1_input & 0x0f);
1184         state->m_aux1_input|= 0x40;
1185         break;
1170            case 0x00: //Top row
1171            {
1172               switch (device->machine().rand() & 0x3)
1173               {
1174                  case 0x00: //7
1175                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1176                  state->m_aux1_input|= 0xa0;
1177                  break;
1178                  case 0x01://4
1179                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1180                  state->m_aux1_input|= 0xb0;
1181                  break;
1182                  case 0x02://9
1183                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1184                  state->m_aux1_input|= 0xc0;
1185                  break;
1186                  case 0x03://8
1187                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1188                  state->m_aux1_input|= 0xd0;
1189                  break;
1190               }
1191            }
1192            case 0x01: //Middle row - note switches don't match pattern
1193            {
1194               switch (device->machine().rand() & 0x3)
1195               {
1196                  case 0x00://12
1197                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1198                  state->m_aux1_input|= 0x40;
1199                  break;
1200                  case 0x01://1
1201                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1202                  state->m_aux1_input|= 0x50;
1203                  break;
1204                  case 0x02://11
1205                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1206                  state->m_aux1_input|= 0x80;
1207                  break;
1208                  case 0x03://2
1209                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1210                  state->m_aux1_input|= 0x90;
1211                  break;
1212               }
1213            }
1214            case 0x02: //Bottom row
1215            {
1216               switch (device->machine().rand() & 0x3)
1217               {
1218                  case 0x00://5
1219                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1220                  state->m_aux1_input|= 0x00;
1221                  break;
1222                  case 0x01://10
1223                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1224                  state->m_aux1_input|= 0x10;
1225                  break;
1226                  case 0x02://3
1227                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1228                  state->m_aux1_input|= 0x20;
1229                  break;
1230                  case 0x03://6
1231                  state->m_aux1_input = (state->m_aux1_input & 0x0f);
1232                  state->m_aux1_input|= 0x30;
1233                  break;
1234               }
1235            }
11861236         }
11871237      }
11881238   }
r11224r11225
15741624   mpu4_state *drvstate = device->machine().driver_data<mpu4_state>();
15751625   LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", device->machine().describe_context(), state & 0xFF));
15761626
1627   // DM Data pin B
15771628   if ( !drvstate->m_alpha_clock && (state) )
15781629   {
15791630      ROC10937_shift_data(0, drvstate->m_alpha_data_line&0x01?0:1);
r11224r11225
16631714   //Some BWB games use this to drive the bankswitching
16641715   if (mstate->m_bwb_bank)
16651716   {
1666      memory_set_bank(device->machine(), "bank1",state);
1717      mstate->m_pageval=state;
1718
1719      memory_set_bank(device->machine(), "bank1",mstate->m_pageval + (mstate->m_pageset?4:0));
16671720   }
16681721}
16691722
r11224r11225
17711824   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_START1)
17721825
17731826   PORT_START("DIL1")
1774   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
1827   PORT_DIPNAME( 0x80, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
17751828   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1776   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1777   PORT_DIPNAME( 0x02, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
1829   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1830   PORT_DIPNAME( 0x40, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
17781831   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1779   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1780   PORT_DIPNAME( 0x04, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
1832   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1833   PORT_DIPNAME( 0x20, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
17811834   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1782   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1783   PORT_DIPNAME( 0x08, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
1835   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1836   PORT_DIPNAME( 0x10, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
17841837   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1838   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1839   PORT_DIPNAME( 0x08, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
1840   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
17851841   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1786   PORT_DIPNAME( 0x10, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
1842   PORT_DIPNAME( 0x04, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
17871843   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1788   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1789   PORT_DIPNAME( 0x20, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
1844   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1845   PORT_DIPNAME( 0x02, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
17901846   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1791   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1792   PORT_DIPNAME( 0x40, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
1847   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1848   PORT_DIPNAME( 0x01, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
17931849   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1794   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1795   PORT_DIPNAME( 0x80, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
1796   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1797   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1850   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
17981851
17991852   PORT_START("DIL2")
1800   PORT_DIPNAME( 0x01, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
1853   PORT_DIPNAME( 0x80, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
18011854   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1802   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1803   PORT_DIPNAME( 0x02, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
1855   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1856   PORT_DIPNAME( 0x40, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
18041857   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1805   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1806   PORT_DIPNAME( 0x04, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
1858   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1859   PORT_DIPNAME( 0x20, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
18071860   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1808   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1809   PORT_DIPNAME( 0x08, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
1861   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1862   PORT_DIPNAME( 0x10, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
18101863   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1864   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1865   PORT_DIPNAME( 0x08, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
1866   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
18111867   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1812   PORT_DIPNAME( 0x10, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
1868   PORT_DIPNAME( 0x04, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
18131869   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1814   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1815   PORT_DIPNAME( 0x20, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
1870   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1871   PORT_DIPNAME( 0x02, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
18161872   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1817   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1818   PORT_DIPNAME( 0x40, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
1873   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1874   PORT_DIPNAME( 0x01, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
18191875   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1820   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1821   PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
1822   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1823   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1876   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
18241877
18251878   PORT_START("AUX1")
18261879   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0")
r11224r11225
18861939   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Drop")
18871940
18881941   PORT_START("DIL1")
1889   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
1942   PORT_DIPNAME( 0x80, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
18901943   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1891   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1892   PORT_DIPNAME( 0x02, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
1944   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1945   PORT_DIPNAME( 0x40, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
18931946   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1894   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1895   PORT_DIPNAME( 0x04, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
1947   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1948   PORT_DIPNAME( 0x20, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
18961949   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1897   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1898   PORT_DIPNAME( 0x08, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
1950   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1951   PORT_DIPNAME( 0x10, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
18991952   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1953   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1954   PORT_DIPNAME( 0x08, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
1955   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
19001956   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1901   PORT_DIPNAME( 0x10, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
1957   PORT_DIPNAME( 0x04, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
19021958   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1903   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1904   PORT_DIPNAME( 0x20, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
1959   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1960   PORT_DIPNAME( 0x02, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
19051961   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1906   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1907   PORT_DIPNAME( 0x40, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
1962   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1963   PORT_DIPNAME( 0x01, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
19081964   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1909   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1910   PORT_DIPNAME( 0x80, 0x00, "Invert Alpha?" ) PORT_DIPLOCATION("DIL1:08")
1911   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1912   PORT_DIPSETTING(    0x80, DEF_STR( Yes  ) )
1965   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
19131966
19141967   PORT_START("DIL2")
1915   PORT_DIPNAME( 0x01, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
1968   PORT_DIPNAME( 0x80, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
19161969   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1917   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
1918   PORT_DIPNAME( 0x02, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
1970   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1971   PORT_DIPNAME( 0x40, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
19191972   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1920   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1921   PORT_DIPNAME( 0x04, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
1973   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1974   PORT_DIPNAME( 0x20, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
19221975   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1923   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1924   PORT_DIPNAME( 0x08, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
1976   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1977   PORT_DIPNAME( 0x10, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
19251978   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1979   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1980   PORT_DIPNAME( 0x08, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
1981   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
19261982   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
1927   PORT_DIPNAME( 0x10, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
1983   PORT_DIPNAME( 0x04, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
19281984   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1929   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
1930   PORT_DIPNAME( 0x20, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
1985   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
1986   PORT_DIPNAME( 0x02, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
19311987   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1932   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
1933   PORT_DIPNAME( 0x40, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
1988   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
1989   PORT_DIPNAME( 0x01, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
19341990   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1935   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
1936   PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
1937   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1938   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
1991   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
19391992
19401993   PORT_START("AUX1")
19411994   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0")
r11224r11225
20002053   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_START1)
20012054
20022055   PORT_START("DIL1")
2003   PORT_DIPNAME( 0x01, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
2056   PORT_DIPNAME( 0x80, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
20042057   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2005   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
2006   PORT_DIPNAME( 0x02, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
2058   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2059   PORT_DIPNAME( 0x40, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
20072060   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2008   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2009   PORT_DIPNAME( 0x04, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
2061   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2062   PORT_DIPNAME( 0x20, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
20102063   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2011   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2012   PORT_DIPNAME( 0x08, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
2064   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2065   PORT_DIPNAME( 0x10, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
20132066   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2067   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2068   PORT_DIPNAME( 0x08, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
2069   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20142070   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
2015   PORT_DIPNAME( 0x10, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
2071   PORT_DIPNAME( 0x04, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
20162072   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2017   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2018   PORT_DIPNAME( 0x20, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
2073   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2074   PORT_DIPNAME( 0x02, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
20192075   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2020   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2021   PORT_DIPNAME( 0x40, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
2076   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2077   PORT_DIPNAME( 0x01, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
20222078   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2023   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2024   PORT_DIPNAME( 0x80, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
2025   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2026   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2079   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
20272080
20282081   PORT_START("DIL2")
2029   PORT_DIPNAME( 0x01, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
2082   PORT_DIPNAME( 0x80, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
20302083   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2031   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
2032   PORT_DIPNAME( 0x02, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
2084   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2085   PORT_DIPNAME( 0x40, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
20332086   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2034   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2035   PORT_DIPNAME( 0x04, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
2087   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2088   PORT_DIPNAME( 0x20, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
20362089   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2037   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2038   PORT_DIPNAME( 0x08, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
2090   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2091   PORT_DIPNAME( 0x10, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
20392092   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2093   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2094   PORT_DIPNAME( 0x08, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
2095   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20402096   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
2041   PORT_DIPNAME( 0x10, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
2097   PORT_DIPNAME( 0x04, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
20422098   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2043   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
2044   PORT_DIPNAME( 0x20, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
2099   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
2100   PORT_DIPNAME( 0x02, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
20452101   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2046   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
2047   PORT_DIPNAME( 0x40, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
2102   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
2103   PORT_DIPNAME( 0x01, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
20482104   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2049   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
2050   PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
2051   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2052   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
2105   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
20532106
20542107   PORT_START("AUX1")
20552108   PORT_BIT(0xFF, IP_ACTIVE_HIGH, IPT_SPECIAL)//Handled by Gamball unit
r11224r11225
20722125   4,
20732126   0x00
20742127};
2128
2129static const stepper_interface barcrest_reelrev_interface =
2130{
2131   BARCREST_48STEP_REEL,
2132   92,
2133   4,
2134   0x00,
2135   1
2136};
2137
20752138static const stepper_interface barcrest_opto1_interface =
20762139{
20772140   BARCREST_48STEP_REEL,
r11224r11225
21812244The initial 'PALTEST' routine as found in the Barcrest programs simply writes the first 'call' to the CHR space,
21822245to read back the 'response'. There is no attempt to alter the order or anything else, just
21832246a simple runthrough of the entire data table. The only 'catch' in this is to note that the CHR chip always scans
2184through the table starting at the last accessed data value, unless 00 is used to reset to the beginning.
2247through the table starting at the last accessed data value, unless 00 is used to reset to the beginning. This is obviously
2248a simplification, in fact the PAL does bit manipulation with some latching.
21852249
21862250However, a final 8 byte row, that controls the lamp matrix is not tested - to date, no-one outside of Barcrest knows
21872251how this is generated, and currently trial and error is the only sensible method. It is noted that the default,
r11224r11225
22802344BwB Characteriser (CHR)
22812345
22822346The BwB method of protection is considerably different to the Barcrest one, with any
2283incorrect behaviour manifesting in ridiculously large payouts.
2347incorrect behaviour manifesting in ridiculously large payouts. The hardware is the
2348same, however the main weakness of the software has been eliminated.
22842349
22852350In fact, the software seems deliberately designed to mislead, but is (fortunately for
22862351us) prone to similar weaknesses that allow a per game solution.
22872352
2353Project Amber performed a source analysis (available on request) which appears to make things work.
2354Said weaknesses (A Cheats Guide according to Project Amber)
2355
2356The common initialisation sequence is "00 04 04 0C 0C 1C 14 2C 5C 2C"
2357                                        0  1  2  3  4  5  6  7  8
2358Using debug search for the first read from said string (best to find it first).
2359
2360At this point, the X index on the CPU is at the magic number address.
2361
2362The subsequent calls for each can be found based on the magic address
2363
2364           (0) = ( (BWBMagicAddress))
2365           (1) = ( (BWBMagicAddress + 1))
2366           (2) = ( (BWBMagicAddress + 2))
2367           (3) = ( (BWBMagicAddress + 4))
2368
2369           (4) = ( (BWBMagicAddress - 5))
2370           (5) = ( (BWBMagicAddress - 4))
2371           (6) = ( (BWBMagicAddress - 3))
2372           (7) = ( (BWBMagicAddress - 2))
2373           (8) = ( (BWBMagicAddress - 1))
2374
2375These return the standard init sequence as above.
2376
2377For ease of understanding, we use three tables, one holding the common responses
2378and two holding the appropriate call and response pairs for the two stages of operation
22882379*/
22892380
22902381
r11224r11225
22972388   if (!state->m_current_chr_table)
22982389      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
22992390
2300   if (offset == 0)//initialisation is always at 0x800
2391   if ((offset & 0x3f)== 0)//initialisation is always at 0x800
23012392   {
2393      if (!state->m_chr_state)
23022394      {
2303         if (call == 0)
2304         {
2305            state->m_init_col =0;
2306         }
2307         else
2308         {
2309            for (x = state->m_init_col; x < 64; x++)
2310            {
2311               if   (state->m_current_chr_table[(x)].call == call)
2312               {
2313                  state->m_init_col = x;
2314                  LOG_CHR_FULL(("BwB Characteriser init column %02X\n",state->m_init_col));
2315                  break;
2316               }
2317            }
2318         }
2395         state->m_chr_state=1;
2396         state->m_chr_counter=0;
23192397      }
2398      if (call == 0)
2399      {
2400         state->m_init_col ++;
2401      }
2402      else
2403      {
2404         state->m_init_col =0;
2405      }
23202406   }
2321   else
2407
2408   state->m_chr_value = space->machine().rand();
2409   for (x = 0; x < 4; x++)
23222410   {
2323      for (x = state->m_prot_col; x < 64;)
2411      if   (state->m_current_chr_table[(x)].call == call)
23242412      {
2325         x++;
2326         if   (state->m_current_chr_table[(x)].call == call)
2413         if (x == 0) // reinit
23272414         {
2328            state->m_prot_col = x;
2329            LOG_CHR(("BwB Characteriser init column %02X\n",state->m_prot_col));
2330            break;
2415            state->m_bwb_return = 0;
23312416         }
2417         state->m_chr_value = bwb_chr_table_common[(state->m_bwb_return)];
2418         state->m_bwb_return++;
2419         break;
23322420      }
23332421   }
23342422}
r11224r11225
23362424static READ8_HANDLER( bwb_characteriser_r )
23372425{
23382426   mpu4_state *state = space->machine().driver_data<mpu4_state>();
2339   if (!state->m_current_chr_table)
2340      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
23412427
23422428   LOG_CHR(("Characteriser read offset %02X \n",offset));
23432429
23442430
23452431   if (offset ==0)
23462432   {
2347      LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_init_col].response));
2348      return state->m_current_chr_table[state->m_init_col].response;
2433      switch (state->m_chr_counter)
2434      {
2435         case 6:
2436         case 13:
2437         case 20:
2438         case 27:
2439         case 34:
2440         {
2441            return state->m_bwb_chr_table1[(((state->m_chr_counter + 1) / 7) - 1)].response;
2442            break;
2443         }
2444         default:
2445         {
2446            if (state->m_chr_counter > 34)
2447            {
2448               state->m_chr_counter = 35;
2449               state->m_chr_state = 2;
2450            }
2451            state->m_chr_counter ++;
2452            return state->m_chr_value;
2453         }
2454      }
23492455   }
23502456   else
23512457   {
2352      LOG_CHR(("Characteriser read BwB data %02X \n",state->m_current_chr_table[state->m_prot_col].response));
2353      return state->m_current_chr_table[state->m_prot_col].response;
2458      return state->m_chr_value;
23542459   }
23552460}
23562461
r11224r11225
24022507{0x00, 0x00},{0x01, 0x00},{0x04, 0x00},{0x09, 0x00},{0x10, 0x00},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00}
24032508};
24042509
2405static const mpu4_chr_table blsbys_data[72] = {
2406{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x2e, 0x36},{0x20, 0x42},
2407{0x0f, 0x27},{0x24, 0x42},{0x3c, 0x09},{0x2c, 0x01},{0x01, 0x1d},{0x1d, 0x40},{0x40, 0xd2},{0xd2, 0x01},
2408{0x01, 0xf9},{0xb1, 0x41},{0x41, 0x1c},{0x1c, 0x01},{0x01, 0xf9},{0x04, 0x54},{0x54, 0x02},{0x02, 0x00},
2409{0x00, 0x00},{0x00, 0x2e},{0x2e, 0x20},{0x20, 0x0f},{0x0f, 0x24},{0x24, 0x3c},{0x3c, 0x39},{0x3c, 0xc9},
2410{0xc9, 0x05},{0x05, 0x04},{0x04, 0x54},{0x54, 0x02},{0x02, 0x00},{0x00, 0x00},{0x00, 0x2e},{0x2e, 0x20},
2411{0x20, 0x0f},{0x0f, 0x24},{0x24, 0x3c},{0x3c, 0x39},{0x3c, 0x36},{0x36, 0x00},{0x42, 0x04},{0x27, 0x04},
2412{0x42, 0x0c},{0x09, 0x0c},{0x42, 0x1c},{0x27, 0x14},{0x42, 0x2c},{0x42, 0x5c},{0x09, 0x2c},
2413//All this may be garbage - it never gets called, but is in the ROM (?)
2414{0x0A, 0x00},
2415{0x31, 0x20},{0x34, 0x90}, {0x1e, 0x40},{0x04, 0x90},{0x01, 0xe4},{0x0c, 0xf4},{0x18, 0x64},{0x19, 0x10},
2416{0x00, 0x00},{0x01, 0x00},{0x04, 0x00},{0x09, 0x00},{0x10, 0x00},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00}
2510static const bwb_chr_table blsbys_data1[5] = {
2511//Magic number 724A
2512
2513// PAL Codes
2514// 0   1   2  3  4  5  6  7  8
2515// ??  ?? 20 0F 24 3C 36 27 09
2516
2517   {0x67},{0x17},{0x0f},{0x24},{0x3c},
24172518};
24182519
2520static const mpu4_chr_table blsbys_data[8] = {
2521{0xEF, 0x02},{0x81, 0x00},{0xCE, 0x00},{0x00, 0x2e},
2522{0x06, 0x20},{0xC6, 0x0f},{0xF8, 0x24},{0x8E, 0x3c},
2523};
2524
24192525// set percentage and other options. 2e 20 0f
24202526// PAL Codes
24212527// 0   1   2  3  4  5  6  7  8
r11224r11225
24652571   mpu4_state *state = machine.driver_data<mpu4_state>();
24662572   state->m_reel_mux=FIVE_REEL_5TO8;
24672573   state->m_lamp_extender=SMALL_CARD;
2468   // setup 5 default 96 half step reels with the mux board
2469   mpu4_config_common_reels(machine,5);
2574   // setup 4 default 96 half step reels with the mux board
2575   mpu4_config_common_reels(machine,4);
2576   stepper_config(machine, 4, &barcrest_reelrev_interface);
24702577   state->m_current_chr_table = grtecp_data;
24712578}
24722579
r11224r11225
24812588   stepper_config(machine, 2, &bwb_opto1_interface);
24822589   stepper_config(machine, 3, &bwb_opto1_interface);
24832590   stepper_config(machine, 4, &bwb_opto1_interface);
2591   state->m_bwb_chr_table1 = blsbys_data1;
24842592   state->m_current_chr_table = blsbys_data;
24852593}
24862594
r11224r11225
25172625   state->m_signal_50hz = state->m_signal_50hz?0:1;
25182626   pia6821_ca1_w(timer.machine().device("pia_ic4"), state->m_signal_50hz);   /* signal is connected to IC4 CA1 */
25192627
2520   if (state->m_signal_50hz)
2521   {
2522      update_meters(state);
2523   }
2628   update_meters(state);//run at 100Hz to sync with PIAs
25242629}
25252630
25262631static ADDRESS_MAP_START( mod2_memmap, AS_PROGRAM, 8 )
r11224r11225
25992704   AM_RANGE(0x0850, 0x0850) AM_WRITE(bankswitch_w)   // write bank (rom page select)
26002705
26012706   AM_RANGE(0x0858, 0x0858) AM_WRITE(bankswitch_w)   // write bank (rom page select)
2707   AM_RANGE(0x0878, 0x0878) AM_WRITE(bankset_w)   // write bank (rom page select)
26022708   AM_RANGE(0x0880, 0x0883) AM_DEVREADWRITE("pia_ic4ss", pia6821_r,pia6821_w)      // PIA6821 on sampled sound board
26032709
26042710   AM_RANGE(0x08c0, 0x08c7) AM_DEVREADWRITE("ptm_ic3ss", ptm6840_read, ptm6840_write)  // 6840PTM on sampled sound board
r11224r11225
27712877ROM_END
27722878
27732879ROM_START( m_blsbys )
2774   ROM_REGION( 0x40000, "maincpu", 0 )
2880   ROM_REGION( 0x80000, "maincpu", 0 )
27752881   ROM_LOAD("bbprog.bin",  0x00000, 0x20000,  CRC(c262cfda) SHA1(f004895e0dd3f8420683927915554e19e41bd20b))
2882   ROM_RELOAD(0x40000,0x20000)
27762883
27772884   ROM_REGION( 0x200000, "msm6376", 0 )
27782885   ROM_LOAD( "bbsnd.p1",  0x000000, 0x080000,  CRC(715c9e95) SHA1(6a0c9c63e56cfc21bf77cf29c1b844b8e0844c1e) )
src/mame/drivers/viper.c
r11224r11225
3737
3838*/
3939
40/*
41    Software notes (as per Police 911)
42    -- VL - 22.02.2010
43
44    IRQs:
45
46    IRQ0: ???               (Task 4)
47    IRQ1: unused
48    IRQ2: unused
49    IRQ3: ???               (Task 5, sound?)
50    IRQ4: Voodoo3           Currently only for User Interrupt Command, maybe a more extensive handler gets installed later?
51
52    I2C:  ???               (no task switch) what drives this? network?
53    DMA0: unused
54    DMA1: unused
55    IIVPR3: unused
56
57    Memory:
58
59    0x000001E0:             Current task
60    0x000001E1:             Current FPU task
61    0x000001E4:             Scheduled tasks bitvector (bit 31 = task0, etc.)
62    0x00000A00...BFF:       Task structures
63                            0x00-03:    unknown
64                            0x04:       unknown
65                            0x05:       if non-zero, this task uses FPU
66                            0x06-07:    unknown
67                            0x08:       unknown mem pointer, task stack pointer?
68                            0x0c:       pointer to task PC (also top of stack?)
69
70
71    0x00000310:             Global timer 0 IRQ handler
72    0x00000320:             Global timer 1 IRQ handler
73    0x00000330:             Global timer 2 IRQ handler
74    0x00000340:             Global timer 3 IRQ handler
75    0x00000350:             IRQ0 handler
76    0x00000360:             IRQ1 handler
77    0x00000370:             IRQ2 handler
78    0x00000380:             IRQ3 handler
79    0x00000390:             IRQ4 handler
80    0x000003a0:             I2C IRQ handler
81    0x000003b0:             DMA0 IRQ handler
82    0x000003c0:             DMA1 IRQ handler
83    0x000003d0:             Message Unit IRQ handler
84
85    0x000004e4:             Global timer 0 IRQ handler function ptr
86    0x000004e8:             Global timer 1 IRQ handler function ptr
87    0x000004ec:             Global timer 2 IRQ handler function ptr
88    0x000004f0:             Global timer 3 IRQ handler function ptr
89
90
91    Functions of interest:
92
93    0x0000f7b4:     SwitchTask()
94    0x00009d00:     LoadProgram(): R3 = ptr to filename
95*/
96
4097#include "emu.h"
4198#include "cpu/powerpc/ppc.h"
4299#include "machine/pci.h"
43100#include "memconv.h"
101#include "devconv.h"
44102#include "machine/idectrl.h"
45103#include "machine/timekpr.h"
46104#include "video/voodoo.h"
47105
106#define VIPER_DEBUG_LOG
48107
108static SCREEN_UPDATE(viper)
109{
110   device_t *device = screen->machine().device("voodoo");
111   return voodoo_update(device, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
112}
113
49114class viper_state : public driver_device
50115{
51116public:
52117   viper_state(running_machine &machine, const driver_device_config_base &config)
53118      : driver_device(machine, config) { }
54119
55   UINT32 m_mpc8240_regs[256/4];
120
56121   UINT32 m_epic_iack;
57122   int m_cf_card_ide;
58123   int m_unk1_bit;
59124   UINT32 m_voodoo3_pci_reg[0x100];
125
60126};
61127
128UINT32 m_mpc8240_regs[256/4];
62129
63//#define VIPER_DEBUG_LOG
64
65static SCREEN_UPDATE(viper)
66{
67   device_t *device = screen->machine().device("voodoo");
68   return voodoo_update(device, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
69}
70
71
72130/*****************************************************************************/
73131
74132static UINT32 mpc8240_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
75133{
76   viper_state *state = device->machine().driver_data<viper_state>();
134// device is null?
135//  viper_state *state = device->machine().driver_data<viper_state>();
77136   #ifdef VIPER_DEBUG_LOG
78   printf("MPC8240: PCI read %d, %02X, %08X\n", function, reg, mem_mask);
137//  printf("MPC8240: PCI read %d, %02X, %08X\n", function, reg, mem_mask);
79138   #endif
80139
81140   switch (reg)
82141   {
83142   }
84
85   return state->m_mpc8240_regs[reg/4];
143   return m_mpc8240_regs[reg/4];
144   //return state->m_mpc8240_regs[reg/4];
86145}
87146
88147static void mpc8240_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask)
89148{
90   viper_state *state = device->machine().driver_data<viper_state>();
149// device is null?
150//  viper_state *state = device->machine().driver_data<viper_state>();
91151   #ifdef VIPER_DEBUG_LOG
92   printf("MPC8240: PCI write %d, %02X, %08X, %08X\n", function, reg, data, mem_mask);
152//  printf("MPC8240: PCI write %d, %02X, %08X, %08X\n", function, reg, data, mem_mask);
93153   #endif
94
95   COMBINE_DATA(state->m_mpc8240_regs + (reg/4));
154   COMBINE_DATA(m_mpc8240_regs + (reg/4));
155   //COMBINE_DATA(state->m_mpc8240_regs + (reg/4));
96156}
97157
98158
99159static READ64_DEVICE_HANDLER( pci_config_addr_r )
100160{
101   return pci_64be_r(device, 0, U64(0x00000000ffffffff));
161   return pci_64be_r(device, 0, U64(0xffffffff00000000));
102162}
103163
104164static WRITE64_DEVICE_HANDLER( pci_config_addr_w )
105165{
106   pci_64be_w(device, 0, data, U64(0x00000000ffffffff));
166   pci_64be_w(device, 0, data, U64(0xffffffff00000000));
107167}
108168
109169static READ64_DEVICE_HANDLER( pci_config_data_r )
110170{
111   return pci_64be_r(device, 1, U64(0xffffffff00000000)) << 32;
171   return pci_64be_r(device, 1, U64(0x00000000ffffffff)) << 32;
112172}
113173
114174static WRITE64_DEVICE_HANDLER( pci_config_data_w )
115175{
116   pci_64be_w(device, 1, data >> 32, U64(0xffffffff00000000));
176   pci_64be_w(device, 1, data >> 32, U64(0x00000000ffffffff));
117177}
118178
119179
120180
181/*****************************************************************************/
182// MPC8240 Embedded Programmable Interrupt Controller (EPIC)
121183
184#define MPC8240_IRQ0            0
185#define MPC8240_IRQ1            1
186#define MPC8240_IRQ2            2
187#define MPC8240_IRQ3            3
188#define MPC8240_IRQ4            4
189#define MPC8240_IRQ5            5
190#define MPC8240_IRQ6            6
191#define MPC8240_IRQ7            7
192#define MPC8240_IRQ8            8
193#define MPC8240_IRQ9            9
194#define MPC8240_IRQ10            10
195#define MPC8240_IRQ11            11
196#define MPC8240_IRQ12            12
197#define MPC8240_IRQ13            13
198#define MPC8240_IRQ14            14
199#define MPC8240_IRQ15            15
200#define MPC8240_I2C_IRQ            16
201#define MPC8240_DMA0_IRQ         17
202#define MPC8240_DMA1_IRQ         18
203#define MPC8240_MSG_IRQ            19
204#define MPC8240_GTIMER0_IRQ         20
205#define MPC8240_GTIMER1_IRQ         21
206#define MPC8240_GTIMER2_IRQ         22
207#define MPC8240_GTIMER3_IRQ         23
208
209#define MPC8240_NUM_INTERRUPTS      24
210
211
212typedef struct
213{
214   UINT32 vector;
215   int priority;
216   int destination;
217   int active;
218   int pending;
219   int mask;
220} MPC8240_IRQ;
221
222
223
224typedef struct
225{
226   UINT32 iack;
227   UINT32 eicr;
228   UINT32 svr;
229
230   int active_irq;
231
232   MPC8240_IRQ irq[MPC8240_NUM_INTERRUPTS];
233
234} MPC8240_EPIC;
235
236
237static MPC8240_EPIC epic;
238
239
240static void epic_update_interrupts(running_machine &machine)
241{
242   int i;
243
244   int irq = -1;
245   int priority = -1;
246
247   // find the highest priority pending interrupt
248   for (i=MPC8240_NUM_INTERRUPTS-1; i >= 0; i--)
249   {
250      if (epic.irq[i].pending)
251      {
252         if (epic.irq[i].priority > priority)
253         {
254            irq = i;
255            priority = epic.irq[i].priority;
256         }
257      }
258   }
259
260   if (irq >= 0 && epic.active_irq == -1)
261   {
262      printf("EPIC IRQ%d taken\n", irq);
263
264      epic.active_irq = irq;
265      epic.irq[epic.active_irq].pending = 0;
266      epic.irq[epic.active_irq].active = 1;
267
268      epic.iack = epic.irq[epic.active_irq].vector;
269
270      printf("vector = %02X\n", epic.iack);
271
272      cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE);
273   }
274   else
275   {
276      cputag_set_input_line(machine, "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE);
277   }
278}
279
122280static READ32_HANDLER( epic_r )
123281{
124   viper_state *state = space->machine().driver_data<viper_state>();
125282   int reg;
126283   reg = offset * 4;
127284
128   #ifdef VIPER_DEBUG_LOG
129   printf("EPIC: read %08X, %08X at %08X\n", reg, mem_mask, cpu_get_pc(&space->device()));
130   #endif
285   //printf("EPIC: read %08X, %08X at %08X\n", reg, mem_mask, activecpu_get_pc());
131286
132287   switch (reg >> 16)
133288   {
289      // 0x50000 - 0x5FFFF
290      case 0x5:
291      {
292         switch (reg & 0xffff)
293         {
294            case 0x0200:         // Offset 0x50200 - IRQ0 vector/priority register
295            case 0x0220:         // Offset 0x50220 - IRQ1 vector/priority register
296            case 0x0240:         // Offset 0x50240 - IRQ2 vector/priority register
297            case 0x0260:         // Offset 0x50260 - IRQ3 vector/priority register
298            case 0x0280:         // Offset 0x50280 - IRQ4 vector/priority register
299            case 0x02a0:         // Offset 0x502a0 - IRQ5 vector/priority register
300            case 0x02c0:         // Offset 0x502c0 - IRQ6 vector/priority register
301            case 0x02e0:         // Offset 0x502e0 - IRQ7 vector/priority register
302            case 0x0300:         // Offset 0x50300 - IRQ8 vector/priority register
303            case 0x0320:         // Offset 0x50320 - IRQ9 vector/priority register
304            case 0x0340:         // Offset 0x50340 - IRQ10 vector/priority register
305            case 0x0360:         // Offset 0x50360 - IRQ11 vector/priority register
306            case 0x0380:         // Offset 0x50380 - IRQ12 vector/priority register
307            case 0x03a0:         // Offset 0x503a0 - IRQ13 vector/priority register
308            case 0x03c0:         // Offset 0x503c0 - IRQ14 vector/priority register
309            case 0x03e0:         // Offset 0x503e0 - IRQ15 vector/priority register
310            {
311               int irq = ((reg & 0xffff) - 0x200) >> 5;
312               int value = 0;
313
314               value |= epic.irq[MPC8240_IRQ0 + irq].mask ? 0x80000000 : 0;
315               value |= epic.irq[MPC8240_IRQ0 + irq].priority << 16;
316               value |= epic.irq[MPC8240_IRQ0 + irq].vector;
317               value |= epic.irq[MPC8240_IRQ0 + irq].active ? 0x40000000 : 0;
318
319               return value;
320            }
321         }
322         break;
323      }
324
134325      // 0x60000 - 0x6FFFF
135326      case 0x6:
136327      {
137328         switch (reg & 0xffff)
138329         {
139            case 0x00a0:         // IACK
140               return state->m_epic_iack;
330            case 0x00a0:         // Offset 0x600A0 - IACK
331            {
332               epic_update_interrupts(space->machine());
141333
334               if (epic.active_irq >= 0)
335               {
336                  return epic.iack;
337               }
338               else
339               {
340                  // spurious vector register is returned if no pending interrupts
341                  return epic.svr;
342               }
343            }
344
142345         }
143346         break;
144347      }
r11224r11225
149352
150353static WRITE32_HANDLER( epic_w )
151354{
152   viper_state *state = space->machine().driver_data<viper_state>();
153355   int reg;
154356   reg = offset * 4;
155357
156   #ifdef VIPER_DEBUG_LOG
157358   printf("EPIC: write %08X, %08X, %08X at %08X\n", data, reg, mem_mask, cpu_get_pc(&space->device()));
158   #endif
159359
160360   switch (reg >> 16)
161361   {
362      // 0x40000 - 0x4FFFF
363      case 4:
364      {
365         switch (reg & 0xffff)
366         {
367            case 0x1030:         // Offset 0x41030 - EICR
368            {
369               epic.eicr = data;
370               if (data & 0x08000000)
371                  fatalerror("EPIC: serial interrupts mode not implemented");
372               break;
373            }
374            case 0x10e0:         // Offset 0x410E0 - Spurious Vector Register
375            {
376               epic.svr = data;
377               break;
378            }
379            case 0x1120:         // Offset 0x41120 - Global timer 0 vector/priority register
380            case 0x1160:         // Offset 0x41160 - Global timer 1 vector/priority register
381            case 0x11a0:         // Offset 0x411A0 - Global timer 2 vector/priority register
382            case 0x11e0:         // Offset 0x411E0 - Global timer 3 vector/priority register
383            {
384               int timer = ((reg & 0xffff) - 0x1120) >> 6;
385
386               epic.irq[MPC8240_GTIMER0_IRQ + timer].mask = (data & 0x80000000) ? 1 : 0;
387               epic.irq[MPC8240_GTIMER0_IRQ + timer].priority = (data >> 16) & 0xf;
388               epic.irq[MPC8240_GTIMER0_IRQ + timer].vector = data & 0xff;
389               break;
390            }
391            case 0x1130:         // Offset 0x41130 - Global timer 0 destination register
392            case 0x1170:         // Offset 0x41170 - Global timer 1 destination register
393            case 0x11b0:         // Offset 0x411B0 - Global timer 2 destination register
394            case 0x11f0:         // Offset 0x411F0 - Global timer 3 destination register
395            {
396               int timer = ((reg & 0xffff) - 0x1130) >> 6;
397
398               epic.irq[MPC8240_GTIMER0_IRQ + timer].destination = data & 0x1;
399               break;
400            }
401         }
402         break;
403      }
404
405      // 0x50000 - 0x5FFFF
406      case 0x5:
407      {
408         switch (reg & 0xffff)
409         {
410            case 0x0200:         // Offset 0x50200 - IRQ0 vector/priority register
411            case 0x0220:         // Offset 0x50220 - IRQ1 vector/priority register
412            case 0x0240:         // Offset 0x50240 - IRQ2 vector/priority register
413            case 0x0260:         // Offset 0x50260 - IRQ3 vector/priority register
414            case 0x0280:         // Offset 0x50280 - IRQ4 vector/priority register
415            case 0x02a0:         // Offset 0x502a0 - IRQ5 vector/priority register
416            case 0x02c0:         // Offset 0x502c0 - IRQ6 vector/priority register
417            case 0x02e0:         // Offset 0x502e0 - IRQ7 vector/priority register
418            case 0x0300:         // Offset 0x50300 - IRQ8 vector/priority register
419            case 0x0320:         // Offset 0x50320 - IRQ9 vector/priority register
420            case 0x0340:         // Offset 0x50340 - IRQ10 vector/priority register
421            case 0x0360:         // Offset 0x50360 - IRQ11 vector/priority register
422            case 0x0380:         // Offset 0x50380 - IRQ12 vector/priority register
423            case 0x03a0:         // Offset 0x503a0 - IRQ13 vector/priority register
424            case 0x03c0:         // Offset 0x503c0 - IRQ14 vector/priority register
425            case 0x03e0:         // Offset 0x503e0 - IRQ15 vector/priority register
426            {
427               int irq = ((reg & 0xffff) - 0x200) >> 5;
428
429               epic.irq[MPC8240_IRQ0 + irq].mask = (data & 0x80000000) ? 1 : 0;
430               epic.irq[MPC8240_IRQ0 + irq].priority = (data >> 16) & 0xf;
431               epic.irq[MPC8240_IRQ0 + irq].vector = data & 0xff;
432               break;
433            }
434            case 0x0210:         // Offset 0x50210 - IRQ0 destination register
435            case 0x0230:         // Offset 0x50230 - IRQ1 destination register
436            case 0x0250:         // Offset 0x50250 - IRQ2 destination register
437            case 0x0270:         // Offset 0x50270 - IRQ3 destination register
438            case 0x0290:         // Offset 0x50290 - IRQ4 destination register
439            case 0x02b0:         // Offset 0x502b0 - IRQ5 destination register
440            case 0x02d0:         // Offset 0x502d0 - IRQ6 destination register
441            case 0x02f0:         // Offset 0x502f0 - IRQ7 destination register
442            case 0x0310:         // Offset 0x50310 - IRQ8 destination register
443            case 0x0330:         // Offset 0x50330 - IRQ9 destination register
444            case 0x0350:         // Offset 0x50350 - IRQ10 destination register
445            case 0x0370:         // Offset 0x50370 - IRQ11 destination register
446            case 0x0390:         // Offset 0x50390 - IRQ12 destination register
447            case 0x03b0:         // Offset 0x503b0 - IRQ13 destination register
448            case 0x03d0:         // Offset 0x503d0 - IRQ14 destination register
449            case 0x03f0:         // Offset 0x503f0 - IRQ15 destination register
450            {
451               int irq = ((reg & 0xffff) - 0x210) >> 5;
452
453               epic.irq[MPC8240_IRQ0 + irq].destination = data & 0x1;
454               break;
455            }
456         }
457         break;
458      }
459
162460      // 0x60000 - 0x6FFFF
163461      case 0x6:
164462      {
165463         switch (reg & 0xffff)
166464         {
167            case 0x00b0:         // EOI
168               state->m_epic_iack = 0xff;
465            case 0x00b0:         // Offset 0x600B0 - EOI
466               printf("EPIC IRQ%d cleared.\n", epic.active_irq);
467               epic.irq[epic.active_irq].active = 0;
468               epic.active_irq = -1;
469
470               epic_update_interrupts(space->machine());
169471               break;
170472         }
171473         break;
r11224r11225
183485}
184486
185487
488static void mpc8240_interrupt(running_machine &machine, int irq)
489{
490   if (epic.irq[irq].mask == 0 && epic.irq[irq].priority > 0)
491   {
492      epic.irq[irq].pending = 1;
186493
494      epic_update_interrupts(machine);
495   }
496}
497
498static void mpc8240_epic_reset(void)
499{
500   int i;
501
502   for (i=0; i < MPC8240_NUM_INTERRUPTS; i++)
503   {
504      epic.irq[i].mask = 1;
505   }
506
507   epic.active_irq = -1;
508}
509
510/*****************************************************************************/
511
512
187513static const UINT8 cf_card_tuples[] =
188514{
189515   0x01,      // Device Tuple
r11224r11225
243569static READ64_DEVICE_HANDLER(cf_card_r)
244570{
245571   viper_state *state = device->machine().driver_data<viper_state>();
572
246573   UINT64 r = 0;
247574
248575   if (ACCESSING_BITS_16_31)
r11224r11225
289616      {
290617         int reg = offset;
291618
292         //printf("cf_r: %04X\n", reg);
619         printf("cf_r: %04X\n", reg);
293620
294621         if ((reg >> 1) < sizeof(cf_card_tuples))
295622         {
r11224r11225
307634static WRITE64_DEVICE_HANDLER(cf_card_w)
308635{
309636   viper_state *state = device->machine().driver_data<viper_state>();
637
310638   #ifdef VIPER_DEBUG_LOG
311   printf("%s:compact_flash_w: %08X%08X, %08X, %08X%08X\n", device->machine().describe_context(), (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
639   //printf("%s:compact_flash_w: %08X%08X, %08X, %08X%08X\n", device->machine().describe_context(), (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
312640   #endif
313641
314642   if (ACCESSING_BITS_16_31)
r11224r11225
368696                  // cylinder high register is set to 0x00
369697
370698                  ide_bus_w(device, 1, 6, 0x04);
699
700                  ide_bus_w(device, 0, 2, 0x01);
701                  ide_bus_w(device, 0, 3, 0x01);
702                  ide_bus_w(device, 0, 4, 0x00);
703                  ide_bus_w(device, 0, 5, 0x00);
371704               }
372705               break;
373706            }
r11224r11225
383716static WRITE64_HANDLER(unk2_w)
384717{
385718   viper_state *state = space->machine().driver_data<viper_state>();
719
386720   if (ACCESSING_BITS_56_63)
387721   {
388722      state->m_cf_card_ide = 0;
r11224r11225
416750   }
417751}
418752
753
419754static READ64_HANDLER(unk1_r)
420755{
421756   viper_state *state = space->machine().driver_data<viper_state>();
757
422758   UINT64 r = 0;
423759   //return 0;//U64(0x0000400000000000);
424760
425761   if (ACCESSING_BITS_40_47)
426762   {
427763      r |= (UINT64)(state->m_unk1_bit << 5) << 40;
764      r |= U64(0x0000400000000000);
428765   }
429766
430767   return r;
r11224r11225
433770static WRITE64_HANDLER(unk1a_w)
434771{
435772   viper_state *state = space->machine().driver_data<viper_state>();
773
436774   if (ACCESSING_BITS_56_63)
437775   {
438776      state->m_unk1_bit = 1;
r11224r11225
442780static WRITE64_HANDLER(unk1b_w)
443781{
444782   viper_state *state = space->machine().driver_data<viper_state>();
783
445784   if (ACCESSING_BITS_56_63)
446785   {
447786      state->m_unk1_bit = 0;
448787   }
449788}
450789
790
451791static UINT32 voodoo3_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
452792{
453793   viper_state *state = device->machine().driver_data<viper_state>();
794
454795   switch (reg)
455796   {
456797      case 0x00:      // PCI Vendor ID (0x121a = 3dfx), Device ID (0x0005 = Voodoo 3)
r11224r11225
491832static void voodoo3_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask)
492833{
493834   viper_state *state = device->machine().driver_data<viper_state>();
835
494836//  printf("voodoo3_pci_w: %08X, %08X\n", reg, data);
495837
496838   switch (reg)
r11224r11225
556898   }
557899}
558900
559#if 0
560901static READ64_HANDLER(voodoo3_io_r)
561902{
562   return read64be_with_32le_handler(banshee_io_0_r, space->machine(), offset, mem_mask);
903   device_t *device = space->machine().device("voodoo");
904   return read64be_with_32le_device_handler(banshee_io_r, device, offset, mem_mask);
563905}
564906static WRITE64_HANDLER(voodoo3_io_w)
565907{
566908//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
567   write64be_with_32le_handler(banshee_io_0_w, space->machine(), offset, data, mem_mask);
909
910   device_t *device = space->machine().device("voodoo");
911   write64be_with_32le_device_handler(banshee_io_w, device, offset, data, mem_mask);
568912}
569913
570914static READ64_HANDLER(voodoo3_r)
571915{
572   return read64be_with_32le_handler(banshee_0_r, space->machine(), offset, mem_mask);
916   device_t *device = space->machine().device("voodoo");
917   return read64be_with_32le_device_handler(banshee_r, device, offset, mem_mask);
573918}
574919static WRITE64_HANDLER(voodoo3_w)
575920{
576921//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
577   write64be_with_32le_handler(banshee_0_w, space->machine(),  offset, data, mem_mask);
922
923   device_t *device = space->machine().device("voodoo");
924   write64be_with_32le_device_handler(banshee_w, device,  offset, data, mem_mask);
578925}
579926
580927static READ64_HANDLER(voodoo3_lfb_r)
581928{
582   return read64be_with_32le_handler(banshee_fb_0_r, space->machine(), offset, mem_mask);
929   device_t *device = space->machine().device("voodoo");
930   return read64be_with_32le_device_handler(banshee_fb_r, device, offset, mem_mask);
583931}
584932static WRITE64_HANDLER(voodoo3_lfb_w)
585933{
586934//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space->device()));
587   write64be_with_32le_handler(banshee_fb_0_w, space->machine(), offset, data, mem_mask);
935
936   device_t *device = space->machine().device("voodoo");
937   write64be_with_32le_device_handler(banshee_fb_w, device, offset, data, mem_mask);
588938}
589#endif
590939
591940
592941/*****************************************************************************/
r11224r11225
594943static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64)
595944   AM_RANGE(0x00000000, 0x00ffffff) AM_MIRROR(0x1000000) AM_RAM
596945   AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE(epic_64be_r, epic_64be_w)
597   AM_RANGE(0x82000000, 0x83ffffff) AM_DEVREADWRITE32("voodoo", banshee_r, banshee_w, U64(0xffffffffffffffff))
598   AM_RANGE(0x84000000, 0x85ffffff) AM_DEVREADWRITE32("voodoo", banshee_fb_r, banshee_fb_w, U64(0xffffffffffffffff))
599   AM_RANGE(0xfe800000, 0xfe8000ff) AM_DEVREADWRITE32("voodoo", banshee_io_r, banshee_io_w, U64(0xffffffffffffffff))
946//  AM_RANGE(0x82000000, 0x83ffffff) AM_DEVREADWRITE32("voodoo", banshee_r, banshee_w, U64(0xffffffffffffffff))
947//  AM_RANGE(0x84000000, 0x85ffffff) AM_DEVREADWRITE32("voodoo", banshee_fb_r, banshee_fb_w, U64(0xffffffffffffffff))
948//  AM_RANGE(0xfe800000, 0xfe8000ff) AM_DEVREADWRITE32("voodoo", banshee_io_r, banshee_io_w, U64(0xffffffffffffffff))
949   AM_RANGE(0x82000000, 0x83ffffff) AM_READWRITE(voodoo3_r, voodoo3_w)
950   AM_RANGE(0x84000000, 0x85ffffff) AM_READWRITE(voodoo3_lfb_r, voodoo3_lfb_w)
951   AM_RANGE(0xfe800000, 0xfe8000ff) AM_READWRITE(voodoo3_io_r, voodoo3_io_w)
600952   AM_RANGE(0xfec00000, 0xfedfffff) AM_DEVREADWRITE("pcibus", pci_config_addr_r, pci_config_addr_w)
601953   AM_RANGE(0xfee00000, 0xfeefffff) AM_DEVREADWRITE("pcibus", pci_config_data_r, pci_config_data_w)
954   // 0xff000000, 0xff000fff - cf_card_data_r/w (installed in DRIVER_INIT(vipercf))
955   // 0xff200000, 0xff200fff - cf_card_r/w (installed in DRIVER_INIT(vipercf))
602956   AM_RANGE(0xff300000, 0xff300fff) AM_DEVREADWRITE("ide", ata_r, ata_w)
603957   AM_RANGE(0xffe10000, 0xffe10007) AM_READ(unk1_r)
604958   AM_RANGE(0xffe30000, 0xffe31fff) AM_DEVREADWRITE8("m48t58",timekeeper_r, timekeeper_w, U64(0xffffffffffffffff))
r11224r11225
624978
625979static INTERRUPT_GEN(viper_vblank)
626980{
981   mpc8240_interrupt(device->machine(), MPC8240_IRQ0);
982   //mpc8240_interrupt(device->machine, MPC8240_IRQ3);
983}
627984
985static void voodoo_vblank(const device_config *device, int param)
986{
987   //mpc8240_interrupt(device->machine, MPC8240_IRQ4);
628988}
629989
630990static void ide_interrupt(device_t *device, int state)
r11224r11225
634994static MACHINE_RESET(viper)
635995{
636996   devtag_reset(machine, "ide");
997   mpc8240_epic_reset();
637998}
638999
1000
1001
1002
6391003static MACHINE_CONFIG_START( viper, viper_state )
6401004
6411005   /* basic machine hardware */
r11224r11225
6471011   MCFG_MACHINE_RESET(viper)
6481012
6491013   MCFG_PCI_BUS_ADD("pcibus", 0)
650   MCFG_PCI_BUS_DEVICE(0, NULL, mpc8240_pci_r, mpc8240_pci_w)
1014   MCFG_PCI_BUS_DEVICE(0, "mpc8240", mpc8240_pci_r, mpc8240_pci_w)
6511015   MCFG_PCI_BUS_DEVICE(12, "voodoo", voodoo3_pci_r, voodoo3_pci_w)
6521016
6531017   MCFG_IDE_CONTROLLER_ADD("ide", ide_interrupt)
6541018   MCFG_3DFX_VOODOO_3_ADD("voodoo", STD_VOODOO_3_CLOCK, 16, "screen")
6551019   MCFG_3DFX_VOODOO_CPU("maincpu")
1020   MCFG_3DFX_VOODOO_VBLANK(voodoo_vblank)
6561021
6571022   /* video hardware */
6581023   MCFG_SCREEN_ADD("screen", RASTER)
r11224r11225
6601025   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
6611026   MCFG_SCREEN_SIZE(800, 600)
6621027   MCFG_SCREEN_VISIBLE_AREA(0, 799, 0, 599)
663   MCFG_SCREEN_UPDATE(viper)
6641028
6651029   MCFG_PALETTE_LENGTH(65536)
6661030
1031   MCFG_SCREEN_UPDATE(viper)
1032
6671033   /* sound hardware */
6681034   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
6691035
src/mame/drivers/model2.c
r11224r11225
13731373
13741374   AM_RANGE(0x00f00000, 0x00f0000f) AM_READWRITE(timers_r, timers_w)
13751375
1376   AM_RANGE(0x01000000, 0x0100ffff) AM_READWRITE(sys24_tile32_r, sys24_tile32_w) AM_MIRROR(0x100000)
1376   AM_RANGE(0x01000000, 0x0100ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile32_r, tile32_w) AM_MIRROR(0x110000)
13771377   AM_RANGE(0x01020000, 0x01020003) AM_WRITENOP AM_MIRROR(0x100000)      // Unknown, always 0
13781378   AM_RANGE(0x01040000, 0x01040003) AM_WRITENOP AM_MIRROR(0x100000)      // Horizontal synchronization register
13791379   AM_RANGE(0x01060000, 0x01060003) AM_WRITENOP AM_MIRROR(0x100000)      // Vertical synchronization register
13801380   AM_RANGE(0x01070000, 0x01070003) AM_WRITENOP AM_MIRROR(0x100000)      // Video synchronization switch
1381   AM_RANGE(0x01080000, 0x010fffff) AM_READWRITE(sys24_char32_r, sys24_char32_w) AM_MIRROR(0x100000)
1382   AM_RANGE(0x01100000, 0x0110ffff) AM_READWRITE(sys24_tile32_r, sys24_tile32_w) AM_MIRROR(0x10000)
1383   AM_RANGE(0x01180000, 0x011fffff) AM_READWRITE(sys24_char32_r, sys24_char32_w) AM_MIRROR(0x100000)
1381   AM_RANGE(0x01080000, 0x010fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char32_r, char32_w) AM_MIRROR(0x100000)
13841382
13851383   AM_RANGE(0x01800000, 0x01803fff) AM_RAM_WRITE(pal32_w) AM_BASE_MEMBER(model2_state, m_paletteram32)
13861384   AM_RANGE(0x01810000, 0x0181bfff) AM_RAM AM_BASE_MEMBER(model2_state, m_colorxlat)
r11224r11225
20282026   MCFG_TIMER_ADD("timer3", model2_timer_cb)
20292027   MCFG_TIMER_PTR((FPTR)3)
20302028
2029   MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
2030
20312031   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
20322032
20332033   MCFG_SCREEN_ADD("screen", RASTER)
r11224r11225
20852085   MCFG_TIMER_ADD("timer3", model2_timer_cb)
20862086   MCFG_TIMER_PTR((FPTR)3)
20872087
2088   MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
2089
20882090   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
20892091
20902092   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/majorpkr.c
r11224r11225
1818  1x M6295 @ 1.5 MHz. (4 channel mixing ADPCM voice synthesis). Pin7 high.
1919
2020  1x 6845 (CRT Controller) @ 750 kHz.
21        Hs 15625 Hz
22        Vs 52.786 Hz
23   
21          Hs 15625 Hz
22          Vs 52.786 Hz
23
2424  2x MB8464 (Video?)8kx8
2525  1x MB8416 (NVRAM) 2Kx8
2626  1x MB8464 (?) 8kx8
r11224r11225
4747  00  W ---> ROM bank.
4848  01  W ---> RAM bank.
4949  02  W ---> RAM bank.
50 
50
5151  10 R  ---> Regular inputs (holds) multiplexed with credits out.
5252  10  W ---> Writes a kind of watchdog (bit4) and mech counters pulses (bits 0-1-2-3).
5353  11 R  ---> Read input port (remaining controls).
r11224r11225
5858  13  W ---> Lamps out (array a)
5959  14 R  ---> Freeze. Switch in bit0 that pause the game when active. Just once active, the code loops till the bit resets.
6060  14  W ---> Lamps out (array b).
61 
61
6262  50 RW ---> OKI6295 (R/W)
63 
63
6464  60  W ---> PSG SN76489/96 initialization routines. (Maybe a leftover for different hardware)
6565             The offset is initialized with the following sequence: 0x9f, 0xbf, 0xdf, 0xff.
6666
6767
6868  Pulses - Port 10h.
69  ------------------
69  ------------------
7070    - bits -
7171    7654 3210
7272    ---- ---x   Credits Out mech counter.
7373    ---- --x-   Credits 3 mech counter.
7474    ---- -x--   Credits 1 mech counter.
7575    ---- x---   Credits 2 mech counter.
76    ---x ----   Watchdog? (constant writes). (*)
76    ---x ----   Watchdog? (constant writes). (*)
7777    xxx- ----   Unknown.
7878
7979  (*) Tied to a ULN Opto Triac (pin3 solder side edge connector - Lock Out (100V))
r11224r11225
125125  ....
126126
127127  Service Mode:
128 
128
129129  F2 to enter the Book/Settings Mode.
130130  HOLD1 to move UP.
131131  HOLD2 to move DOWN.
r11224r11225
277277***********************************************************************************
278278
279279  Power Supply edge connector Layout...
280 
280
281281  .-----------------------+-+--+---------------------------.
282282  |       Components side |L|PN| Solder side               |
283283  +-----------------------+-+--+---------------------------+
r11224r11225
292292  |       Lamp TAKE SCORE |K|09| Lamp HOLD 4               |
293293  |        Lamp DOUBLE UP |L|10| Lamp HOLD 5               |
294294  '-----------------------+-+--+---------------------------'
295 
295
296296  Edge connector Layout...
297297
298298  .-----------------------+-+--+---------------------------.
r11224r11225
403403  FVR-SLOT              OFF  ON         <--- Fever's number slot.
404404  AMUSEMENT-MODE        OFF  ON         <--- Self explanatory....
405405
406  1ST BET           1  5  10  20  30    <--- First Bet.
406  1ST BET           1  5  10  20  30    <--- First Bet.
407407  CNT BET           1  5  10  20  30    <--- Second Bet.
408408
409409  BACK-RGB R        0 1 2 3 4 5 6 7     <--- Background R component (0 = light, 7 = strong)
r11224r11225
436436***********************************************************************************
437437
438438  To Do:
439 
439
440440  - Find the input that unlocks the "KEY-LOCK" mode in the settings.
441441  - Proper flip mode.
442442  - Resistors Network.
r11224r11225
465465   int   m_palette_bank;
466466   int m_vram_bank;
467467   int m_flip_state;
468   
468
469469   tilemap_t    *m_bg_tilemap,   *m_fg_tilemap;
470470
471471   UINT8 *m_videoram;
472   
472
473473   required_device<okim6295_device> oki;
474474
475475};
r11224r11225
482482static TILE_GET_INFO( bg_get_tile_info )
483483{
484484   majorpkr_state *state = machine.driver_data<majorpkr_state>();
485   
485
486486   int code = state->m_videoram[0x800 + 2 * tile_index] + (state->m_videoram[0x800 + 2 * tile_index + 1] << 8);
487   
487
488488   SET_TILE_INFO(
489489         0,
490490         (code & 0x1fff),
r11224r11225
497497   majorpkr_state *state = machine.driver_data<majorpkr_state>();
498498
499499   int code = state->m_videoram[2 * tile_index] + (state->m_videoram[2 * tile_index + 1] << 8);
500   
500
501501   SET_TILE_INFO(
502502         1,
503503         (code & 0x07ff),
r11224r11225
509509static VIDEO_START(majorpkr)
510510{
511511   majorpkr_state *state = machine.driver_data<majorpkr_state>();
512   
512
513513   state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows, 16, 8, 36, 28);
514514   state->m_fg_tilemap = tilemap_create(machine, fg_get_tile_info, tilemap_scan_rows, 16, 8, 36, 28);
515515   tilemap_set_transparent_pen(state->m_fg_tilemap, 0);
516   
516
517517   state->machine().generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 4 * 0x800);
518518
519519   state->m_videoram = auto_alloc_array(machine, UINT8, 4 * 0x800); /* 2 banks in use, but the game clears 4 after boot ... */
r11224r11225
523523static SCREEN_UPDATE(majorpkr)
524524{
525525   majorpkr_state *state = screen->machine().driver_data<majorpkr_state>();
526   
526
527527   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine()));
528528
529529   rectangle custom_clip;
r11224r11225
532532       form the render. We need more proof about how the video is working.
533533    */
534534   custom_clip.min_x=cliprect->min_x;
535//   custom_clip.max_x=cliprect->max_x-16;
535//  custom_clip.max_x=cliprect->max_x-16;
536536   custom_clip.max_x=cliprect->max_x;
537537   custom_clip.min_y=cliprect->min_y;
538538   custom_clip.max_y=cliprect->max_y;
r11224r11225
563563static WRITE8_HANDLER(palette_bank_w)
564564{
565565   majorpkr_state *state = space->machine().driver_data<majorpkr_state>();
566   
566
567567   state->m_palette_bank=data;
568568}
569569
r11224r11225
625625
626626/*  If bit6 is active, the screen is drawn upside down.
627627    (also 0xfc and 0x11 are written to the CRTC registers 0xc0 and 0xd0)
628   So, the CRTC display start address = 0xfc11
629*/   
628    So, the CRTC display start address = 0xfc11
629*/
630630   if (data & 0x40)
631631   {
632632      /* upside down screen */
633633      state->m_flip_state = 1;
634634   }
635   
635
636636/*  If bit6 is not active, the screen is drawn normally.
637637    (also 0x00 is written to the CRTC registers 0xc0 and 0xd0)
638   So, the CRTC display start address = 0x0000
639*/   
638    So, the CRTC display start address = 0x0000
639*/
640640   else
641641   {
642642      /* normal screen */
r11224r11225
650650static READ8_HANDLER( mux_port_r )
651651{
652652   majorpkr_state *state = space->machine().driver_data<majorpkr_state>();
653   
653
654654   switch( (state->m_mux_data & 0xf0) )      /* 00-10-20-30-0F-1F-2F-3F */
655655   {
656656      case 0x00: return input_port_read(space->machine(), "DSW1");   /* confirmed */
r11224r11225
658658      case 0x20: return input_port_read(space->machine(), "DSW3");   /* confirmed */
659659      case 0x30: return input_port_read(space->machine(), "DSW4");   /* confirmed */
660660   }
661   
661
662662   return 0xff;
663663}
664664
665665static READ8_HANDLER( mux_port2_r )
666666{
667667   majorpkr_state *state = space->machine().driver_data<majorpkr_state>();
668   
668
669669   if ((state->m_mux_data & 0x0f) == 4)
670670   {
671671      return input_port_read(space->machine(), "IN0-1");
r11224r11225
675675      return input_port_read(space->machine(), "IN0-0");
676676   }
677677}
678   
678
679679static WRITE8_HANDLER( mux_sel_w )
680680{
681681   majorpkr_state *state = space->machine().driver_data<majorpkr_state>();
r11224r11225
735735   output_set_lamp_value(10, (data >> 3) & 1);   /* Lamp 10: Take */
736736   output_set_lamp_value(11, (data >> 4) & 1);   /* Lamp 11: D-UP */
737737   output_set_lamp_value(12, (data >> 5) & 1);   /* Lamp 12: Fever */
738   
738
739739   if (data & 0xc0)
740740      logerror("Lamps B: Write to 14h: %02x\n", data);
741741}
r11224r11225
779779  00  W ---> ROM bank.
780780  01  W ---> RAM bank.
781781  02  W ---> RAM bank.
782 
782
783783  10 R  ---> Regular inputs (holds) multiplexed with credits out.
784784  10  W ---> Writes a kind of watchdog (bit4) and mech counters pulses (bits 0-1-2-3).
785785  11 R  ---> Read input port (remaining controls).
r11224r11225
790790  13  W ---> Lamps out (array a)
791791  14 R  ---> Freeze. Switch in bit0 that pause the game when active. Just once active, the code loops till the bit resets.
792792  14  W ---> Lamps out (array b).
793 
793
794794  50 RW ---> OKI6295 (RW)
795 
795
796796  60  W ---> PSG SN76489/96 initialization routines.
797797             (Maybe a leftover for different hardware).
798798*/
r11224r11225
801801   AM_RANGE(0x00, 0x00) AM_WRITE(rom_bank_w)
802802   AM_RANGE(0x01, 0x01) AM_WRITE(palette_bank_w)
803803   AM_RANGE(0x02, 0x02) AM_WRITE(vram_bank_w)
804   
804
805805   AM_RANGE(0x10, 0x10) AM_READ(mux_port2_r)   /* muxed set of controls */
806806   AM_RANGE(0x10, 0x10) AM_WRITE(pulses_w)      /* kind of watchdog on bit4... mech counters on bits 0-1-2-3 */
807807   AM_RANGE(0x11, 0x11) AM_READ_PORT("IN1")
r11224r11225
813813   AM_RANGE(0x14, 0x14) AM_READ_PORT("TEST")   /* "freeze" switch */
814814   AM_RANGE(0x14, 0x14) AM_WRITE(lamps_b_w)   /* lamps b out */
815815
816//   AM_RANGE(0x30, 0x30) AM_DEVWRITE("crtc", mc6845_address_w)
817//   AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
816//  AM_RANGE(0x30, 0x30) AM_DEVWRITE("crtc", mc6845_address_w)
817//  AM_RANGE(0x31, 0x31) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
818818
819819   AM_RANGE(0x50, 0x50) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
820820   AM_RANGE(0x60, 0x60) AM_WRITENOP   /* leftover from a PSG SN76489/96? */
r11224r11225
982982   RGN_FRAC(1,2),
983983   8,
984984   { 0, 1, 2, 3, 4, 5, 6, 7 },
985   {
986      0*8, 0*8+RGN_FRAC(1,2), 1*8, 1*8+RGN_FRAC(1,2), 2*8, 2*8+RGN_FRAC(1,2), 3*8, 3*8+RGN_FRAC(1,2),
987      4*8, 4*8+RGN_FRAC(1,2), 5*8, 5*8+RGN_FRAC(1,2), 6*8, 6*8+RGN_FRAC(1,2), 7*8, 7*8+RGN_FRAC(1,2)
985   {
986      0*8, 0*8+RGN_FRAC(1,2), 1*8, 1*8+RGN_FRAC(1,2), 2*8, 2*8+RGN_FRAC(1,2), 3*8, 3*8+RGN_FRAC(1,2),
987      4*8, 4*8+RGN_FRAC(1,2), 5*8, 5*8+RGN_FRAC(1,2), 6*8, 6*8+RGN_FRAC(1,2), 7*8, 7*8+RGN_FRAC(1,2)
988988   },
989989   { 0*8*8, 1*8*8, 2*8*8, 3*8*8, 4*8*8, 5*8*8, 6*8*8, 7*8*8 },
990990   8*8*8
r11224r11225
10391039   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
10401040   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
10411041   MCFG_SCREEN_SIZE((47+1)*16, (36+1)*8)            /* through CRTC registers: 768 x 296 */
1042//   MCFG_SCREEN_VISIBLE_AREA(0, (36*16)-1, 0, (28*8)-1)   /* through CRTC registers: 560(+16) x 224 */
1042//  MCFG_SCREEN_VISIBLE_AREA(0, (36*16)-1, 0, (28*8)-1) /* through CRTC registers: 560(+16) x 224 */
10431043   MCFG_SCREEN_VISIBLE_AREA(0, (35*16)-1, 0, (28*8)-1)
10441044
10451045   MCFG_GFXDECODE(majorpkr)
r11224r11225
10471047
10481048   MCFG_VIDEO_START(majorpkr)
10491049   MCFG_SCREEN_UPDATE(majorpkr)
1050   
1050
10511051   MCFG_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf) /* verified */
10521052
10531053   /* sound hardware */
r11224r11225
10651065   ROM_REGION( 0x20000, "maincpu", 0 )
10661066   ROM_LOAD( "6_27c512_823b.bin", 0x00000, 0x0e000, CRC(a3d5475e) SHA1(cb41508b55da8b8c658a2f2ccc6ebda09db29040)  )
10671067   ROM_CONTINUE(0x10000,0x2000)
1068   
1068
10691069   ROM_REGION( 0x100000, "gfx1", 0 )
10701070   ROM_LOAD( "p1_27c040_7d3b.bin", 0x00000, 0x80000, CRC(67299eff) SHA1(34d3d8baf08dea495b699dd63272b445e2acb42d) )
10711071   ROM_LOAD( "p2_27c040_6039.bin", 0x80000, 0x80000, CRC(2d68b177) SHA1(01c934e0383991f2208b915cc5015463a8b6a8fd) )
src/mame/drivers/beathead.c
r11224r11225
503503   atarijsa_init(machine, "IN2", 0x0040);
504504
505505   /* prepare the speedups */
506   state->m_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate_create(beathead_state, speedup_r, *state));
507   state->m_movie_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate_create(beathead_state, movie_speedup_r, *state));
506   state->m_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), state));
507   state->m_movie_speedup_data = state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), state));
508508}
509509
510510
src/mame/drivers/btoads.c
r11224r11225
5353   device_triggerint(machine.device("audiocpu"));
5454
5555   /* use a timer to make long transfers faster */
56   machine.scheduler().timer_set(attotime::from_usec(50), FUNC(NULL));
56   machine.scheduler().timer_set(attotime::from_usec(50), FUNC_NULL);
5757}
5858
5959
src/mame/drivers/metro.c
r11224r11225
42614261   /* basic machine hardware */
42624262   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/2)      /* Not confirmed */
42634263   MCFG_CPU_PROGRAM_MAP(pururun_map)
4264   //MCFG_CPU_VBLANK_INT_HACK(msgogo_interrupt,262)    /* fixes the title screen scroll in GunMaster, but makes the game painfully slow */
4264   //MCFG_CPU_VBLANK_INT_HACK(msgogo_interrupt,262)    /* fixes the title screen scroll in GunMaster, but makes the game painfully slow */
42654265   MCFG_CPU_VBLANK_INT_HACK(metro_interrupt,10)      /* ? */
42664266
42674267   MCFG_CPU_ADD("audiocpu", UPD7810, XTAL_24MHz/2)      /* Not confiremd */
src/mame/drivers/atarisy2.c
r11224r11225
213213   /* make sure slapstic area looks like ROM */
214214   if (address >= 0x8000 && address < 0x8200)
215215   {
216      atarisy2_state *state = machine->driver_data<atarisy2_state>();
216      atarisy2_state *state = machine.driver_data<atarisy2_state>();
217217      direct.explicit_configure(0x8000, 0x81ff, 0x1ff, (UINT8 *)state->m_slapstic_base);
218218      return ~0;
219219   }
r11224r11225
246246   atarigen_scanline_timer_reset(*machine.primary_screen, scanline_update, 64);
247247
248248   address_space *main = machine.device<t11_device>("maincpu")->space(AS_PROGRAM);
249   main->set_direct_update_handler(direct_update_delegate_create_static(atarisy2_direct_handler, machine));
249   main->set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_direct_handler), &machine));
250250
251251   state->m_p2portwr_state = 0;
252252   state->m_p2portrd_state = 0;
src/mame/drivers/alien.c
r11224r11225
11/**********************************************************************************
22
3   Alien: The Arcade Medal Edition (c) 2005 Capcom
3    Alien: The Arcade Medal Edition (c) 2005 Capcom
44
5   skeleton driver
5    skeleton driver
66
7   - sh-4 clocked with 200MHz
8   - 2 x Panasonic MN677511DE chips (MPEG2 decoders)
9   - Altera ACEX 1K PLD
10   - M48T35Y timekeeper device
11   - CF interface
7    - sh-4 clocked with 200MHz
8    - 2 x Panasonic MN677511DE chips (MPEG2 decoders)
9    - Altera ACEX 1K PLD
10    - M48T35Y timekeeper device
11    - CF interface
1212
1313***********************************************************************************/
1414
src/mame/drivers/missile.c
r11224r11225
515515
516516   /* set up an opcode base handler since we use mapped handlers for RAM */
517517   address_space *space = machine.device<m6502_device>("maincpu")->space(AS_PROGRAM);
518   space->set_direct_update_handler(direct_update_delegate_create_static(missile_direct_handler, machine));
518   space->set_direct_update_handler(direct_update_delegate(FUNC(missile_direct_handler), &machine));
519519
520520   /* create a timer to speed/slow the CPU */
521521   state->m_cpu_timer = machine.scheduler().timer_alloc(FUNC(adjust_cpu_speed));
src/mame/drivers/vcombat.c
r11224r11225
404404
405405DIRECT_UPDATE_HANDLER( vcombat_vid_0_direct_handler )
406406{
407   vcombat_state *state = machine->driver_data<vcombat_state>();
407   vcombat_state *state = machine.driver_data<vcombat_state>();
408408   if (address >= 0xfffc0000 && address <= 0xffffffff)
409409   {
410410      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_0_shared_RAM);
r11224r11225
415415
416416DIRECT_UPDATE_HANDLER( vcombat_vid_1_direct_handler )
417417{
418   vcombat_state *state = machine->driver_data<vcombat_state>();
418   vcombat_state *state = machine.driver_data<vcombat_state>();
419419   if (address >= 0xfffc0000 && address <= 0xffffffff)
420420   {
421421      direct.explicit_configure(0xfffc0000, 0xffffffff, 0x3ffff, state->m_vid_1_shared_RAM);
r11224r11225
432432
433433   /* The two i860s execute out of RAM */
434434   address_space *space = machine.device<i860_device>("vid_0")->space(AS_PROGRAM);
435   space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, machine));
435   space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_0_direct_handler), &machine));
436436
437437   space = machine.device<i860_device>("vid_1")->space(AS_PROGRAM);
438   space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_1_direct_handler, machine));
438   space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_1_direct_handler), &machine));
439439
440440   /* Allocate the 68000 framebuffers */
441441   state->m_m68k_framebuffer[0] = auto_alloc_array(machine, UINT16, 0x8000);
r11224r11225
480480
481481   /* The i860 executes out of RAM */
482482   address_space *space = machine.device<i860_device>("vid_0")->space(AS_PROGRAM);
483   space->set_direct_update_handler(direct_update_delegate_create_static(vcombat_vid_0_direct_handler, machine));
483   space->set_direct_update_handler(direct_update_delegate(FUNC(vcombat_vid_0_direct_handler), &machine));
484484}
485485
486486
src/mame/drivers/starwars.c
r11224r11225
123123
124124DIRECT_UPDATE_HANDLER( esb_setdirect )
125125{
126   starwars_state *state = machine->driver_data<starwars_state>();
126   starwars_state *state = machine.driver_data<starwars_state>();
127127   /* if we are in the slapstic region, process it */
128128   if ((address & 0xe000) == 0x8000)
129129   {
r11224r11225
521521
522522   /* install an opcode base handler */
523523   address_space *space = machine.device<m6809_device>("maincpu")->space(AS_PROGRAM);
524   space->set_direct_update_handler(direct_update_delegate_create_static(esb_setdirect, machine));
524   space->set_direct_update_handler(direct_update_delegate(FUNC(esb_setdirect), &machine));
525525
526526   /* install read/write handlers for it */
527527   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x8000, 0x9fff, FUNC(esb_slapstic_r), FUNC(esb_slapstic_w));
src/mame/drivers/segas18.c
r11224r11225
8282
8383static const segaic16_memory_map_entry rom_171_shad_info[] =
8484{
85   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r,     NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
86   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, NULL,          "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
87   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,          "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
88   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,          "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
89   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,          "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
90   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,          "bank14", NULL,                  "bank14", &workram,              "work RAM" },
91   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, NULL,          NULL,     NULL,                  NULL,     NULL,                  "????" },
92   { 0x25/2, 0x00000, 0x00010, 0xfffff0,      ~0, genesis_vdp_r, NULL,     genesis_vdp_w,         NULL,     NULL,                  "VDP" },
93   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL,          "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
85   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r),     NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
86   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, FUNC_NULL,           "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
87   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,           "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
88   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,           "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
89   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,           "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
90   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,           "bank14", FUNC_NULL,                   "bank14", &workram,              "work RAM" },
91   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, FUNC_NULL,           NULL,     FUNC_NULL,                   NULL,     NULL,                  "????" },
92   { 0x25/2, 0x00000, 0x00010, 0xfffff0,      ~0, FUNC(genesis_vdp_r), NULL,     FUNC(genesis_vdp_w),         NULL,     NULL,                  "VDP" },
93   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL,           "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
9494   { 0 }
9595};
9696
9797static const segaic16_memory_map_entry rom_171_5874_info[] =
9898{
99   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r,     NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
100   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, NULL,          "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
101   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,          "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
102   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,          "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
103   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,          "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
104   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,          "bank14", NULL,                  "bank14", &workram,              "work RAM" },
105   { 0x29/2, 0x00000, 0x00010, 0xfffff0,      ~0, genesis_vdp_r, NULL,     genesis_vdp_w,         NULL,     NULL,                  "VDP" },
106   { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, NULL,          "bank16", NULL,                  NULL,     NULL,                  "ROM 1" },
107   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL,          "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
99   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r),     NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
100   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, FUNC_NULL,           "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
101   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,           "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
102   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,           "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
103   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,           "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
104   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,           "bank14", FUNC_NULL,                   "bank14", &workram,              "work RAM" },
105   { 0x29/2, 0x00000, 0x00010, 0xfffff0,      ~0, FUNC(genesis_vdp_r), NULL,     FUNC(genesis_vdp_w),         NULL,     NULL,                  "VDP" },
106   { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL,           "bank16", FUNC_NULL,                   NULL,     NULL,                  "ROM 1" },
107   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL,           "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
108108   { 0 }
109109};
110110
111111static const segaic16_memory_map_entry rom_171_5987_info[] =
112112{
113   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r,     NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
114   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, NULL,          "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
115   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,          "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
116   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,          "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
117   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,          "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
118   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,          "bank14", NULL,                  "bank14", &workram,              "work RAM" },
119   { 0x29/2, 0x00000, 0x00010, 0xfffff0,      ~0, genesis_vdp_r, NULL,     genesis_vdp_w,         NULL,     NULL,                  "VDP" },
120   { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, NULL,          "bank16", rom_5987_bank_w,       NULL,     NULL,                  "ROM 1/banking" },
121   { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, NULL,          "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
113   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r),     NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
114   { 0x39/2, 0x00000, 0x02000, 0xffe000,      ~0, FUNC_NULL,           "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
115   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,           "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
116   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,           "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
117   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,           "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
118   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,           "bank14", FUNC_NULL,                   "bank14", &workram,              "work RAM" },
119   { 0x29/2, 0x00000, 0x00010, 0xfffff0,      ~0, FUNC(genesis_vdp_r), NULL,     FUNC(genesis_vdp_w),         NULL,     NULL,                  "VDP" },
120   { 0x25/2, 0x00000, 0x80000, 0xf80000, 0x80000, FUNC_NULL,           "bank16", FUNC(rom_5987_bank_w),       NULL,     NULL,                  "ROM 1/banking" },
121   { 0x21/2, 0x00000, 0x100000,0xf00000, 0x00000, FUNC_NULL,           "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
122122   { 0 }
123123};
124124
src/mame/drivers/famibox.c
r11224r11225
2525
2626- The FamicomBox will not run mmc3 games and many other advanced mappers
2727- There a special lockout chip, but the lockout chip connects to different pins on
28  a FamicomBox cartridge’s connector than a regular cart
29- The lockout chips in the system and the games have to “talk” before the system will
28  a FamicomBox cartridge?s connector than a regular cart
29- The lockout chips in the system and the games have to ?talk? before the system will
3030  load any games into its menu.
3131
32Here’s a list of some of the games known to have come with the FamicomBox:
32Here?s a list of some of the games known to have come with the FamicomBox:
33331943; Baseball; Bomber Man; Devil World; Donkey Kong; Donkey Kong Jr.; Duck Hunt;
34Excite Bike; F1 Race; Fighting Golf; Golf; Gradius; Hogan’s Alley; Ice Climbers;
35Ice Hockey; Knight Rider; Makaimura: Ghosts ‘n Goblins; McKids; Mah-Jong; Mario Bros.;
36Mike Tyson’s Punch-Out!!; Ninja Ryukenden; Operation Wolf (?); Punch-Out!!; Rock Man;
37Rygar; Senjou no Ookami; Soccer League Winner’s Cup; Super Chinese 2; Super Mario Bros;
34Excite Bike; F1 Race; Fighting Golf; Golf; Gradius; Hogan?s Alley; Ice Climbers;
35Ice Hockey; Knight Rider; Makaimura: Ghosts ?n Goblins; McKids; Mah-Jong; Mario Bros.;
36Mike Tyson?s Punch-Out!!; Ninja Ryukenden; Operation Wolf (?); Punch-Out!!; Rock Man;
37Rygar; Senjou no Ookami; Soccer League Winner?s Cup; Super Chinese 2; Super Mario Bros;
3838Tag Team Pro Wrestling; Takahashi Meijin no Boukenjima; Tennis; Twin Bee;
3939Volleyball; Wild Gunman; Wrecking Crew.
4040
41Here’s a list of some of the games known to have come with the FamicomStation:
41Here?s a list of some of the games known to have come with the FamicomStation:
42421943; Baseball; Donkey Kong; Duck Hunt; F1 Race; Golf; Kame no Ongaeshi:
4343Urashima Densetsu; Mah-Jong; Mario Bros.; Night Raider; Senjou no Ookami;
44Soccer League Winner’s Cup; Super Chinese 2; Super Mario Bros; Tag Team Pro Wrestling;
44Soccer League Winner?s Cup; Super Chinese 2; Super Mario Bros; Tag Team Pro Wrestling;
4545Takahashi Meijin no Boukenjima; Tennis; Wild Gunman; Wrecking Crew.
4646
4747***************************************************************************/
src/mame/drivers/midqslvr.c
r11224r11225
33    Midway Quicksilver skeleton driver
44
55    Main CPU : Intel Celeron 333/366MHz
6    Motherboard : Intel SE44BX-2
7    RAM : 64MB
6    Motherboard : Intel SE440BX-2
7    RAM : 64MB PC100-222-620 non-ecc
8    Sound: Integrated YMF740G
9    Networking: SMC EZ Card 10 / SMC1208T (probably 10ec:8029 1113:1208)
810    Graphics Chips : Quantum Obsidian 3DFX
911    Storage : Hard Drive
12
13    Chipsets (440BX AGPset):
14    - 82371EB PCI-ISA bridge
15    - 82371EB Power Management Controller
16    - 82371AB/EB Universal Host Controller (USB UHCI)
17    - 82371AB/EB PCI Bus Master IDE Controller
18
1019***************************************************************************/
1120
1221#include "emu.h"
src/mame/drivers/mpu3.c
r0r11225
1/***********************************************************************************************************
2  Barcrest MPU3 highly preliminary driver by J.Wallace, and Anonymous.
3
4--- Board Setup ---
5
6This original board uses a ~1.Mhz 6808 CPU, and a number of PIA6821 chips for multiplexing inputs and the like.
7
8A 6840PTM is used for internal timing
9A GAME CARD (cartridge) plugs into the board containing the game, and a protection PAL (the 'characteriser').
10
11--- Preliminary MPU3 Memorymap  ---
12
13   hex     |r/w| D D D D D D D D |
14 location  |   | 7 6 5 4 3 2 1 0 | function
15-----------+---+-----------------+--------------------------------------------------------------------------
16 0000-07FF |R/W| D D D D D D D D | 2k RAM
17-----------+---+-----------------+--------------------------------------------------------------------------
18
19 8800-881F |R/W| ???????????????? | MC6840 PTM IC2 (unusual bus setup, address shifted two bytes)
20
21Outputs hooked into IC 19
22
23  Clock1 <--------------------------------------
24     |                                          |
25     V                                          |
26  Output1 ---> Clock2                           |
27                                                |
28               Output2 --+-> Clock3             |
29                         |                      |
30                         |   Output3 ---> 'to audio amp' ??
31                         |
32                         +--------> CA1 IC3 (
33
34IRQ line connected to CPU
35
36-----------+---+-----------------+--------------------------------------------------------------------------
379000-      |R/W| D D D D D D D D | PIA6821 IC3
38           |   |                 | PA2-PA7 INPUT  multiplexed inputs data
39           |   |                 | PA1, CB1 connected to IC2 C1 pin
40           |   |                 |        CA1     INPUT, not connected
41           |   |                 |        CA2    OUTPUT, A on strobe multiplexer
42           |   |                 |        IRQA           Not connected
43           |   |                 |
44           |   |                 |        CB2 IC19 Triac switch
45           |   |                 | Port B triacs
46
479800       |R/W| D D D D D D D D | PIA6821 IC4
48           |   |                 | PA0-PA6 INPUT  Yellow 15 way data (7SEG LED or Meters)
49           |   |                 | PA7     802 (Q) IC11 G1
50           |   |                 | PB0-PB7 INPUT  IC24
51           |   |                 |        CA2    OUTPUT, B on strobe multiplexer
52           |   |                 |        CB2    TRiac switch
53
54A000-A003  |R/W| D D D D D D D D | PIA6821 IC5 port A Reel drives
55           |   |                 |          port B Reel opto
56           |   |                 |
57           |   |                 |        CA2    OUTPUT, C on strobe multiplexer
58           |   |                 |        CB2    TRiac switch
59-----------+---+-----------------+--------------------------------------------------------------------------
60A800-A803  |R/W| D D D D D D D D | PIA6821 IC6 PA0-PA7, AUX1 connector (ALPHA)
61           |   |                 |             PB0-PB7, AUX2 connector
62           |   |                 |
63           |   |                 |
64
65-----------+---+-----------------+--------------------------------------------------------------------------
66??? B000-FFFF | R | D D D D D D D D | ROM
67-----------+---+-----------------+--------------------------------------------------------------------------
68
69TODO: - Distinguish door switches using manual
70      - Add discrete sound functionality (same as MPU4 alarm)
71      - Is pulse timer ic11 right?
72      - 12V meter alarm on hyper viper - how are meters sensed?
73
74***********************************************************************************************************/
75#include "emu.h"
76#include "machine/6821pia.h"
77#include "machine/6840ptm.h"
78#include "machine/nvram.h"
79
80#include "cpu/m6800/m6800.h"
81#include "machine/steppers.h"
82#include "machine/roc10937.h"
83#include "machine/meters.h"
84
85#ifdef MAME_DEBUG
86#define MPU3VERBOSE 1
87#else
88#define MPU3VERBOSE 0
89#endif
90
91#define LOG(x)   do { if (MPU3VERBOSE) logerror x; } while (0)
92
93#include "video/awpvid.h"      //Fruit Machines Only
94
95#define MPU3_MASTER_CLOCK (XTAL_4MHz)
96
97/* Lookup table for CHR data */
98
99struct mpu3_chr_table
100{
101   UINT8 call;
102   UINT8 response;
103};
104
105class mpu3_state : public driver_device
106{
107public:
108   mpu3_state(running_machine &machine, const driver_device_config_base &config)
109   : driver_device(machine, config) { }
110
111
112int m_alpha_data_line;
113int m_alpha_clock;
114int m_triac_ic3;
115int m_triac_ic4;
116int m_triac_ic5;
117int m_ic3_data;
118int m_IC11G1;
119int m_IC11G2A;
120int m_IC11G2B;
121int m_IC11GC;
122int m_IC11GB;
123int m_IC11GA;
124
125int m_ic10_output;
126int m_ic11_active;
127int m_ic11_output;
128int m_disp_func;
129
130int m_ic4_input_a;
131int m_aux1_input;
132int m_aux2_input;
133int   m_input_strobe;     /* IC11 74LS138 A = CA2 IC3, B = CA2 IC4, C = CA2 IC5 */
134UINT8 m_lamp_strobe;
135UINT8 m_led_strobe;
136int m_signal_50hz;
137
138const mpu3_chr_table* m_current_chr_table;
139int m_prot_col;
140
141int m_optic_pattern;
142
143emu_timer *m_ic21_timer;
144};
145
146#define DISPLAY_PORT 0
147#define METER_PORT 1
148#define BWB_FUNCTIONALITY 2
149static TIMER_CALLBACK( ic21_timeout );
150
151static void update_triacs(running_machine &machine)
152{
153   mpu3_state *state = machine.driver_data<mpu3_state>();
154   int i,triacdata;
155
156   triacdata=state->m_triac_ic3 + (state->m_triac_ic4 << 8) + (state->m_triac_ic5 << 9);
157
158   for (i = 0; i < 8; i++)
159   {
160      output_set_indexed_value("triac", i, triacdata & (1 << i));
161   }
162}
163
164/* called if board is reset */
165static void mpu3_stepper_reset(running_machine &machine)
166{
167   mpu3_state *state = machine.driver_data<mpu3_state>();
168   int pattern = 0,reel;
169   for (reel = 0; reel < 6; reel++)
170   {
171      stepper_reset_position(reel);
172      if (stepper_optic_state(reel)) pattern |= 1<<reel;
173   }
174   state->m_optic_pattern = pattern;
175}
176
177static MACHINE_RESET( mpu3 )
178{
179   mpu3_state *state = machine.driver_data<mpu3_state>();
180   ROC10937_reset(0);   /* reset display1 */
181
182   mpu3_stepper_reset(machine);
183
184   state->m_lamp_strobe   = 0;
185   state->m_led_strobe    = 0;
186
187   state->m_IC11GC    = 0;
188   state->m_IC11GB    = 0;
189   state->m_IC11GA    = 0;
190   state->m_IC11G1    = 1;
191   state->m_IC11G2A   = 0;
192   state->m_IC11G2B   = 0;
193}
194
195/* 6808 IRQ handler */
196static WRITE_LINE_DEVICE_HANDLER( cpu0_irq )
197{
198   device_t *pia3 = device->machine().device("pia_ic3");
199   device_t *pia4 = device->machine().device("pia_ic4");
200   device_t *pia5 = device->machine().device("pia_ic5");
201   device_t *pia6 = device->machine().device("pia_ic6");
202   device_t *ptm2 = device->machine().device("ptm_ic2");
203
204   /* The PIA and PTM IRQ lines are all connected to a common PCB track, leading directly to the 6809 IRQ line. */
205   int combined_state = pia6821_get_irq_a(pia3) | pia6821_get_irq_b(pia3) |
206                   pia6821_get_irq_a(pia4) | pia6821_get_irq_b(pia4) |
207                   pia6821_get_irq_a(pia5) | pia6821_get_irq_b(pia5) |
208                   pia6821_get_irq_a(pia6) | pia6821_get_irq_b(pia6) |
209                   ptm6840_get_irq(ptm2);
210
211      cputag_set_input_line(device->machine(), "maincpu", M6800_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
212      LOG(("6808 int%d \n", combined_state));
213}
214
215
216/* IC2 6840 PTM handler probably clocked from elsewhere*/
217static WRITE8_DEVICE_HANDLER( ic2_o1_callback )
218{
219}
220
221//FIXME FROM HERE
222static WRITE8_DEVICE_HANDLER( ic2_o2_callback )
223{
224}
225
226
227static WRITE8_DEVICE_HANDLER( ic2_o3_callback )
228{
229}
230
231
232static const ptm6840_interface ptm_ic2_intf =
233{
234   MPU3_MASTER_CLOCK,///4,
235   { 0, 0, 0 },
236   { DEVCB_HANDLER(ic2_o1_callback),
237     DEVCB_HANDLER(ic2_o2_callback),
238     DEVCB_HANDLER(ic2_o3_callback) },
239   DEVCB_LINE(cpu0_irq)
240};
241
242/*
243IC23 emulation
244
245IC23 is a 74LS138 1-of-8 Decoder
246
247It is used as a multiplexer for the LEDs, lamp selects and inputs.*/
248
249static void ic11_update(mpu3_state *state)
250{
251   if (!state->m_IC11G2A)
252   {
253      if (!state->m_IC11G2B)
254      {
255         if (state->m_IC11G1)
256         {
257            if ( state->m_IC11GA )   state->m_input_strobe |= 0x01;
258            else               state->m_input_strobe &= ~0x01;
259
260            if ( state->m_IC11GB )   state->m_input_strobe |= 0x02;
261            else               state->m_input_strobe &= ~0x02;
262
263            if ( state->m_IC11GC )   state->m_input_strobe |= 0x04;
264            else               state->m_input_strobe &= ~0x04;
265         }
266      }
267   }
268   else
269   if ((state->m_IC11G2A)||(state->m_IC11G2B)||(!state->m_IC11G1))
270   {
271      state->m_input_strobe = 0x00;
272   }
273}
274
275
276/*
277IC21 emulation
278
279IC21 is an 8602 or equivalent pulse generator
280
281CLEAR and B2 are tied high, so a high to low transition on A2
282(tied to IC11 GA) will trigger operation.
283
284Cx = 2.2 uF
285
286Rx = 47k
287
288K = ~0.34
289
290t/ns = .34 * 47 * 2.2e6 [ 1+ (1/47)]
291
292
293This seems less stable than the revised version used in MPU4
294*/
295static void ic21_output(mpu3_state *state,int data)
296{
297   state->m_IC11G1 = data;
298   ic11_update(state);
299}
300
301static void ic21_setup(mpu3_state *state)
302{
303   if (state->m_IC11GA)
304   {
305      {
306         state->m_ic11_active=1;
307         ic21_output(state,1);
308         state->m_ic21_timer->adjust(attotime::from_nsec( (0.34 * 47 * 2200000) *(1+(1/47))));
309      }
310   }
311}
312
313static TIMER_CALLBACK( ic21_timeout )
314{
315   mpu3_state *state = machine.driver_data<mpu3_state>();
316   state->m_ic11_active=0;
317   ic21_output(state,0);
318}
319
320static READ8_DEVICE_HANDLER( pia_ic3_porta_r )
321{
322   mpu3_state *state = device->machine().driver_data<mpu3_state>();
323   static const char *const portnames[] = { "ORANGE1", "ORANGE2", "BLACK1", "BLACK2", "DIL1", "DIL1", "DIL2", "DIL2" };
324   int data=0,swizzle;
325   LOG(("%s: IC3 PIA Read of Port A (MUX input data)\n", device->machine().describe_context()));
326   popmessage("%x",state->m_input_strobe);
327   switch (state->m_input_strobe)
328   {
329      case 0:
330      case 1:
331      case 2:
332      case 3:
333      {
334         data = (input_port_read(device->machine(), portnames[state->m_input_strobe])<<2);
335         break;
336      }
337      case 4://DIL1
338      case 6://DIL2
339      {
340         swizzle = (input_port_read(device->machine(), portnames[state->m_input_strobe]));
341         data = (((swizzle & 0x01) << 7) + ((swizzle & 0x02) << 5) + ((swizzle & 0x04) << 3)
342               + ((swizzle & 0x08) << 1) +((swizzle & 0x10) >> 1) + ((swizzle & 0x20) >> 3));
343         break;
344      }
345      case 5://DIL1
346      case 7://DIL2
347      {
348         swizzle = (input_port_read(device->machine(), portnames[state->m_input_strobe]));
349         data = (((swizzle & 0x80) >> 1) + ((swizzle & 0x40) << 1));
350         break;
351      }
352   }
353   if (state->m_signal_50hz)
354   {
355      data |= 0x02;
356   }
357   else
358   {
359      data &= ~0x02;
360   }
361   return data;
362}
363
364static WRITE8_DEVICE_HANDLER( pia_ic3_portb_w )
365{
366   mpu3_state *state = device->machine().driver_data<mpu3_state>();
367   LOG(("%s: IC3 PIA Port B Set to %2x (Triac)\n", device->machine().describe_context(),data));
368   state->m_triac_ic3 =data;
369}
370
371
372static WRITE_LINE_DEVICE_HANDLER( pia_ic3_ca2_w )
373{
374   mpu3_state *mstate = device->machine().driver_data<mpu3_state>();
375   LOG(("%s: IC3 PIA Port CA2 Set to %2x (input A)\n", device->machine().describe_context(),state));
376   mstate->m_IC11GA = state;
377   ic21_setup(mstate);
378   ic11_update(mstate);
379}
380
381static const pia6821_interface pia_ic3_intf =
382{
383   DEVCB_HANDLER(pia_ic3_porta_r),      /* port A in */
384   DEVCB_NULL,      /* port B in */
385   DEVCB_NULL,      /* line CA1 in */
386   DEVCB_NULL,      /* line CB1 in */
387   DEVCB_NULL,      /* line CA2 in */
388   DEVCB_NULL,      /* line CB2 in */
389   DEVCB_NULL,      /* port A out */
390   DEVCB_HANDLER(pia_ic3_portb_w),      /* port B out */
391   DEVCB_LINE(pia_ic3_ca2_w),         /* line CA2 out */
392   DEVCB_NULL,                     /* port CB2 out */
393   DEVCB_NULL,                     /* IRQA */
394   DEVCB_LINE(cpu0_irq)            /* IRQB */
395};
396
397static READ8_DEVICE_HANDLER( pia_ic4_porta_r )
398{
399   mpu3_state *state = device->machine().driver_data<mpu3_state>();
400   if (state->m_ic11_active)
401   {
402      state->m_ic4_input_a|=0x80;
403   }
404   else
405   {
406      state->m_ic4_input_a&=~0x80;
407   }
408   return state->m_ic4_input_a;
409}
410
411/*  IC4, 7 seg leds */
412static WRITE8_DEVICE_HANDLER( pia_ic4_porta_w )
413{
414   mpu3_state *state = device->machine().driver_data<mpu3_state>();
415   int meter,swizzle;
416   LOG(("%s: IC4 PIA Port A Set to %2x (DISPLAY PORT)\n", device->machine().describe_context(),data));
417   state->m_ic4_input_a=data;
418   switch (state->m_disp_func)
419   {
420      case DISPLAY_PORT:
421      if(state->m_ic11_active)
422      {
423         if(state->m_led_strobe != state->m_input_strobe)
424         {
425            swizzle = ((state->m_ic4_input_a & 0x01) << 2)+(state->m_ic4_input_a & 0x02)+((state->m_ic4_input_a & 0x4) >> 2)+(state->m_ic4_input_a & 0x08)+((state->m_ic4_input_a & 0x10) << 2)+(state->m_ic4_input_a & 0x20)+((state->m_ic4_input_a & 0x40) >> 2);
426            output_set_digit_value(7 - state->m_input_strobe,swizzle);
427         }
428         state->m_led_strobe = state->m_input_strobe;
429      }
430      break;
431
432      case METER_PORT:
433      for (meter = 0; meter < 6; meter ++)
434      {
435         swizzle = ((state->m_ic4_input_a ^ 0xff) & 0x3f);
436         MechMtr_update(meter, (swizzle & (1 << meter)));
437      }
438      break;
439
440      case BWB_FUNCTIONALITY:
441         //Need to find a game to work this out, MFME has a specific option for it, but I see no activity there.
442      break;
443
444   }
445}
446
447static WRITE8_DEVICE_HANDLER( pia_ic4_portb_w )
448{
449   mpu3_state *state = device->machine().driver_data<mpu3_state>();
450   LOG(("%s: IC4 PIA Port B Set to %2x (Lamp)\n", device->machine().describe_context(),data));
451   int i;
452   if(state->m_ic11_active)
453   {
454      if (state->m_lamp_strobe != state->m_input_strobe)
455      {
456         // Because of the nature of the lamping circuit, there is an element of persistance where the lamp retains residual charge
457         // As a consequence, the lamp column data can change before the input strobe (effectively writing 0 to the previous strobe)
458         // without causing the relevant lamps to black out.
459
460         for (i = 0; i < 8; i++)
461         {
462            output_set_lamp_value((8*state->m_input_strobe)+i, ((data  & (1 << i)) !=0));
463         }
464         state->m_lamp_strobe = state->m_input_strobe;
465      }
466   }
467}
468
469static WRITE_LINE_DEVICE_HANDLER( pia_ic4_ca2_w )
470{
471   mpu3_state *mstate = device->machine().driver_data<mpu3_state>();
472   LOG(("%s: IC4 PIA Port CA2 Set to %2x (Input B)\n", device->machine().describe_context(),state));
473   mstate->m_IC11GB = state;
474   ic11_update(mstate);
475}
476
477static WRITE_LINE_DEVICE_HANDLER( pia_ic4_cb2_w )
478{
479   mpu3_state *mstate = device->machine().driver_data<mpu3_state>();
480   LOG(("%s: IC4 PIA Port CA2 Set to %2x (Triac)\n", device->machine().describe_context(),state));
481   mstate->m_triac_ic4=state;
482}
483
484static const pia6821_interface pia_ic4_intf =
485{
486   DEVCB_HANDLER(pia_ic4_porta_r),      /* port A in */
487   DEVCB_NULL,      /* port B in */
488   DEVCB_NULL,      /* line CA1 in */
489   DEVCB_NULL,      /* line CB1 in */
490   DEVCB_NULL,      /* line CA2 in */
491   DEVCB_NULL,      /* line CB2 in */
492   DEVCB_HANDLER(pia_ic4_porta_w),      /* port A out */
493   DEVCB_HANDLER(pia_ic4_portb_w),      /* port B out */
494   DEVCB_LINE(pia_ic4_ca2_w),      /* line CA2 out */
495   DEVCB_LINE(pia_ic4_cb2_w),      /* line CB2 out */
496   DEVCB_LINE(cpu0_irq),      /* IRQA */
497   DEVCB_NULL      /* IRQB */
498};
499
500/* IC5, AUX ports, coin lockouts and AY sound chip select (MODs below 4 only) */
501static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w )
502{
503   mpu3_state *state = device->machine().driver_data<mpu3_state>();
504
505   LOG(("%s: IC5 PIA Port A Set to %2x (Reel)\n", device->machine().describe_context(),data));
506   stepper_update(0, data & 0x03 );
507   stepper_update(1, (data>>2) & 0x03 );
508   stepper_update(2, (data>>4) & 0x03 );
509   stepper_update(3, (data>>6) & 0x03 );
510   awp_draw_reel(0);
511   awp_draw_reel(1);
512   awp_draw_reel(2);
513   awp_draw_reel(3);
514
515   {
516      if ( stepper_optic_state(0) ) state->m_optic_pattern |=  0x01;
517      else                          state->m_optic_pattern &= ~0x01;
518
519      if ( stepper_optic_state(1) ) state->m_optic_pattern |=  0x02;
520      else                          state->m_optic_pattern &= ~0x02;
521      if ( stepper_optic_state(2) ) state->m_optic_pattern |=  0x04;
522      else                          state->m_optic_pattern &= ~0x04;
523
524      if ( stepper_optic_state(3) ) state->m_optic_pattern |=  0x08;
525      else                          state->m_optic_pattern &= ~0x08;
526
527   }
528
529}
530
531static READ8_DEVICE_HANDLER( pia_ic5_portb_r )
532{
533   mpu3_state *state = device->machine().driver_data<mpu3_state>();
534   if (state->m_ic3_data & 0x80 )
535   {
536      return state->m_optic_pattern;
537   }
538   else
539   {
540      return state->m_ic3_data;
541   }
542}
543
544
545
546static WRITE8_DEVICE_HANDLER( pia_ic5_portb_w )
547{
548   mpu3_state *state = device->machine().driver_data<mpu3_state>();
549   state->m_ic3_data = data;
550}
551
552static WRITE_LINE_DEVICE_HANDLER( pia_ic5_ca2_w )
553{
554   mpu3_state *mstate = device->machine().driver_data<mpu3_state>();
555   LOG(("%s: IC5 PIA Port CA2 Set to %2x (C)\n", device->machine().describe_context(),state));
556   mstate->m_IC11GC = state;
557   ic11_update(mstate);
558}
559
560static WRITE_LINE_DEVICE_HANDLER( pia_ic5_cb2_w )
561{
562   mpu3_state *mstate = device->machine().driver_data<mpu3_state>();
563   LOG(("%s: IC5 PIA Port CB2 Set to %2x (Triac)\n", device->machine().describe_context(),state));
564   mstate->m_triac_ic5 = state;
565}
566
567static const pia6821_interface pia_ic5_intf =
568{
569   DEVCB_NULL,      /* port A in */
570   DEVCB_HANDLER(pia_ic5_portb_r),   /* port B in */
571   DEVCB_NULL,      /* line CA1 in */
572   DEVCB_NULL,      /* line CB1 in */
573   DEVCB_NULL,      /* line CA2 in */
574   DEVCB_NULL,      /* line CB2 in */
575   DEVCB_HANDLER(pia_ic5_porta_w),   /* port A out */
576   DEVCB_HANDLER(pia_ic5_portb_w),   /* port B out */
577   DEVCB_LINE(pia_ic5_ca2_w),      /* line CA2 out */
578   DEVCB_LINE(pia_ic5_cb2_w),      /* port CB2 out */
579   DEVCB_NULL,         /* IRQA */
580   DEVCB_NULL         /* IRQB */
581};
582
583
584/* IC6, AUX ports*/
585static READ8_DEVICE_HANDLER( pia_ic6_porta_r )
586{
587   mpu3_state *state = device->machine().driver_data<mpu3_state>();
588   return (input_port_read(device->machine(), "AUX1"))|state->m_aux1_input;
589}
590
591
592static READ8_DEVICE_HANDLER( pia_ic6_portb_r )
593{
594   mpu3_state *state = device->machine().driver_data<mpu3_state>();
595   return (input_port_read(device->machine(), "AUX2"))|state->m_aux2_input;
596}
597
598static WRITE8_DEVICE_HANDLER( pia_ic6_porta_w )
599{
600   mpu3_state *state = device->machine().driver_data<mpu3_state>();
601   LOG(("%s: IC6 PIA Port A Set to %2x (Alpha)\n", device->machine().describe_context(),data));
602   if ( data & 0x08 ) ROC10937_reset(0);
603
604   state->m_alpha_data_line = ((data & 0x20) >> 5);
605   if ( !state->m_alpha_clock && (data & 0x10) )
606   {
607      ROC10937_shift_data(0, state->m_alpha_data_line&0x01?0:1);
608   }
609   state->m_alpha_clock = (data & 0x10);
610
611   ROC10937_draw_16seg(0);
612}
613
614static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w )
615{
616   mpu3_state *state = device->machine().driver_data<mpu3_state>();
617   LOG(("%s: IC6 PIA Port B Set to %2x (AUX2)\n", device->machine().describe_context(),data));
618   state->m_aux2_input = data;
619}
620
621static const pia6821_interface pia_ic6_intf =
622{
623   DEVCB_HANDLER(pia_ic6_porta_r),      /* port A in */
624   DEVCB_HANDLER(pia_ic6_portb_r),      /* port B in */
625   DEVCB_NULL,      /* line CA1 in */
626   DEVCB_NULL,      /* line CB1 in */
627   DEVCB_NULL,      /* line CA2 in */
628   DEVCB_NULL,      /* line CB2 in */
629   DEVCB_HANDLER(pia_ic6_porta_w),      /* port A out */
630   DEVCB_HANDLER(pia_ic6_portb_w),      /* port B out */
631   DEVCB_NULL,         /* line CA2 out */
632   DEVCB_NULL,         /* port CB2 out */
633   DEVCB_LINE(cpu0_irq),            /* IRQA */
634   DEVCB_LINE(cpu0_irq)            /* IRQB */
635};
636
637static INPUT_PORTS_START( mpu3 )
638   PORT_START("ORANGE1")
639   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cancel")
640   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("01")
641   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("02")
642   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("03")
643   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("04")
644   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("05")
645
646
647   PORT_START("ORANGE2")
648   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("08")
649   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("09")
650   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Exchange")
651   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("11")
652   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("12")
653   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("13")
654
655   PORT_START("BLACK1")
656   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Hi")
657   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Lo")
658   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER)   PORT_NAME("Auto Nudge")
659   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W)
660   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE
661   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door")  PORT_CODE(KEYCODE_Q) PORT_TOGGLE
662
663   PORT_START("BLACK2")
664   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("20p")
665   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10p")
666   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Token")
667   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Hold 1")
668   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Hold 2")
669   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Hold 3")
670
671   PORT_START("DIL1")
672   PORT_DIPNAME( 0x80, 0x00, "DIL101" ) PORT_DIPLOCATION("DIL1:01")
673   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
674   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
675   PORT_DIPNAME( 0x40, 0x00, "DIL102" ) PORT_DIPLOCATION("DIL1:02")
676   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
677   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
678   PORT_DIPNAME( 0x20, 0x00, "DIL103" ) PORT_DIPLOCATION("DIL1:03")
679   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
680   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
681   PORT_DIPNAME( 0x10, 0x00, "DIL104" ) PORT_DIPLOCATION("DIL1:04")
682   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
683   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
684   PORT_DIPNAME( 0x08, 0x00, "DIL105" ) PORT_DIPLOCATION("DIL1:05")
685   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
686   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
687   PORT_DIPNAME( 0x04, 0x00, "DIL106" ) PORT_DIPLOCATION("DIL1:06")
688   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
689   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
690   PORT_DIPNAME( 0x02, 0x00, "DIL107" ) PORT_DIPLOCATION("DIL1:07")
691   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
692   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
693   PORT_DIPNAME( 0x01, 0x00, "DIL108" ) PORT_DIPLOCATION("DIL1:08")
694   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
695   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
696
697   PORT_START("DIL2")
698   PORT_DIPNAME( 0x80, 0x00, "DIL201" ) PORT_DIPLOCATION("DIL2:01")
699   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
700   PORT_DIPSETTING(    0x80, DEF_STR( On  ) )
701   PORT_DIPNAME( 0x40, 0x00, "DIL202" ) PORT_DIPLOCATION("DIL2:02")
702   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
703   PORT_DIPSETTING(    0x40, DEF_STR( On  ) )
704   PORT_DIPNAME( 0x20, 0x00, "DIL203" ) PORT_DIPLOCATION("DIL2:03")
705   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
706   PORT_DIPSETTING(    0x20, DEF_STR( On  ) )
707   PORT_DIPNAME( 0x10, 0x00, "DIL204" ) PORT_DIPLOCATION("DIL2:04")
708   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
709   PORT_DIPSETTING(    0x10, DEF_STR( On  ) )
710   PORT_DIPNAME( 0x08, 0x00, "DIL205" ) PORT_DIPLOCATION("DIL2:05")
711   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
712   PORT_DIPSETTING(    0x08, DEF_STR( On  ) )
713   PORT_DIPNAME( 0x04, 0x00, "DIL206" ) PORT_DIPLOCATION("DIL2:06")
714   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
715   PORT_DIPSETTING(    0x04, DEF_STR( On  ) )
716   PORT_DIPNAME( 0x02, 0x00, "DIL207" ) PORT_DIPLOCATION("DIL2:07")
717   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
718   PORT_DIPSETTING(    0x02, DEF_STR( On  ) )
719   PORT_DIPNAME( 0x01, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08")
720   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
721   PORT_DIPSETTING(    0x01, DEF_STR( On  ) )
722
723   PORT_START("AUX1")
724   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0")
725   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1")
726   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2")
727   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3")
728   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4")
729   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5")
730   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6")
731   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7")
732
733   PORT_START("AUX2")
734   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL)
735   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
736   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
737   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
738   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
739   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
740   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
741   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
742INPUT_PORTS_END
743
744static const stepper_interface mpu3_reel_interface =
745{
746   MPU3_48STEP_REEL,
747   92,
748   2,
749   0x00
750};
751
752/* Common configurations */
753static void mpu3_config_common(running_machine &machine)
754{
755   mpu3_state *state = machine.driver_data<mpu3_state>();
756   state->m_ic21_timer = machine.scheduler().timer_alloc(FUNC(ic21_timeout));
757}
758
759static MACHINE_START( mpu3 )
760{
761   mpu3_config_common(machine);
762
763   /* setup 8 mechanical meters */
764   MechMtr_config(machine,8);
765
766   /* setup 4 reels */
767   stepper_config(machine, 0, &mpu3_reel_interface);
768   stepper_config(machine, 1, &mpu3_reel_interface);
769   stepper_config(machine, 2, &mpu3_reel_interface);
770   stepper_config(machine, 3, &mpu3_reel_interface);
771
772   /* setup the standard oki MSC1937 display */
773   ROC10937_init(0, MSC1937,0);
774}
775/*
776Characteriser (CHR)
777
778The MPU3 characteriser is surprisingly simple to simulate, as it operates a call, response pairing. The only factor that provides a challenge is that the
779address of the PAL in memory varies between games. Once found, the memory location of the data table is easily found from the X register of the CPU.
780*/
781
782static WRITE8_HANDLER( characteriser_w )
783{
784   mpu3_state *state = space->machine().driver_data<mpu3_state>();
785   int x;
786   int call=data;
787   if (!state->m_current_chr_table)
788      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
789
790   if (offset == 0)
791   {
792      {
793         if (call == 0)
794         {
795            state->m_prot_col = 0;
796         }
797         else
798         {
799            for (x = state->m_prot_col; x < 64; x++)
800            {
801               if   (state->m_current_chr_table[(x)].call == call)
802               {
803                  state->m_prot_col = x;
804                  break;
805               }
806            }
807         }
808      }
809   }
810}
811
812
813static READ8_HANDLER( characteriser_r )
814{
815   mpu3_state *state = space->machine().driver_data<mpu3_state>();
816   if (!state->m_current_chr_table)
817      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
818
819   if (offset == 0)
820   {
821      return state->m_current_chr_table[state->m_prot_col].response;
822   }
823   return 0;
824}
825
826/* generate a 50 Hz signal (some components rely on this for external sync) */
827static TIMER_DEVICE_CALLBACK( gen_50hz )
828{
829   mpu3_state *state = timer.machine().driver_data<mpu3_state>();
830   /* Although reported as a '50Hz' signal, the fact that both rising and
831    falling edges of the pulse are used means the timer actually gives a 100Hz
832    oscillating signal.*/
833   state->m_signal_50hz = state->m_signal_50hz?0:1;
834   ptm6840_set_c1(timer.machine().device("ptm_ic2"), 0, state->m_signal_50hz);
835   pia6821_cb1_w(timer.machine().device("pia_ic3"), ~state->m_signal_50hz);
836   update_triacs(timer.machine());
837}
838
839static TIMER_DEVICE_CALLBACK( ic10_callback )
840{
841   mpu3_state *state = timer.machine().driver_data<mpu3_state>();
842   // TODO: Use discrete handler for 555, this is far too simplistic
843
844   state->m_ic10_output = state->m_ic10_output?0:1;
845   ptm6840_set_c2(timer.machine().device("ptm_ic2"), 0, state->m_ic10_output);
846   pia6821_ca1_w(timer.machine().device("pia_ic4"), state->m_ic10_output);
847
848}
849static WRITE8_HANDLER( mpu3ptm_w )
850{
851   device_t *ptm2 = space->machine().device("ptm_ic2");
852
853   ptm6840_write(ptm2,offset >>2,data);//((offset & 0x1f) >>2),data);
854}
855
856static READ8_HANDLER( mpu3ptm_r )
857{
858   device_t *ptm2 = space->machine().device("ptm_ic2");
859
860   return ptm6840_read(ptm2,offset >>2);
861}
862
863static ADDRESS_MAP_START( mpu3_basemap, AS_PROGRAM, 8 )
864   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
865   AM_RANGE(0x8800, 0x881f) AM_READWRITE(mpu3ptm_r, mpu3ptm_w)/* PTM6840 IC2 */
866   AM_RANGE(0x9000, 0x9003) AM_DEVREADWRITE("pia_ic3", pia6821_r, pia6821_w)      /* PIA6821 IC3 */
867   AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("pia_ic4", pia6821_r, pia6821_w)      /* PIA6821 IC4 */
868   AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("pia_ic5", pia6821_r, pia6821_w)      /* PIA6821 IC5 */
869   AM_RANGE(0xa800, 0xa803) AM_DEVREADWRITE("pia_ic6", pia6821_r, pia6821_w)      /* PIA6821 IC6 */
870
871   AM_RANGE(0x1000, 0xffff) AM_ROM
872ADDRESS_MAP_END
873
874static MACHINE_CONFIG_START( mpu3base, mpu3_state )
875   MCFG_MACHINE_START(mpu3)
876   MCFG_MACHINE_RESET(mpu3)
877   MCFG_CPU_ADD("maincpu", M6808, MPU3_MASTER_CLOCK)///4)
878   MCFG_CPU_PROGRAM_MAP(mpu3_basemap)
879
880   MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100))
881   MCFG_TIMER_ADD_PERIODIC("555_ic10",ic10_callback, PERIOD_OF_555_ASTABLE(10000,1000,0.0000001))
882
883   /* 6840 PTM */
884   MCFG_PTM6840_ADD("ptm_ic2", ptm_ic2_intf)
885
886   MCFG_PIA6821_ADD("pia_ic3", pia_ic3_intf)
887   MCFG_PIA6821_ADD("pia_ic4", pia_ic4_intf)
888   MCFG_PIA6821_ADD("pia_ic5", pia_ic5_intf)
889   MCFG_PIA6821_ADD("pia_ic6", pia_ic6_intf)
890
891   MCFG_NVRAM_ADD_0FILL("nvram")
892
893   MCFG_DEFAULT_LAYOUT(layout_awpvid16)
894MACHINE_CONFIG_END
895
896
897static const mpu3_chr_table hprvpr_data[64] = {
898{0x00, 0x00},{0x1a, 0x80},{0x04, 0xec},{0x10, 0x1c},{0x18, 0xf0},{0x0f, 0x28},{0x13, 0x54},{0x1b, 0x04},
899{0x03, 0xa4},{0x07, 0xac},{0x17, 0x3c},{0x1d, 0xf4},{0x16, 0x48},{0x15, 0x54},{0x0b, 0x00},{0x08, 0xc4},
900{0x19, 0x88},{0x01, 0x7c},{0x02, 0xf4},{0x05, 0x48},{0x0c, 0x54},{0x09, 0x04},{0x11, 0xc0},{0x14, 0xc8},
901{0x0a, 0x7c},{0x1f, 0xf4},{0x06, 0x6c},{0x0e, 0x70},{0x1c, 0x00},{0x12, 0xa4},{0x1e, 0x8c},{0x0d, 0x5c},
902{0x14, 0xf0},{0x0a, 0x28},{0x19, 0x30},{0x15, 0x40},{0x06, 0xe4},{0x0f, 0x88},{0x08, 0x5c},{0x1b, 0x94},
903{0x1e, 0x0c},{0x04, 0x74},{0x01, 0x40},{0x0c, 0xc4},{0x18, 0x8c},{0x1a, 0x7c},{0x11, 0xd4},{0x0b, 0x08},
904{0x03, 0x34},{0x17, 0x40},{0x10, 0xa4},{0x1d, 0xe8},{0x0e, 0x78},{0x07, 0x90},{0x12, 0x0c},{0x09, 0x54},
905{0x0d, 0x04},{0x1f, 0xc0},{0x16, 0xc8},{0x05, 0x78},{0x13, 0xd4},{0x1c, 0x0c},{0x02, 0x74},{0x00, 0x00},
906};
907
908static DRIVER_INIT (m_hprvpr)
909{
910   mpu3_state *state = machine.driver_data<mpu3_state>();
911   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
912
913   state->m_disp_func=METER_PORT;
914   state->m_current_chr_table = hprvpr_data;
915   space->install_legacy_readwrite_handler(0xc000, 0xc000 , FUNC(characteriser_r),FUNC(characteriser_w));
916
917}
918
919ROM_START( mpu3utst )
920   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00  )
921   ROM_LOAD( "ut5.bin",  0x7800, 0x0800,  CRC(89994adb) SHA1(03e38a860b6ba9d7ae2dbfa7845e85bcf67a6f4d))
922   ROM_RELOAD(0xF800, 0x0800)
923ROM_END
924
925ROM_START( m_hprvpr )
926   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00  )
927   ROM_LOAD( "hv.p3",  0x2000, 0x2000,  CRC(63f8e04f) SHA1(9bfe06a6ea8c308e4a7035752722babbfd792160))
928   ROM_RELOAD(0xc000, 0x2000)
929   ROM_LOAD( "hv.p2",  0x4000, 0x2000,  CRC(b3b6f19e) SHA1(b2251dbe632b04ea7b5952b8a6217605b0df904c))
930   ROM_RELOAD(0xc000, 0x2000)
931   ROM_LOAD( "hv.p1",  0x6000, 0x2000,  CRC(05c0cf97) SHA1(085f432b608cec6054f1e03cf24ca80d3949a0de))
932   ROM_RELOAD(0xe000, 0x2000)
933ROM_END
934
935//    year, name,    parent,  machine,  input,       init,    monitor, company,         fullname,                                    flags
936//Diagnostic ROMs
937GAME( 198?,  mpu3utst,  0,    mpu3base, mpu3,     0,        ROT0, "Barcrest",      "MPU3 Unit Test (Program 5)",                              GAME_NO_SOUND )
938GAME( 198?,  m_hprvpr,  0,    mpu3base, mpu3,     m_hprvpr,        ROT0, "Barcrest",      "Hyper Viper",                              GAME_NO_SOUND|GAME_UNEMULATED_PROTECTION )
src/mame/drivers/vegas.c
r11224r11225
528528   state->m_voodoo = machine.device("voodoo");
529529
530530   /* allocate timers for the NILE */
531   state->m_timer[0] = machine.scheduler().timer_alloc(FUNC(NULL));
532   state->m_timer[1] = machine.scheduler().timer_alloc(FUNC(NULL));
531   state->m_timer[0] = machine.scheduler().timer_alloc(FUNC_NULL);
532   state->m_timer[1] = machine.scheduler().timer_alloc(FUNC_NULL);
533533   state->m_timer[2] = machine.scheduler().timer_alloc(FUNC(nile_timer_callback));
534534   state->m_timer[3] = machine.scheduler().timer_alloc(FUNC(nile_timer_callback));
535535
src/mame/drivers/segaorun.c
r11224r11225
342342
343343static const segaic16_memory_map_entry outrun_info[] =
344344{
345   { 0x35/2, 0x90000, 0x10000, 0xf00000,      ~0, segaic16_road_control_0_r, NULL,     segaic16_road_control_0_w, NULL,     NULL,                  "road control" },
346   { 0x35/2, 0x80000, 0x01000, 0xf0f000,      ~0, NULL,                      "bank10", NULL,                      "bank10", &segaic16_roadram_0,   "road RAM" },
347   { 0x35/2, 0x60000, 0x08000, 0xf18000,      ~0, NULL,                      "bank11", NULL,                      "bank11", &cpu1ram,              "CPU 1 RAM" },
348   { 0x35/2, 0x00000, 0x60000, 0xf00000,      ~0, NULL,                      "bank12", NULL,                      NULL,     &cpu1rom,              "CPU 1 ROM" },
349   { 0x31/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r,                 NULL,     misc_io_w,                 NULL,     NULL,                  "I/O space" },
350   { 0x2d/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,                      "bank13", NULL,                      "bank13", &segaic16_spriteram_0, "object RAM" },
351   { 0x29/2, 0x00000, 0x02000, 0xffe000,      ~0, NULL,                      "bank14", segaic16_paletteram_w,     NULL,     &segaic16_paletteram,  "color RAM" },
352   { 0x25/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,                      "bank15", segaic16_tileram_0_w,      NULL,     &segaic16_tileram_0,   "tile RAM" },
353   { 0x25/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,                      "bank16", segaic16_textram_0_w,      NULL,     &segaic16_textram_0,   "text RAM" },
354   { 0x21/2, 0x60000, 0x08000, 0xf98000,      ~0, NULL,                      "bank17", NULL,                      "bank17", &workram,              "CPU 0 RAM" },
355   { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, NULL,                      "bank18", NULL,                      NULL,     NULL,                  "CPU 0 ROM" },
345   { 0x35/2, 0x90000, 0x10000, 0xf00000,      ~0, FUNC(segaic16_road_control_0_r), NULL,     FUNC(segaic16_road_control_0_w), NULL,     NULL,                  "road control" },
346   { 0x35/2, 0x80000, 0x01000, 0xf0f000,      ~0, FUNC_NULL,                       "bank10", FUNC_NULL,                       "bank10", &segaic16_roadram_0,   "road RAM" },
347   { 0x35/2, 0x60000, 0x08000, 0xf18000,      ~0, FUNC_NULL,                       "bank11", FUNC_NULL,                       "bank11", &cpu1ram,              "CPU 1 RAM" },
348   { 0x35/2, 0x00000, 0x60000, 0xf00000,      ~0, FUNC_NULL,                       "bank12", FUNC_NULL,                       NULL,     &cpu1rom,              "CPU 1 ROM" },
349   { 0x31/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r),                 NULL,     FUNC(misc_io_w),                 NULL,     NULL,                  "I/O space" },
350   { 0x2d/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,                       "bank13", FUNC_NULL,                       "bank13", &segaic16_spriteram_0, "object RAM" },
351   { 0x29/2, 0x00000, 0x02000, 0xffe000,      ~0, FUNC_NULL,                       "bank14", FUNC(segaic16_paletteram_w),     NULL,     &segaic16_paletteram,  "color RAM" },
352   { 0x25/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,                       "bank15", FUNC(segaic16_tileram_0_w),      NULL,     &segaic16_tileram_0,   "tile RAM" },
353   { 0x25/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,                       "bank16", FUNC(segaic16_textram_0_w),      NULL,     &segaic16_textram_0,   "text RAM" },
354   { 0x21/2, 0x60000, 0x08000, 0xf98000,      ~0, FUNC_NULL,                       "bank17", FUNC_NULL,                       "bank17", &workram,              "CPU 0 RAM" },
355   { 0x21/2, 0x00000, 0x60000, 0xf80000, 0x00000, FUNC_NULL,                       "bank18", FUNC_NULL,                       NULL,     NULL,                  "CPU 0 ROM" },
356356   { 0 }
357357};
358358
src/mame/drivers/model1.c
r11224r11225
877877   AM_RANGE(0x610000, 0x61ffff) AM_RAM_WRITE(md1_w) AM_BASE_MEMBER(model1_state, m_display_list1)
878878   AM_RANGE(0x680000, 0x680003) AM_READWRITE(model1_listctl_r, model1_listctl_w)
879879
880   AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(sys24_tile_r, sys24_tile_w)
880   AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile_r, tile_w)
881881   AM_RANGE(0x720000, 0x720001) AM_WRITENOP      // Unknown, always 0
882882   AM_RANGE(0x740000, 0x740001) AM_WRITENOP      // Horizontal synchronization register
883883   AM_RANGE(0x760000, 0x760001) AM_WRITENOP      // Vertical synchronization register
884884   AM_RANGE(0x770000, 0x770001) AM_WRITENOP      // Video synchronization switch
885   AM_RANGE(0x780000, 0x7fffff) AM_READWRITE(sys24_char_r, sys24_char_w)
885   AM_RANGE(0x780000, 0x7fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char_r, char_w)
886886
887887   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(p_w) AM_BASE_GENERIC(paletteram)
888888   AM_RANGE(0x910000, 0x91bfff) AM_RAM  AM_BASE_MEMBER(model1_state, m_color_xlat)
r11224r11225
925925   AM_RANGE(0x610000, 0x61ffff) AM_RAM_WRITE(md1_w) AM_BASE_MEMBER(model1_state, m_display_list1)
926926   AM_RANGE(0x680000, 0x680003) AM_READWRITE(model1_listctl_r, model1_listctl_w)
927927
928   AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(sys24_tile_r, sys24_tile_w)
928   AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile_r, tile_w)
929929   AM_RANGE(0x720000, 0x720001) AM_WRITENOP      // Unknown, always 0
930930   AM_RANGE(0x740000, 0x740001) AM_WRITENOP      // Horizontal synchronization register
931931   AM_RANGE(0x760000, 0x760001) AM_WRITENOP      // Vertical synchronization register
932932   AM_RANGE(0x770000, 0x770001) AM_WRITENOP      // Video synchronization switch
933   AM_RANGE(0x780000, 0x7fffff) AM_READWRITE(sys24_char_r, sys24_char_w)
933   AM_RANGE(0x780000, 0x7fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char_r, char_w)
934934
935935   AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(p_w) AM_BASE_GENERIC(paletteram)
936936   AM_RANGE(0x910000, 0x91bfff) AM_RAM  AM_BASE_MEMBER(model1_state, m_color_xlat)
r11224r11225
15141514   MCFG_MACHINE_RESET(model1)
15151515   MCFG_NVRAM_ADD_0FILL("nvram")
15161516
1517   MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
1518
15171519   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
15181520
15191521   MCFG_SCREEN_ADD("screen", RASTER)
src/mame/drivers/namcos11.c
r11224r11225
884884{
885885   const char *s_name;
886886   read32_space_func keycus_r;
887   const char *keycus_r_name;
887888   int n_daughterboard;
888889} namcos11_config_table[] =
889890{
890   { "tekken", NULL, 32 },
891   { "tekkena", NULL, 32 },
892   { "tekkenb", NULL, 32 },
893   { "tekkenc", NULL, 32 },
894   { "tekken2", keycus_c406_r, 32 },
895   { "tekken2a", keycus_c406_r, 32 },
896   { "tekken2b", keycus_c406_r, 32 },
897   { "souledge", keycus_c409_r, 32 },
898   { "souledgea", keycus_c409_r, 32 },
899   { "souledge1", keycus_c409_r, 32 },
900   { "souledge1j", keycus_c409_r, 32 },
901   { "dunkmnia", keycus_c410_r, 32 },
902   { "dunkmniaj", keycus_c410_r, 32 },
903   { "xevi3dg",  keycus_c430_r, 32 },
904   { "primglex", keycus_c411_r, 32 },
905   { "danceyes", keycus_c431_r, 32 },
906   { "pocketrc", keycus_c432_r, 32 },
907   { "starswep", keycus_c442_r, 0 },
908   { "myangel3", keycus_c443_r, 64 },
909   { "ptblank2a",keycus_c443_r, 64 },
891   { "tekken", FUNC_NULL, 32 },
892   { "tekkena", FUNC_NULL, 32 },
893   { "tekkenb", FUNC_NULL, 32 },
894   { "tekkenc", FUNC_NULL, 32 },
895   { "tekken2", FUNC(keycus_c406_r), 32 },
896   { "tekken2a", FUNC(keycus_c406_r), 32 },
897   { "tekken2b", FUNC(keycus_c406_r), 32 },
898   { "souledge", FUNC(keycus_c409_r), 32 },
899   { "souledgea", FUNC(keycus_c409_r), 32 },
900   { "souledge1", FUNC(keycus_c409_r), 32 },
901   { "souledge1j", FUNC(keycus_c409_r), 32 },
902   { "dunkmnia", FUNC(keycus_c410_r), 32 },
903   { "dunkmniaj", FUNC(keycus_c410_r), 32 },
904   { "xevi3dg",  FUNC(keycus_c430_r), 32 },
905   { "primglex", FUNC(keycus_c411_r), 32 },
906   { "danceyes", FUNC(keycus_c431_r), 32 },
907   { "pocketrc", FUNC(keycus_c432_r), 32 },
908   { "starswep", FUNC(keycus_c442_r), 0 },
909   { "myangel3", FUNC(keycus_c443_r), 64 },
910   { "ptblank2a",FUNC(keycus_c443_r), 64 },
910911   { NULL, NULL }
911912};
912913
r11224r11225
932933      {
933934         if( namcos11_config_table[ n_game ].keycus_r != NULL )
934935         {
935            machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, FUNC(namcos11_config_table[ n_game ].keycus_r) );
936            machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1fa20000, 0x1fa2ffff, namcos11_config_table[ n_game ].keycus_r, namcos11_config_table[ n_game ].keycus_r_name );
936937         }
937938         if( namcos11_config_table[ n_game ].n_daughterboard != 0 )
938939         {
src/mame/drivers/cps3.c
r11224r11225
731731   state->m_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4);
732732
733733   address_space *main = machine.device<sh2_device>("maincpu")->space(AS_PROGRAM);
734   main->set_direct_update_handler(direct_update_delegate_create_static(cps3_direct_handler, machine));
734   main->set_direct_update_handler(direct_update_delegate(FUNC(cps3_direct_handler), &machine));
735735
736736   // flash roms
737737   astring tempstr;
r11224r11225
12981298
12991299DIRECT_UPDATE_HANDLER( cps3_direct_handler )
13001300{
1301   cps3_state *state = machine->driver_data<cps3_state>();
1301   cps3_state *state = machine.driver_data<cps3_state>();
13021302//  if(DEBUG_PRINTF) printf("address %04x\n",address);
13031303
13041304   /* BIOS ROM */
src/mame/drivers/dec0.c
r11224r11225
13581358   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
13591359MACHINE_CONFIG_END
13601360
1361//   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK, DEC0_HTOTAL, DEC0_HBEND, DEC0_HBSTART, DEC0_VTOTAL, DEC0_VBEND, DEC0_VBSTART)
1361//  MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK, DEC0_HTOTAL, DEC0_HBEND, DEC0_HBSTART, DEC0_VTOTAL, DEC0_VBEND, DEC0_VBSTART)
13621362
13631363/* TODO: These are raw guesses, only to get ~57,41 Hz */
13641364#define DEC0_PIXEL_CLOCK XTAL_20MHz/4
r11224r11225
13821382
13831383   /* video hardware */
13841384   MCFG_SCREEN_ADD("screen", RASTER)
1385//   MCFG_SCREEN_REFRESH_RATE(57.41)
1386//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1385//  MCFG_SCREEN_REFRESH_RATE(57.41)
1386//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
13871387   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
13881388   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
13891389   MCFG_SCREEN_UPDATE(robocop)
r11224r11225
14471447
14481448   /* video hardware */
14491449   MCFG_SCREEN_ADD("screen", RASTER)
1450//   MCFG_SCREEN_REFRESH_RATE(57.41)
1451//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1450//  MCFG_SCREEN_REFRESH_RATE(57.41)
1451//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
14521452   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
14531453   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1454//   MCFG_SCREEN_SIZE(32*8, 32*8)
1455//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1454//  MCFG_SCREEN_SIZE(32*8, 32*8)
1455//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
14561456   MCFG_SCREEN_UPDATE(baddudes)
14571457MACHINE_CONFIG_END
14581458
r11224r11225
14681468
14691469   /* video hardware */
14701470   MCFG_SCREEN_ADD("screen", RASTER)
1471//   MCFG_SCREEN_REFRESH_RATE(57.41)
1472//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1471//  MCFG_SCREEN_REFRESH_RATE(57.41)
1472//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
14731473   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
14741474   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1475//   MCFG_SCREEN_SIZE(32*8, 32*8)
1476//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1475//  MCFG_SCREEN_SIZE(32*8, 32*8)
1476//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
14771477   MCFG_SCREEN_UPDATE(birdtry)
14781478MACHINE_CONFIG_END
14791479
r11224r11225
14941494
14951495   /* video hardware */
14961496   MCFG_SCREEN_ADD("screen", RASTER)
1497//   MCFG_SCREEN_REFRESH_RATE(57.41)
1498//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1497//  MCFG_SCREEN_REFRESH_RATE(57.41)
1498//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
14991499   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
15001500   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1501//   MCFG_SCREEN_SIZE(32*8, 32*8)
1502//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1501//  MCFG_SCREEN_SIZE(32*8, 32*8)
1502//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
15031503   MCFG_SCREEN_UPDATE(robocop)
15041504MACHINE_CONFIG_END
15051505
r11224r11225
15151515
15161516   /* video hardware */
15171517   MCFG_SCREEN_ADD("screen", RASTER)
1518//   MCFG_SCREEN_REFRESH_RATE(57.41)
1519//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1518//  MCFG_SCREEN_REFRESH_RATE(57.41)
1519//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
15201520   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
15211521   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1522//   MCFG_SCREEN_SIZE(32*8, 32*8)
1523//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1522//  MCFG_SCREEN_SIZE(32*8, 32*8)
1523//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
15241524   MCFG_SCREEN_UPDATE(robocop)
15251525MACHINE_CONFIG_END
15261526
r11224r11225
15411541
15421542   /* video hardware */
15431543   MCFG_SCREEN_ADD("screen", RASTER)
1544//   MCFG_SCREEN_REFRESH_RATE(57.41)
1545//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1544//  MCFG_SCREEN_REFRESH_RATE(57.41)
1545//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
15461546   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
15471547   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1548//   MCFG_SCREEN_SIZE(32*8, 32*8)
1549//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1548//  MCFG_SCREEN_SIZE(32*8, 32*8)
1549//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
15501550   MCFG_SCREEN_UPDATE(hippodrm)
15511551MACHINE_CONFIG_END
15521552
r11224r11225
15681568
15691569   /* video hardware */
15701570   MCFG_SCREEN_ADD("screen", RASTER)
1571//   MCFG_SCREEN_REFRESH_RATE(57.41)
1572//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1571//  MCFG_SCREEN_REFRESH_RATE(57.41)
1572//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
15731573   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
15741574   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1575//   MCFG_SCREEN_SIZE(32*8, 32*8)
1576//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1575//  MCFG_SCREEN_SIZE(32*8, 32*8)
1576//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
15771577   MCFG_SCREEN_UPDATE(slyspy)
15781578
15791579   MCFG_VIDEO_START(dec0_nodma)
r11224r11225
15961596
15971597   /* video hardware */
15981598   MCFG_SCREEN_ADD("screen", RASTER)
1599//   MCFG_SCREEN_REFRESH_RATE(57.41)
1600//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1599//  MCFG_SCREEN_REFRESH_RATE(57.41)
1600//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
16011601   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
16021602   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1603//   MCFG_SCREEN_SIZE(32*8, 32*8)
1604//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1603//  MCFG_SCREEN_SIZE(32*8, 32*8)
1604//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
16051605   MCFG_SCREEN_UPDATE(robocop)
16061606
16071607   MCFG_GFXDECODE(secretab)
r11224r11225
16201620
16211621   /* video hardware */
16221622   MCFG_SCREEN_ADD("screen", RASTER)
1623//   MCFG_SCREEN_REFRESH_RATE(57.41)
1624//   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
1623//  MCFG_SCREEN_REFRESH_RATE(57.41)
1624//  MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
16251625   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
16261626   MCFG_SCREEN_RAW_PARAMS(DEC0_PIXEL_CLOCK,DEC0_HTOTAL,DEC0_HBEND,DEC0_HBSTART,DEC0_VTOTAL,DEC0_VBEND,DEC0_VBSTART)
1627//   MCFG_SCREEN_SIZE(32*8, 32*8)
1628//   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
1627//  MCFG_SCREEN_SIZE(32*8, 32*8)
1628//  MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
16291629   MCFG_SCREEN_UPDATE(midres)
16301630
16311631   MCFG_GFXDECODE(midres)
src/mame/drivers/atarig42.c
r11224r11225
144144{
145145   if (address < 0x80000)
146146   {
147      atarig42_state *state = machine->driver_data<atarig42_state>();
147      atarig42_state *state = machine.driver_data<atarig42_state>();
148148      direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, state->m_sloop_base);
149149      return (offs_t)-1;
150150   }
r11224r11225
802802
803803   address_space *main = machine.device<m68000_device>("maincpu")->space(AS_PROGRAM);
804804   state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(roadriot_sloop_data_r), FUNC(roadriot_sloop_data_w));
805   main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, machine));
805   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine));
806806
807807   asic65_config(machine, ASIC65_ROMBASED);
808808/*
r11224r11225
841841
842842   address_space *main = machine.device<m68000_device>("maincpu")->space(AS_PROGRAM);
843843   state->m_sloop_base = main->install_legacy_readwrite_handler(0x000000, 0x07ffff, FUNC(guardians_sloop_data_r), FUNC(guardians_sloop_data_w));
844   main->set_direct_update_handler(direct_update_delegate_create_static(atarig42_sloop_direct_handler, machine));
844   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_sloop_direct_handler), &machine));
845845
846846   asic65_config(machine, ASIC65_GUARDIANS);
847847/*
src/mame/drivers/mpu4drvr.c
r11224r11225
19561956   state->m_IC23G2B   = 0;
19571957
19581958   state->m_prot_col  = 0;
1959   state->m_chr_counter    = 0;
1960   state->m_chr_value      = 0;
19591961}
19601962
19611963static ADDRESS_MAP_START( mpu4_68k_map, AS_PROGRAM, 16 )
r11224r11225
20582060   AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_read, ptm6840_write, 0xff)
20592061   AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_r, pia6821_w, 0xff)
20602062   AM_RANGE(0xe03000, 0xe0300f) AM_DEVREADWRITE8("6840ptm_ic3ss", ptm6840_read, ptm6840_write, 0xff)
2061   AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE(adpcm_r, adpcm_w)  CHR ?
2063   AM_RANGE(0xe04000, 0xe0400f) AM_READWRITE(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE(adpcm_r, adpcm_w)  CHR ?
20622064ADDRESS_MAP_END
20632065
20642066/* Deal 'Em */
r11224r11225
25612563In fact, the software seems deliberately designed to mislead, but is (fortunately for
25622564us) prone to similar weaknesses that allow a per game solution.
25632565
2566See MPU4.c for more info
2567
2568As BwB games aren't yet booting on the 16-bit board, we're duplicating the 8-bit program
2569Precedent suggests this is not that dangerous an assumption to make.
25642570*/
25652571
25662572
r11224r11225
25732579   if (!state->m_current_chr_table)
25742580      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
25752581
2576   if (offset == 0)//initialisation is always at 0x800
2582   if (offset == 0)
25772583   {
2584      if (!state->m_chr_state)
25782585      {
2579         if (call == 0)
2580         {
2581            state->m_init_col =0;
2582         }
2583         else
2584         {
2585            for (x = state->m_init_col; x < 64; x++)
2586            {
2587               if   (state->m_current_chr_table[(x)].call == call)
2588               {
2589                  state->m_init_col = x;
2590                  LOG_CHR_FULL(("BwB Characteriser init column %02X\n",state->m_init_col));
2591                  break;
2592               }
2593            }
2594         }
2586         state->m_chr_state=1;
2587         state->m_chr_counter=0;
25952588      }
2589      if (call == 0)
2590      {
2591         state->m_init_col ++;
2592      }
2593      else
2594      {
2595         state->m_init_col =0;
2596      }
25962597   }
2597   else
2598   state->m_chr_value = space->machine().rand();
2599   for (x = 0; x < 4; x++)
25982600   {
2599      for (x = state->m_prot_col; x < 64;)
2601      if   (state->m_current_chr_table[(x)].call == call)
26002602      {
2601         x++;
2602         if   (state->m_current_chr_table[(x)].call == call)
2603         if (x == 0) // reinit
26032604         {
2604            state->m_prot_col = x;
2605            LOG_CHR(("BwB Characteriser init column %02X\n",state->m_prot_col));
2606            break;
2605            state->m_bwb_return = 0;
26072606         }
2607         state->m_chr_value = bwb_chr_table_common[(state->m_bwb_return)];
2608         state->m_bwb_return++;
2609         break;
26082610      }
26092611   }
26102612}
r11224r11225
26122614static READ16_HANDLER( bwb_characteriser16_r )
26132615{
26142616   mpu4_state *state = space->machine().driver_data<mpu4_state>();
2615   if (!state->m_current_chr_table)
2616      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
26172617
26182618   LOG_CHR(("Characteriser read offset %02X \n",offset));
26192619
26202620
26212621   if (offset ==0)
26222622   {
2623      LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_init_col].response));
2624      return state->m_current_chr_table[state->m_init_col].response;
2623      switch (state->m_chr_counter)
2624      {
2625         case 6:
2626         case 13:
2627         case 20:
2628         case 27:
2629         case 34:
2630         {
2631            return state->m_bwb_chr_table1[(((state->m_chr_counter + 1) / 7) - 1)].response;
2632            break;
2633         }
2634         default:
2635         {
2636            if (state->m_chr_counter > 34)
2637            {
2638               state->m_chr_counter = 35;
2639               state->m_chr_state = 2;
2640            }
2641            state->m_chr_counter ++;
2642            return state->m_chr_value;
2643         }
2644      }
26252645   }
26262646   else
26272647   {
2628      LOG_CHR(("Characteriser read BwB data %02X \n",state->m_current_chr_table[state->m_prot_col].response));
2629      return state->m_current_chr_table[state->m_prot_col].response;
2648      return state->m_chr_value;
26302649   }
26312650}
26322651
r11224r11225
27732792   {0x0D, 0x04}, {0x1F, 0x64}, {0x16, 0x24}, {0x05, 0x64}, {0x13, 0x24}, {0x1C, 0x64}, {0x02, 0x74}, {0x00, 0x00}
27742793};
27752794
2776static const mpu4_chr_table prizeinv_data[72] = {
2777{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x00, 0x00},{0x2e, 0x36},{0x20, 0x42},
2778{0x0f, 0x27},{0x24, 0x42},{0x3c, 0x09},{0x2c, 0x01},{0x01, 0x1d},{0x1d, 0x40},{0x40, 0xd2},{0xd2, 0x01},
2779{0x01, 0xf9},{0xb1, 0x41},{0x41, 0x1c},{0x1c, 0x01},{0x01, 0xf9},{0x04, 0x54},{0x54, 0x02},{0x02, 0x00},
2780{0x00, 0x00},{0x00, 0x2e},{0x2e, 0x20},{0x20, 0x0f},{0x0f, 0x24},{0x24, 0x3c},{0x3c, 0x39},{0x3c, 0xc9},
2781{0xc9, 0x05},{0x05, 0x04},{0x04, 0x54},{0x54, 0x02},{0x02, 0x00},{0x00, 0x00},{0x00, 0x2e},{0x2e, 0x20},
2782{0x20, 0x0f},{0x0f, 0x24},{0x24, 0x3c},{0x3c, 0x39},{0x3c, 0x36},{0x36, 0x00},{0x42, 0x04},{0x27, 0x04},
2783{0x42, 0x0c},{0x09, 0x0c},{0x42, 0x1c},{0x27, 0x14},{0x42, 0x2c},{0x42, 0x5c},{0x09, 0x2c},
2784//All this may be garbage - the ROM table seems endless
2785{0x0A, 0x00},
2786{0x31, 0x20},{0x34, 0x90}, {0x1e, 0x40},{0x04, 0x90},{0x01, 0xe4},{0x0c, 0xf4},{0x18, 0x64},{0x19, 0x10},
2787{0x00, 0x00},{0x01, 0x00},{0x04, 0x00},{0x09, 0x00},{0x10, 0x00},{0x19, 0x10},{0x24, 0x00},{0x31, 0x00}
2795
2796static const bwb_chr_table prizeinv_data1[5] = {
2797//This is all wrong, but without BwB Vid booting,
2798//I can't find the right values. These should be close though
2799   {0x67},{0x17},{0x0f},{0x24},{0x3c},
27882800};
27892801
2802static const mpu4_chr_table prizeinv_data[8] = {
2803{0xEF, 0x02},{0x81, 0x00},{0xCE, 0x00},{0x00, 0x2e},
2804{0x06, 0x20},{0xC6, 0x0f},{0xF8, 0x24},{0x8E, 0x3c},
2805};
2806
27902807static DRIVER_INIT (adders)
27912808{
27922809   mpu4_state *state = machine.driver_data<mpu4_state>();
r11224r11225
34903507GAME( 199?,  prizeinv,  0,        bwbvid,   mpu4,     prizeinv, ROT0, "BwB",         "Prize Space Invaders (20\" v1.1)",                           GAME_NOT_WORKING )
34913508GAME( 199?,  blox,      0,        bwbvid,   mpu4,     0,        ROT0, "BwB",         "Blox (v2.0)",                                          GAME_NOT_WORKING )
34923509GAME( 199?,  bloxd,     blox,     bwbvid,   mpu4,     0,        ROT0, "BwB",         "Blox (v2.0, Datapak)",                                    GAME_NOT_WORKING )
3493GAME( 1996,  renoreel,  0,        bwbvid5,  mpu4,     0,      ROT0, "BwB",         "Reno Reels (20p/10GBP Cash, release A)",                     GAME_NOT_WORKING )
3510GAME( 1996,  renoreel,  0,        bwbvid5,  mpu4,     prizeinv,   ROT0, "BwB",         "Reno Reels (20p/10GBP Cash, release A)",                     GAME_NOT_WORKING )
34943511GAME( 199?,  redhtpkr,  0,        bwbvid,   mpu4,     0,       ROT0, "BwB",         "Red Hot Poker (20p/10GBP Cash, release 3)",                  GAME_NOT_WORKING )
34953512GAME( 199?,  bwbtetrs,  0,        bwbvid,   mpu4,     0,       ROT0, "BwB",         "BwB Tetris v 2.2",                                       GAME_NOT_WORKING )
src/mame/drivers/firebeat.c
r11224r11225
22102210
22112211/*****************************************************************************/
22122212
2213static void init_lights(running_machine &machine, write32_space_func out1, write32_space_func out2, write32_space_func out3)
2213static void init_lights(running_machine &machine, write32_space_func out1, const char *out1name, write32_space_func out2, const char *out2name, write32_space_func out3, const char *out3name)
22142214{
2215   if(!out1) out1 = lamp_output_w;
2216   if(!out2) out1 = lamp_output2_w;
2217   if(!out3) out1 = lamp_output3_w;
2215   if(!out1) out1 = lamp_output_w, out1name = "lamp_output_w";
2216   if(!out2) out2 = lamp_output2_w, out2name = "lamp_output2_w";
2217   if(!out3) out3 = lamp_output3_w, out3name = "lamp_output3_w";
22182218
2219   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, FUNC(out1));
2220   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, FUNC(out2));
2221   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, FUNC(out3));
2219   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name);
2220   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name);
2221   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name);
22222222}
22232223
22242224static void init_firebeat(running_machine &machine)
r11224r11225
22402240
22412241   set_ibutton(state, rom);
22422242
2243   init_lights(machine, NULL, NULL, NULL);
2243   init_lights(machine, FUNC_NULL, FUNC_NULL, FUNC_NULL);
22442244}
22452245
22462246static DRIVER_INIT(ppp)
22472247{
22482248   init_firebeat(machine);
2249   init_lights(machine, lamp_output_ppp_w, lamp_output2_ppp_w, lamp_output3_ppp_w);
2249   init_lights(machine, FUNC(lamp_output_ppp_w), FUNC(lamp_output2_ppp_w), FUNC(lamp_output3_ppp_w));
22502250}
22512251
22522252static DRIVER_INIT(ppd)
22532253{
22542254   firebeat_state *state = machine.driver_data<firebeat_state>();
22552255   init_firebeat(machine);
2256   init_lights(machine, lamp_output_ppp_w, lamp_output2_ppp_w, lamp_output3_ppp_w);
2256   init_lights(machine, FUNC(lamp_output_ppp_w), FUNC(lamp_output2_ppp_w), FUNC(lamp_output3_ppp_w));
22572257
22582258   state->m_cur_cab_data = ppd_cab_data;
22592259}
r11224r11225
22702270{
22712271   firebeat_state *state = machine.driver_data<firebeat_state>();
22722272   init_firebeat(machine);
2273   init_lights(machine, lamp_output_kbm_w, NULL, NULL);
2273   init_lights(machine, FUNC(lamp_output_kbm_w), FUNC_NULL, FUNC_NULL);
22742274
22752275   init_keyboard(machine);
22762276
src/mame/drivers/plygonet.c
r11224r11225
315315
316316DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler )
317317{
318   polygonet_state *state = machine->driver_data<polygonet_state>();
318   polygonet_state *state = machine.driver_data<polygonet_state>();
319319
320320   /* Call the dsp's update handler first */
321321   if (!state->m_dsp56k_update_handler.isnull())
r11224r11225
757757
758758   /* The dsp56k occasionally executes out of mapped memory */
759759   address_space *space = machine.device<dsp56k_device>("dsp")->space(AS_PROGRAM);
760   state->m_dsp56k_update_handler = space->set_direct_update_handler(direct_update_delegate_create_static(plygonet_dsp56k_direct_handler, machine));
760   state->m_dsp56k_update_handler = space->set_direct_update_handler(direct_update_delegate(FUNC(plygonet_dsp56k_direct_handler), &machine));
761761
762762    /* save states */
763763   state->save_item(NAME(state->m_dsp56k_bank00_ram));
src/mame/drivers/spoker.c
r11224r11225
255255ADDRESS_MAP_END
256256
257257static ADDRESS_MAP_START( 3super8_portmap, AS_IO, 8 )
258//   AM_RANGE( 0x1000, 0x1fff ) AM_WRITENOP
258//  AM_RANGE( 0x1000, 0x1fff ) AM_WRITENOP
259259
260260   AM_RANGE( 0x2000, 0x27ff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE_GENERIC( paletteram )
261261   AM_RANGE( 0x2800, 0x2fff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE_GENERIC( paletteram2 )
r11224r11225
268268   AM_RANGE( 0x4003, 0x4003 ) AM_READ_PORT( "DSW4" )
269269   AM_RANGE( 0x4004, 0x4004 ) AM_READ_PORT( "DSW5" )
270270
271//   AM_RANGE( 0x4000, 0x40ff ) AM_WRITENOP
271//  AM_RANGE( 0x4000, 0x40ff ) AM_WRITENOP
272272
273273   AM_RANGE( 0x5000, 0x5fff ) AM_RAM_WRITE( fg_tile_w )  AM_BASE_MEMBER( spoker_state,m_fg_tile_ram )
274274
r11224r11225
518518
519519static INTERRUPT_GEN( spoker_interrupt )
520520{
521//   spoker_state *state = device->machine().driver_data<spoker_state>();
521//  spoker_state *state = device->machine().driver_data<spoker_state>();
522522
523523   device_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE);
524524}
src/mame/drivers/funworld.c
r11224r11225
41344134
41354135  Original Video Klein PCB
41364136  with CPU box.
4137 
4137
41384138*/
41394139ROM_START( witchryl )
41404140   ROM_REGION( 0x10000, "maincpu", 0 )
src/mame/drivers/2mindril.c
r11224r11225
173173{
174174   _2mindril_state *state = space->machine().driver_data<_2mindril_state>();
175175   /*
176   (note: could rather be irq mask)
177   ---- ---- ---x ---- irq lv 5 ack, 0->1 latch
178   ---- ---- ---- x--- irq lv 4 ack, 0->1 latch
179   ---- ---- -??- -??? connected to the other levels?
180   */
176    (note: could rather be irq mask)
177    ---- ---- ---x ---- irq lv 5 ack, 0->1 latch
178    ---- ---- ---- x--- irq lv 4 ack, 0->1 latch
179    ---- ---- -??- -??? connected to the other levels?
180    */
181181   if(((state->irq_reg & 8) == 0) && data & 8)
182182      cputag_set_input_line(space->machine(), "maincpu", 4, CLEAR_LINE);
183183
src/mame/drivers/cojag.c
r11224r11225
298298#include "includes/jaguar.h"
299299
300300
301//#define JAGUAR_CLOCK      XTAL_52MHz
301#define COJAG_CLOCK         XTAL_52MHz
302302#define R3000_CLOCK         XTAL_40MHz
303303#define M68K_CLOCK         XTAL_50MHz
304304
r11224r11225
11341134   MCFG_CPU_CONFIG(r3000_config)
11351135   MCFG_CPU_PROGRAM_MAP(r3000_map)
11361136
1137   MCFG_CPU_ADD("gpu", JAGUARGPU, JAGUAR_CLOCK)
1137   MCFG_CPU_ADD("gpu", JAGUARGPU, COJAG_CLOCK/2)
11381138   MCFG_CPU_CONFIG(gpu_config)
11391139   MCFG_CPU_PROGRAM_MAP(gpu_map)
11401140
1141   MCFG_CPU_ADD("audiocpu", JAGUARDSP, JAGUAR_CLOCK)
1141   MCFG_CPU_ADD("audiocpu", JAGUARDSP, COJAG_CLOCK/2)
11421142   MCFG_CPU_CONFIG(dsp_config)
11431143   MCFG_CPU_PROGRAM_MAP(dsp_map)
11441144
src/mame/drivers/segas24.c
r11224r11225
331331   just made a copy & renamed them for now to avoid any conflicts
332332*/
333333
334#define ADDRESS_MAP_MODERN
334335#include "emu.h"
335336#include "deprecat.h"
336337#include "cpu/m68000/m68000.h"
r11224r11225
343344
344345#define MASTER_CLOCK      XTAL_20MHz
345346#define VIDEO_CLOCK         XTAL_32MHz
347#define TIMER_CLOCK         (VIDEO_CLOCK/4)
348#define HSYNC_CLOCK         (VIDEO_CLOCK/2/656.0)
346349
347
348350// Floppy Fisk Controller
349351
350
351static void fdc_init(running_machine &machine)
352void segas24_state::fdc_init()
352353{
353   segas24_state *state = machine.driver_data<segas24_state>();
354   state->m_fdc_status = 0;
355   state->m_fdc_track = 0;
356   state->m_fdc_sector = 0;
357   state->m_fdc_data = 0;
358   state->m_fdc_phys_track = 0;
359   state->m_fdc_irq = 0;
360   state->m_fdc_drq = 0;
361   state->m_fdc_index_count = 0;
354   fdc_status = 0;
355   fdc_track = 0;
356   fdc_sector = 0;
357   fdc_data = 0;
358   fdc_phys_track = 0;
359   fdc_irq = 0;
360   fdc_drq = 0;
361   fdc_index_count = 0;
362362}
363363
364static READ16_HANDLER( fdc_r )
364READ16_MEMBER( segas24_state::fdc_r )
365365{
366   segas24_state *state = space->machine().driver_data<segas24_state>();
367   if(!state->m_track_size)
366   if(!track_size)
368367      return 0xffff;
369368
370369   switch(offset) {
371370   case 0:
372      state->m_fdc_irq = 0;
373      return state->m_fdc_status;
371      fdc_irq = 0;
372      return fdc_status;
374373   case 1:
375      return state->m_fdc_track;
374      return fdc_track;
376375   case 2:
377      return state->m_fdc_sector;
376      return fdc_sector;
378377   case 3:
379378   default: {
380      int res = state->m_fdc_data;
381      if(state->m_fdc_drq) {
382         state->m_fdc_span--;
383         //          logerror("Read %02x (%d)\n", res, state->m_fdc_span);
384         if(state->m_fdc_span) {
385            state->m_fdc_pt++;
386            state->m_fdc_data = *state->m_fdc_pt;
379      int res = fdc_data;
380      if(fdc_drq) {
381         fdc_span--;
382         //          logerror("Read %02x (%d)\n", res, fdc_span);
383         if(fdc_span) {
384            fdc_pt++;
385            fdc_data = *fdc_pt;
387386         } else {
388387            logerror("FDC: transfert complete\n");
389            state->m_fdc_drq = 0;
390            state->m_fdc_status = 0;
391            state->m_fdc_irq = 1;
388            fdc_drq = 0;
389            fdc_status = 0;
390            fdc_irq = 1;
392391         }
393392      } else
394393         logerror("FDC: data read with drq down\n");
r11224r11225
397396   }
398397}
399398
400static WRITE16_HANDLER( fdc_w )
399WRITE16_MEMBER( segas24_state::fdc_w )
401400{
402   segas24_state *state = space->machine().driver_data<segas24_state>();
403   if(!state->m_track_size)
401   if(!track_size)
404402      return;
405403
406404   if(ACCESSING_BITS_0_7) {
407405      data &= 0xff;
408406      switch(offset) {
409407      case 0:
410         state->m_fdc_irq = 0;
408         fdc_irq = 0;
411409         switch(data >> 4) {
412410         case 0x0:
413411            logerror("FDC: Restore\n");
414            state->m_fdc_phys_track = state->m_fdc_track = 0;
415            state->m_fdc_irq = 1;
416            state->m_fdc_status = 4;
412            fdc_phys_track = fdc_track = 0;
413            fdc_irq = 1;
414            fdc_status = 4;
417415            break;
418416         case 0x1:
419            logerror("FDC: Seek %d\n", state->m_fdc_data);
420            state->m_fdc_phys_track = state->m_fdc_track = state->m_fdc_data;
421            state->m_fdc_irq = 1;
422            state->m_fdc_status = state->m_fdc_track ? 0 : 4;
417            logerror("FDC: Seek %d\n", fdc_data);
418            fdc_phys_track = fdc_track = fdc_data;
419            fdc_irq = 1;
420            fdc_status = fdc_track ? 0 : 4;
423421            break;
424422         case 0x9:
425            logerror("Read multiple [%02x] %d..%d side %d track %d\n", data, state->m_fdc_sector, state->m_fdc_sector+state->m_fdc_data-1, data & 8 ? 1 : 0, state->m_fdc_phys_track);
426            state->m_fdc_pt = space->machine().region("floppy")->base() + state->m_track_size*(2*state->m_fdc_phys_track+(data & 8 ? 1 : 0));
427            state->m_fdc_span = state->m_track_size;
428            state->m_fdc_status = 3;
429            state->m_fdc_drq = 1;
430            state->m_fdc_data = *state->m_fdc_pt;
423            logerror("Read multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track);
424            fdc_pt = machine().region("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
425            fdc_span = track_size;
426            fdc_status = 3;
427            fdc_drq = 1;
428            fdc_data = *fdc_pt;
431429            break;
432430         case 0xb:
433            logerror("Write multiple [%02x] %d..%d side %d track %d\n", data, state->m_fdc_sector, state->m_fdc_sector+state->m_fdc_data-1, data & 8 ? 1 : 0, state->m_fdc_phys_track);
434            state->m_fdc_pt = space->machine().region("floppy")->base() + state->m_track_size*(2*state->m_fdc_phys_track+(data & 8 ? 1 : 0));
435            state->m_fdc_span = state->m_track_size;
436            state->m_fdc_status = 3;
437            state->m_fdc_drq = 1;
431            logerror("Write multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track);
432            fdc_pt = machine().region("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
433            fdc_span = track_size;
434            fdc_status = 3;
435            fdc_drq = 1;
438436            break;
439437         case 0xd:
440438            logerror("FDC: Forced interrupt\n");
441            state->m_fdc_span = 0;
442            state->m_fdc_drq = 0;
443            state->m_fdc_irq = data & 1;
444            state->m_fdc_status = 0;
439            fdc_span = 0;
440            fdc_drq = 0;
441            fdc_irq = data & 1;
442            fdc_status = 0;
445443            break;
446444         case 0xf:
447445            if(data == 0xfe)
448               logerror("FDC: Assign mode %02x\n", state->m_fdc_data);
446               logerror("FDC: Assign mode %02x\n", fdc_data);
449447            else if(data == 0xfd)
450               logerror("FDC: Assign parameter %02x\n", state->m_fdc_data);
448               logerror("FDC: Assign parameter %02x\n", fdc_data);
451449            else
452450               logerror("FDC: Unknown command %02x\n", data);
453451            break;
r11224r11225
458456         break;
459457      case 1:
460458         logerror("FDC: Track register %02x\n", data);
461         state->m_fdc_track = data;
459         fdc_track = data;
462460         break;
463461      case 2:
464462         logerror("FDC: Sector register %02x\n", data);
465         state->m_fdc_sector = data;
463         fdc_sector = data;
466464         break;
467465      case 3:
468         if(state->m_fdc_drq) {
469            //              logerror("Write %02x (%d)\n", data, state->m_fdc_span);
470            *state->m_fdc_pt++ = data;
471            state->m_fdc_span--;
472            if(!state->m_fdc_span) {
466         if(fdc_drq) {
467            //              logerror("Write %02x (%d)\n", data, fdc_span);
468            *fdc_pt++ = data;
469            fdc_span--;
470            if(!fdc_span) {
473471               logerror("FDC: transfert complete\n");
474               state->m_fdc_drq = 0;
475               state->m_fdc_status = 0;
476               state->m_fdc_irq = 1;
472               fdc_drq = 0;
473               fdc_status = 0;
474               fdc_irq = 1;
477475            }
478476         } else
479477            logerror("FDC: Data register %02x\n", data);
480         state->m_fdc_data = data;
478         fdc_data = data;
481479         break;
482480      }
483481   }
484482}
485483
486static READ16_HANDLER( fdc_status_r )
484READ16_MEMBER( segas24_state::fdc_status_r )
487485{
488   segas24_state *state = space->machine().driver_data<segas24_state>();
489   if(!state->m_track_size)
486   if(!track_size)
490487      return 0xffff;
491488
492   return 0x90 | (state->m_fdc_irq ? 2 : 0) | (state->m_fdc_drq ? 1 : 0) | (state->m_fdc_phys_track ? 0x40 : 0) | (state->m_fdc_index_count ? 0x20 : 0);
489   return 0x90 | (fdc_irq ? 2 : 0) | (fdc_drq ? 1 : 0) | (fdc_phys_track ? 0x40 : 0) | (fdc_index_count ? 0x20 : 0);
493490}
494491
495static WRITE16_HANDLER( fdc_ctrl_w )
492WRITE16_MEMBER( segas24_state::fdc_ctrl_w )
496493{
497494   if(ACCESSING_BITS_0_7)
498495      logerror("FDC control %02x\n", data & 0xff);
r11224r11225
501498
502499// I/O Mappers
503500
504static UINT8 hotrod_io_r(running_machine &machine, int port)
501UINT8 segas24_state::hotrod_io_r(UINT8 port)
505502{
506503   switch(port)
507504   {
508505   case 0:
509      return input_port_read(machine, "P1");
506      return input_port_read(machine(), "P1");
510507   case 1:
511      return input_port_read(machine, "P2");
508      return input_port_read(machine(), "P2");
512509   case 2:
513      return input_port_read_safe(machine, "P3", 0xff);
510      return input_port_read_safe(machine(), "P3", 0xff);
514511   case 3:
515512      return 0xff;
516513   case 4:
517      return input_port_read(machine, "SERVICE");
514      return input_port_read(machine(), "SERVICE");
518515   case 5: // Dip switches
519      return input_port_read(machine, "COINAGE");
516      return input_port_read(machine(), "COINAGE");
520517   case 6:
521      return input_port_read(machine, "DSW");
518      return input_port_read(machine(), "DSW");
522519   case 7: // DAC
523520      return 0xff;
524521   }
525522   return 0x00;
526523}
527524
528static UINT8 dcclub_io_r(running_machine &machine, int port)
525UINT8 segas24_state::dcclub_io_r(UINT8 port)
529526{
530527   switch(port)
531528   {
532529   case 0:
533530   {
534531      static const UINT8 pos[16] = { 0, 1, 3, 2, 6, 4, 12, 8, 9 };
535      return (input_port_read(machine, "P1") & 0xf) | ((~pos[input_port_read(machine, "PADDLE")>>4]<<4) & 0xf0);
532      return (input_port_read(machine(), "P1") & 0xf) | ((~pos[input_port_read(machine(), "PADDLE")>>4]<<4) & 0xf0);
536533   }
537534   case 1:
538      return input_port_read(machine, "P2");
535      return input_port_read(machine(), "P2");
539536   case 2:
540537      return 0xff;
541538   case 3:
542539      return 0xff;
543540   case 4:
544      return input_port_read(machine, "SERVICE");
541      return input_port_read(machine(), "SERVICE");
545542   case 5: // Dip switches
546      return input_port_read(machine, "COINAGE");
543      return input_port_read(machine(), "COINAGE");
547544   case 6:
548      return input_port_read(machine, "DSW");
545      return input_port_read(machine(), "DSW");
549546   case 7: // DAC
550547      return 0xff;
551548   }
r11224r11225
553550}
554551
555552
556static UINT8 mahmajn_io_r(running_machine &machine, int port)
553UINT8 segas24_state::mahmajn_io_r(UINT8 port)
557554{
558   segas24_state *state = machine.driver_data<segas24_state>();
559555   static const char *const keynames[] = { "MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5", "P1", "P2" };
560556
561557   switch(port)
562558   {
563559   case 0:
564      return ~(1 << state->m_cur_input_line);
560      return ~(1 << cur_input_line);
565561   case 1:
566562      return 0xff;
567563   case 2:
568      return input_port_read(machine, keynames[state->m_cur_input_line]);
564      return input_port_read(machine(), keynames[cur_input_line]);
569565   case 3:
570566      return 0xff;
571567   case 4:
572      return input_port_read(machine, "SERVICE");
568      return input_port_read(machine(), "SERVICE");
573569   case 5: // Dip switches
574      return input_port_read(machine, "COINAGE");
570      return input_port_read(machine(), "COINAGE");
575571   case 6:
576      return input_port_read(machine, "DSW");
572      return input_port_read(machine(), "DSW");
577573   case 7: // DAC
578574      return 0xff;
579575   }
580576   return 0x00;
581577}
582578
583static void mahmajn_io_w(running_machine &machine, int port, UINT8 data)
579void segas24_state::mahmajn_io_w(UINT8 port, UINT8 data)
584580{
585   segas24_state *state = machine.driver_data<segas24_state>();
586581   switch(port)
587582   {
588583   case 3:
589584      if(data & 4)
590         state->m_cur_input_line = (state->m_cur_input_line + 1) & 7;
585         cur_input_line = (cur_input_line + 1) & 7;
591586      break;
592587   case 7: // DAC
593      dac_signed_data_w(machine.device("dac"), data);
588      dac_signed_data_w(machine().device("dac"), data);
594589      break;
595590   default:
596591      fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
597592   }
598593}
599594
600static void hotrod_io_w(running_machine &machine, int port, UINT8 data)
595void segas24_state::hotrod_io_w(UINT8 port, UINT8 data)
601596{
602597   switch(port)
603598   {
604599   case 3: // Lamps
605600      break;
606601   case 7: // DAC
607      dac_signed_data_w(machine.device("dac"), data);
602      dac_signed_data_w(machine().device("dac"), data);
608603      break;
609604   default:
610605      fprintf(stderr, "Port %d : %02x\n", port, data & 0xff);
r11224r11225
612607}
613608
614609
615static WRITE16_HANDLER( hotrod3_ctrl_w )
610WRITE16_MEMBER( segas24_state::hotrod3_ctrl_w )
616611{
617   segas24_state *state = space->machine().driver_data<segas24_state>();
618612   static const char *const portnames[] = { "PEDAL1", "PEDAL2", "PEDAL3", "PEDAL4" };
619613
620614   if(ACCESSING_BITS_0_7)
621615   {
622616      data &= 3;
623      state->m_hotrod_ctrl_cur = input_port_read_safe(space->machine(), portnames[data], 0);
617      hotrod_ctrl_cur = input_port_read_safe(machine(), portnames[data], 0);
624618   }
625619}
626620
627static READ16_HANDLER( hotrod3_ctrl_r )
621READ16_MEMBER( segas24_state::hotrod3_ctrl_r )
628622{
629   segas24_state *state = space->machine().driver_data<segas24_state>();
630623   if(ACCESSING_BITS_0_7)
631624   {
632625      switch(offset)
633626      {
634627         // Steering dials
635628         case 0:
636            return input_port_read_safe(space->machine(), "DIAL1", 0) & 0xff;
629            return input_port_read_safe(machine(), "DIAL1", 0) & 0xff;
637630         case 1:
638            return input_port_read_safe(space->machine(), "DIAL1", 0) >> 8;
631            return input_port_read_safe(machine(), "DIAL1", 0) >> 8;
639632         case 2:
640            return input_port_read_safe(space->machine(), "DIAL2", 0) & 0xff;
633            return input_port_read_safe(machine(), "DIAL2", 0) & 0xff;
641634         case 3:
642            return input_port_read_safe(space->machine(), "DIAL2", 0) >> 8;
635            return input_port_read_safe(machine(), "DIAL2", 0) >> 8;
643636         case 4:
644            return input_port_read_safe(space->machine(), "DIAL3", 0) & 0xff;
637            return input_port_read_safe(machine(), "DIAL3", 0) & 0xff;
645638         case 5:
646            return input_port_read_safe(space->machine(), "DIAL3", 0) >> 8;
639            return input_port_read_safe(machine(), "DIAL3", 0) >> 8;
647640         case 6:
648            return input_port_read_safe(space->machine(), "DIAL4", 0) & 0xff;
641            return input_port_read_safe(machine(), "DIAL4", 0) & 0xff;
649642         case 7:
650            return input_port_read_safe(space->machine(), "DIAL4", 0) >> 8;
643            return input_port_read_safe(machine(), "DIAL4", 0) >> 8;
651644
652645         case 8:
653646         {
654647            // Serial ADCs for the accel
655            int v = state->m_hotrod_ctrl_cur & 0x80;
656            state->m_hotrod_ctrl_cur <<= 1;
648            int v = hotrod_ctrl_cur & 0x80;
649            hotrod_ctrl_cur <<= 1;
657650            return v ? 0xff : 0;
658651         }
659652      }
r11224r11225
661654   return 0;
662655}
663656
664static READ16_HANDLER( iod_r )
657READ16_MEMBER( segas24_state::iod_r )
665658{
666   logerror("IO daughterboard read %02x (%x)\n", offset, cpu_get_pc(&space->device()));
659   logerror("IO daughterboard read %02x (%x)\n", offset, cpu_get_pc(&space.device()));
667660   return 0xffff;
668661}
669662
670static WRITE16_HANDLER( iod_w )
663WRITE16_MEMBER( segas24_state::iod_w )
671664{
672   logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space->device()));
665   logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
673666}
674667
675668
676669// Cpu #1 reset control
677670
678671
679static void reset_reset(running_machine &machine)
672void segas24_state::reset_reset()
680673{
681   segas24_state *state = machine.driver_data<segas24_state>();
682   int changed = state->m_resetcontrol ^ state->m_prev_resetcontrol;
674   int changed = resetcontrol ^ prev_resetcontrol;
683675   if(changed & 2) {
684      if(state->m_resetcontrol & 2) {
685         cputag_set_input_line(machine, "sub", INPUT_LINE_HALT, CLEAR_LINE);
686         cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, PULSE_LINE);
676      if(resetcontrol & 2) {
677         cputag_set_input_line(machine(), "sub", INPUT_LINE_HALT, CLEAR_LINE);
678         cputag_set_input_line(machine(), "sub", INPUT_LINE_RESET, PULSE_LINE);
687679//          mame_printf_debug("enable 2nd cpu!\n");
688680//          debugger_break(machine);
689         s24_fd1094_machine_init(machine);
681         s24_fd1094_machine_init(machine());
690682
691683      } else
692         cputag_set_input_line(machine, "sub", INPUT_LINE_HALT, ASSERT_LINE);
684         cputag_set_input_line(machine(), "sub", INPUT_LINE_HALT, ASSERT_LINE);
693685   }
694686   if(changed & 4)
695      devtag_reset(machine, "ymsnd");
696   state->m_prev_resetcontrol = state->m_resetcontrol;
687      devtag_reset(machine(), "ymsnd");
688   prev_resetcontrol = resetcontrol;
697689}
698690
699static void resetcontrol_w(address_space *space, UINT8 data)
691void segas24_state::reset_control_w(UINT8 data)
700692{
701   segas24_state *state = space->machine().driver_data<segas24_state>();
702   state->m_resetcontrol = data;
703   logerror("Reset control %02x ('%s':%x)\n", state->m_resetcontrol, space->device().tag(), cpu_get_pc(&space->device()));
704   reset_reset(space->machine());
693   resetcontrol = data;
694   reset_reset();
705695}
706696
707697
708698// Rom board bank access
709699
710700
711static void reset_bank(running_machine &machine)
701void segas24_state::reset_bank()
712702{
713   segas24_state *state = machine.driver_data<segas24_state>();
714   if (machine.region("romboard")->base())
703   if (machine().region("romboard")->base())
715704   {
716      memory_set_bank(machine, "bank1", state->m_curbank & 15);
717      memory_set_bank(machine, "bank2", state->m_curbank & 15);
705      memory_set_bank(machine(), "bank1", curbank & 15);
706      memory_set_bank(machine(), "bank2", curbank & 15);
718707   }
719708}
720709
721static READ16_HANDLER( curbank_r )
710READ16_MEMBER( segas24_state::curbank_r )
722711{
723   segas24_state *state = space->machine().driver_data<segas24_state>();
724   return state->m_curbank;
712   return curbank;
725713}
726714
727static WRITE16_HANDLER( curbank_w )
715WRITE16_MEMBER( segas24_state::curbank_w )
728716{
729   segas24_state *state = space->machine().driver_data<segas24_state>();
730717   if(ACCESSING_BITS_0_7) {
731      state->m_curbank = data & 0xff;
732      reset_bank(space->machine());
718      curbank = data & 0xff;
719      reset_bank();
733720   }
734721}
735722
r11224r11225
737724
738725// Protection magic latch
739726
740static const UINT8  mahmajn_mlt[8] = { 5, 1, 6, 2, 3, 7, 4, 0 };
741static const UINT8 mahmajn2_mlt[8] = { 6, 0, 5, 3, 1, 4, 2, 7 };
742static const UINT8      qgh_mlt[8] = { 3, 7, 4, 0, 2, 6, 5, 1 };
743static const UINT8 bnzabros_mlt[8] = { 2, 4, 0, 5, 7, 3, 1, 6 };
744static const UINT8   qrouka_mlt[8] = { 1, 6, 4, 7, 0, 5, 3, 2 };
745static const UINT8 quizmeku_mlt[8] = { 0, 3, 2, 4, 6, 1, 7, 5 };
746static const UINT8   dcclub_mlt[8] = { 4, 7, 3, 0, 2, 6, 5, 1 };
727const UINT8  segas24_state::mahmajn_mlt[8] = { 5, 1, 6, 2, 3, 7, 4, 0 };
728const UINT8 segas24_state::mahmajn2_mlt[8] = { 6, 0, 5, 3, 1, 4, 2, 7 };
729const UINT8      segas24_state::qgh_mlt[8] = { 3, 7, 4, 0, 2, 6, 5, 1 };
730const UINT8 segas24_state::bnzabros_mlt[8] = { 2, 4, 0, 5, 7, 3, 1, 6 };
731const UINT8   segas24_state::qrouka_mlt[8] = { 1, 6, 4, 7, 0, 5, 3, 2 };
732const UINT8 segas24_state::quizmeku_mlt[8] = { 0, 3, 2, 4, 6, 1, 7, 5 };
733const UINT8   segas24_state::dcclub_mlt[8] = { 4, 7, 3, 0, 2, 6, 5, 1 };
747734
748735
749static READ16_HANDLER( mlatch_r )
736READ16_MEMBER( segas24_state::mlatch_r )
750737{
751   segas24_state *state = space->machine().driver_data<segas24_state>();
752   return state->m_mlatch;
738   return mlatch;
753739}
754740
755static WRITE16_HANDLER( mlatch_w )
741WRITE16_MEMBER( segas24_state::mlatch_w )
756742{
757   segas24_state *state = space->machine().driver_data<segas24_state>();
758743   if(ACCESSING_BITS_0_7) {
759744      int i;
760745      UINT8 mxor = 0;
761      if(!state->m_mlatch_table) {
762         logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space->device().tag(), cpu_get_pc(&space->device()));
746      if(!mlatch_table) {
747         logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space.device().tag(), cpu_get_pc(&space.device()));
763748         return;
764749      }
765750
r11224r11225
767752
768753      if(data != 0xff) {
769754         for(i=0; i<8; i++)
770            if(state->m_mlatch & (1<<i))
771               mxor |= 1 << state->m_mlatch_table[i];
772         state->m_mlatch = data ^ mxor;
773         logerror("Magic latching %02x ^ %02x as %02x (%s:%x)\n", data & 0xff, mxor, state->m_mlatch, space->device().tag(), cpu_get_pc(&space->device()));
755            if(mlatch & (1<<i))
756               mxor |= 1 << mlatch_table[i];
757         mlatch = data ^ mxor;
758         logerror("Magic latching %02x ^ %02x as %02x (%s:%x)\n", data & 0xff, mxor, mlatch, space.device().tag(), cpu_get_pc(&space.device()));
774759      } else {
775         logerror("Magic latch reset (%s:%x)\n", space->device().tag(), cpu_get_pc(&space->device()));
776         state->m_mlatch = 0x00;
760         logerror("Magic latch reset (%s:%x)\n", space.device().tag(), cpu_get_pc(&space.device()));
761         mlatch = 0x00;
777762      }
778763   }
779764}
r11224r11225
788773   IRQ_SPRITE = 4
789774};
790775
776void segas24_state::irq_timer_sync()
777{
778   attotime ctime = machine().time();
791779
780   switch(irq_tmode) {
781   case 0:
782      break;
783   case 1: {
784      // Don't remove the floor(), the value may be slightly negative
785      int ppos = floor((irq_synctime - irq_vsynctime).as_double() * HSYNC_CLOCK);
786      int cpos = floor((ctime - irq_vsynctime).as_double() * HSYNC_CLOCK);
787      irq_tval += cpos-ppos;
788      break;
789   }
790   case 2: {
791      abort();
792   }
793   case 3: {
794      int ppos = floor((irq_synctime - irq_vsynctime).as_double() * TIMER_CLOCK);
795      int cpos = floor((ctime - irq_vsynctime).as_double() * TIMER_CLOCK);
796      irq_tval += cpos-ppos;
797      break;
798   }
799   }
800
801   irq_synctime = ctime;
802}
803
804void segas24_state::irq_timer_start(int old_tmode)
805{
806   switch(irq_tmode) {
807   case 0:
808      if(old_tmode) {
809         irq_tval++;
810         if(irq_tval == 0x1000)
811            irq_timer->adjust(attotime::zero);
812         else
813            irq_timer->enable(false);
814      }
815      break;
816   case 1: {
817      int count = 0x1000 - irq_tval;
818      irq_timer->adjust(attotime::from_hz(HSYNC_CLOCK)*count);
819      break;
820   }
821   case 2:
822      abort();
823      break;
824   case 3: {
825      int count = 0x1000 - irq_tval;
826      irq_timer->adjust(attotime::from_hz(TIMER_CLOCK)*count);
827      break;
828   }
829   }
830}
831
792832static TIMER_DEVICE_CALLBACK( irq_timer_cb )
793833{
794834   segas24_state *state = timer.machine().driver_data<segas24_state>();
795   state->m_irq_timer_pend0 = state->m_irq_timer_pend1 = 1;
796   if(state->m_irq_allow0 & (1 << IRQ_TIMER))
835   state->irq_timer_sync();
836
837   if(state->irq_tval != 0x1000)
838      fprintf(stderr, "Error: timer desync %x != 1000\n", state->irq_tval);
839
840   state->irq_tval = state->irq_tdata;
841   state->irq_timer_start(state->irq_tmode);
842
843   state->irq_timer_pend0 = state->irq_timer_pend1 = 1;
844   if(state->irq_allow0 & (1 << IRQ_TIMER))
797845      cputag_set_input_line(timer.machine(), "maincpu", IRQ_TIMER+1, ASSERT_LINE);
798   if(state->m_irq_allow1 & (1 << IRQ_TIMER))
846   if(state->irq_allow1 & (1 << IRQ_TIMER))
799847      cputag_set_input_line(timer.machine(), "sub", IRQ_TIMER+1, ASSERT_LINE);
848
849   if(state->irq_tmode == 1 || state->irq_tmode == 2)
850      timer.machine().primary_screen->update_now();
800851}
801852
802853static TIMER_DEVICE_CALLBACK( irq_timer_clear_cb )
803854{
804855   segas24_state *state = timer.machine().driver_data<segas24_state>();
805   state->m_irq_sprite = state->m_irq_vblank = 0;
856   state->irq_sprite = state->irq_vblank = 0;
806857   cputag_set_input_line(timer.machine(), "maincpu", IRQ_VBLANK+1, CLEAR_LINE);
807858   cputag_set_input_line(timer.machine(), "maincpu", IRQ_SPRITE+1, CLEAR_LINE);
808859   cputag_set_input_line(timer.machine(), "sub", IRQ_VBLANK+1, CLEAR_LINE);
809860   cputag_set_input_line(timer.machine(), "sub", IRQ_SPRITE+1, CLEAR_LINE);
810861}
811862
812static void irq_init(running_machine &machine)
863void segas24_state::irq_init()
813864{
814   segas24_state *state = machine.driver_data<segas24_state>();
815   state->m_irq_timera = 0;
816   state->m_irq_timerb = 0;
817   state->m_irq_allow0 = 0;
818   state->m_irq_allow1 = 0;
819   state->m_irq_timer_pend0 = 0;
820   state->m_irq_timer_pend1 = 0;
821   state->m_irq_vblank = 0;
822   state->m_irq_sprite = 0;
823   state->m_irq_timer = machine.device<timer_device>("irq_timer");
824   state->m_irq_timer_clear = machine.device<timer_device>("irq_timer_clear");
865   irq_tdata = 0;
866   irq_tmode = 0;
867   irq_allow0 = 0;
868   irq_allow1 = 0;
869   irq_timer_pend0 = 0;
870   irq_timer_pend1 = 0;
871   irq_vblank = 0;
872   irq_sprite = 0;
873   irq_timer = machine().device<timer_device>("irq_timer");
874   irq_timer_clear = machine().device<timer_device>("irq_timer_clear");
875   irq_tval = 0;
876   irq_synctime = attotime::zero;
877   irq_vsynctime = attotime::zero;
825878}
826879
827static void irq_timer_reset(running_machine &machine)
880WRITE16_MEMBER(segas24_state::irq_w)
828881{
829   segas24_state *state = machine.driver_data<segas24_state>();
830   int freq = (state->m_irq_timerb << 12) | state->m_irq_timera;
831   freq &= 0x1fff;
832
833   state->m_irq_timer->adjust(attotime::from_hz(freq), 0, attotime::from_hz(freq));
834   logerror("New timer frequency: %0d [%02x %04x]\n", freq, state->m_irq_timerb, state->m_irq_timera);
835}
836
837static WRITE16_HANDLER(irq_w)
838{
839   segas24_state *state = space->machine().driver_data<segas24_state>();
840882   switch(offset) {
841883   case 0: {
842      UINT16 old_ta = state->m_irq_timera;
843      COMBINE_DATA(&state->m_irq_timera);
844      if(old_ta != state->m_irq_timera)
845         irq_timer_reset(space->machine());
884      irq_timer_sync();
885      COMBINE_DATA(&irq_tdata);
886      irq_tdata &= 0xfff;
887      irq_timer_start(irq_tmode);
846888      break;
847889   }
848890   case 1:
849891      if(ACCESSING_BITS_0_7) {
850         UINT8 old_tb = state->m_irq_timerb;
851         state->m_irq_timerb = data;
852         if(old_tb != state->m_irq_timerb)
853            irq_timer_reset(space->machine());
892         UINT8 old_tmode = irq_tmode;
893         irq_timer_sync();
894         irq_tmode = data & 3;
895         irq_timer_start(old_tmode);
854896      }
855897      break;
856898   case 2:
857      state->m_irq_allow0 = data;
858      state->m_irq_timer_pend0 = 0;
859      cputag_set_input_line(space->machine(), "maincpu", IRQ_TIMER+1, CLEAR_LINE);
860      cputag_set_input_line(space->machine(), "maincpu", IRQ_YM2151+1, state->m_irq_yms && (state->m_irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
861      cputag_set_input_line(space->machine(), "maincpu", IRQ_VBLANK+1, state->m_irq_vblank && (state->m_irq_allow0 & (1 << IRQ_VBLANK)) ? ASSERT_LINE : CLEAR_LINE);
862      cputag_set_input_line(space->machine(), "maincpu", IRQ_SPRITE+1, state->m_irq_sprite && (state->m_irq_allow0 & (1 << IRQ_SPRITE)) ? ASSERT_LINE : CLEAR_LINE);
899      irq_allow0 = data & 0x1f;
900      irq_timer_pend0 = 0;
901      cputag_set_input_line(machine(), "maincpu", IRQ_TIMER+1, CLEAR_LINE);
902      cputag_set_input_line(machine(), "maincpu", IRQ_YM2151+1, irq_yms && (irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
903      cputag_set_input_line(machine(), "maincpu", IRQ_VBLANK+1, irq_vblank && (irq_allow0 & (1 << IRQ_VBLANK)) ? ASSERT_LINE : CLEAR_LINE);
904      cputag_set_input_line(machine(), "maincpu", IRQ_SPRITE+1, irq_sprite && (irq_allow0 & (1 << IRQ_SPRITE)) ? ASSERT_LINE : CLEAR_LINE);
863905      break;
864906   case 3:
865      state->m_irq_allow1 = data;
866      state->m_irq_timer_pend1 = 0;
867      cputag_set_input_line(space->machine(), "sub", IRQ_TIMER+1, CLEAR_LINE);
868      cputag_set_input_line(space->machine(), "sub", IRQ_YM2151+1, state->m_irq_yms && (state->m_irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
869      cputag_set_input_line(space->machine(), "sub", IRQ_VBLANK+1, state->m_irq_vblank && (state->m_irq_allow1 & (1 << IRQ_VBLANK)) ? ASSERT_LINE : CLEAR_LINE);
870      cputag_set_input_line(space->machine(), "sub", IRQ_SPRITE+1, state->m_irq_sprite && (state->m_irq_allow1 & (1 << IRQ_SPRITE)) ? ASSERT_LINE : CLEAR_LINE);
907      irq_allow1 = data & 0x1f;
908      irq_timer_pend1 = 0;
909      cputag_set_input_line(machine(), "sub", IRQ_TIMER+1, CLEAR_LINE);
910      cputag_set_input_line(machine(), "sub", IRQ_YM2151+1, irq_yms && (irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
911      cputag_set_input_line(machine(), "sub", IRQ_VBLANK+1, irq_vblank && (irq_allow1 & (1 << IRQ_VBLANK)) ? ASSERT_LINE : CLEAR_LINE);
912      cputag_set_input_line(machine(), "sub", IRQ_SPRITE+1, irq_sprite && (irq_allow1 & (1 << IRQ_SPRITE)) ? ASSERT_LINE : CLEAR_LINE);
871913      break;
872914   }
873915}
874916
875static READ16_HANDLER(irq_r)
917// gground bp at 849c (84a4)
918// cmp.w $a00000, d0   | 16
919// dbeq d1, 84b4       | 10
920// 26 cycles/tour
921// 0x200 counts
922// 656 cycles/ligne
923// 656*0x200/26 = 12918 (3276) -> cd89 (got e087, delta = 1f78, 8056)
924// 410 cycles/ligne
925// 410*0x200/26 = 8073
926
927READ16_MEMBER(segas24_state::irq_r)
876928{
877   segas24_state *state = space->machine().driver_data<segas24_state>();
878929   switch(offset) {
879   case 0: {
880      int pc = cpu_get_pc(&space->device());
881      if(pc == 0x84a4 || pc == 0x84a6)
882         return 0;
883      if(pc == 0x84aa || pc == 0x84ac) {
884         // limit = 0x1b5f
885         state->m_turns = 0x0100;
886         return 1;
887      }
888      if(pc == 0x84ba || pc == 0x84bc) {
889         // 26 cycles/read
890         state->m_turns--;
891         return state->m_turns ? 1 : 0x200;
892      }
893      // 84c8
894      // -> 85ac / 85bc?
895      break;
896   }
897930   case 2:
898      state->m_irq_timer_pend0 = 0;
899      cputag_set_input_line(space->machine(), "maincpu", IRQ_TIMER+1, CLEAR_LINE);
931      irq_timer_pend0 = 0;
932      cputag_set_input_line(machine(), "maincpu", IRQ_TIMER+1, CLEAR_LINE);
900933      break;
901934   case 3:
902      state->m_irq_timer_pend1 = 0;
903      cputag_set_input_line(space->machine(), "sub", IRQ_TIMER+1, CLEAR_LINE);
935      irq_timer_pend1 = 0;
936      cputag_set_input_line(machine(), "sub", IRQ_TIMER+1, CLEAR_LINE);
904937      break;
905938   }
906   return 0xffff;
939   irq_timer_sync();
940   return irq_tval & 0xfff;
907941}
908942
909943static INTERRUPT_GEN(irq_vbl)
r11224r11225
913947
914948   if(cpu_getiloops(device)) {
915949      irq = IRQ_SPRITE;
916      state->m_irq_sprite = 1;
950      state->irq_sprite = 1;
917951   } else {
918952      irq = IRQ_VBLANK;
919      state->m_irq_vblank = 1;
953      state->irq_vblank = 1;
920954   }
921955
922   state->m_irq_timer_clear->adjust(attotime::from_hz(VIDEO_CLOCK/2/656.0));
956   state->irq_timer_clear->adjust(attotime::from_hz(HSYNC_CLOCK));
923957
924958   mask = 1 << irq;
925959
926   if(state->m_irq_allow0 & mask)
960   if(state->irq_allow0 & mask)
927961      cputag_set_input_line(device->machine(), "maincpu", 1+irq, ASSERT_LINE);
928962
929   if(state->m_irq_allow1 & mask)
963   if(state->irq_allow1 & mask)
930964      cputag_set_input_line(device->machine(), "sub", 1+irq, ASSERT_LINE);
931965
932966   if(!cpu_getiloops(device)) {
933967      // Ensure one index pulse every 20 frames
934968      // The is some code in bnzabros at 0x852 that makes it crash
935969      // if the pulse train is too fast
936      state->m_fdc_index_count++;
937      if(state->m_fdc_index_count >= 20)
938         state->m_fdc_index_count = 0;
970      state->fdc_index_count++;
971      if(state->fdc_index_count >= 20)
972         state->fdc_index_count = 0;
939973   }
974
975   state->irq_timer_sync();
976   state->irq_vsynctime = device->machine().time();
940977}
941978
942979static void irq_ym(device_t *device, int irq)
943980{
944981   segas24_state *state = device->machine().driver_data<segas24_state>();
945   state->m_irq_yms = irq;
946   cputag_set_input_line(device->machine(), "maincpu", IRQ_YM2151+1, state->m_irq_yms && (state->m_irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
947   cputag_set_input_line(device->machine(), "sub", IRQ_YM2151+1, state->m_irq_yms && (state->m_irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
982   state->irq_yms = irq;
983   cputag_set_input_line(device->machine(), "maincpu", IRQ_YM2151+1, state->irq_yms && (state->irq_allow0 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
984   cputag_set_input_line(device->machine(), "sub", IRQ_YM2151+1, state->irq_yms && (state->irq_allow1 & (1 << IRQ_YM2151)) ? ASSERT_LINE : CLEAR_LINE);
948985}
949986
950987
988READ16_MEMBER ( segas24_state::sys16_io_r )
989{
990   //  logerror("IO read %02x (%s:%x)\n", offset, space->device().tag(), cpu_get_pc(&space->device()));
991   if(offset < 8)
992      return (this->*io_r)(offset);
993   else if (offset < 0x20) {
994      switch(offset) {
995      case 0x8:
996         return 'S';
997      case 0x9:
998         return 'E';
999      case 0xa:
1000         return 'G';
1001      case 0xb:
1002         return 'A';
1003      case 0xe:
1004         return io_cnt;
1005      case 0xf:
1006         return io_dir;
1007      default:
1008         logerror("IO control read %02x (%s:%x)\n", offset, space.device().tag(), cpu_get_pc(&space.device()));
1009         return 0xff;
1010      }
1011   } else
1012      return iod_r(space, offset & 0x1f, mem_mask);
1013}
1014
1015WRITE16_MEMBER( segas24_state::sys16_io_w )
1016{
1017   if(ACCESSING_BITS_0_7) {
1018      if(offset < 8) {
1019         if(!(io_dir & (1 << offset))) {
1020            logerror("IO port write on input-only port (%d, [%02x], %02x, %s:%x)\n", offset, io_dir, data & 0xff, space.device().tag(), cpu_get_pc(&space.device()));
1021            return;
1022         }
1023         (this->*io_w)(offset, data);
1024      } else if (offset < 0x20) {
1025         switch(offset) {
1026         case 0xe:
1027            io_cnt = data;
1028            reset_control_w(data & 7);
1029            break;
1030         case 0xf:
1031            io_dir = data;
1032            break;
1033         default:
1034            logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space.device().tag(), cpu_get_pc(&space.device()));
1035         }
1036      }
1037   }
1038   if(offset >= 0x20)
1039      iod_w(space, offset & 0x1f, data, mem_mask);
1040}
1041
1042// 315-5242
1043
1044READ16_MEMBER( segas24_state::sys16_paletteram_r )
1045{
1046   return machine().generic.paletteram.u16[offset];
1047}
1048
1049WRITE16_MEMBER( segas24_state::sys16_paletteram_w )
1050{
1051   int r, g, b;
1052   COMBINE_DATA (machine().generic.paletteram.u16 + offset);
1053   data = machine().generic.paletteram.u16[offset];
1054
1055   r = (data & 0x00f) << 4;
1056   if(data & 0x1000)
1057      r |= 8;
1058
1059   g = data & 0x0f0;
1060   if(data & 0x2000)
1061      g |= 8;
1062
1063   b = (data & 0xf00) >> 4;
1064   if(data & 0x4000)
1065      b |= 8;
1066
1067   r |= r >> 5;
1068   g |= g >> 5;
1069   b |= b >> 5;
1070
1071   palette_set_color(machine(), offset, MAKE_RGB(r, g, b));
1072
1073   if(data & 0x8000) {
1074      r = 255-0.6*(255-r);
1075      g = 255-0.6*(255-g);
1076      b = 255-0.6*(255-b);
1077   } else {
1078      r = 0.6*r;
1079      g = 0.6*g;
1080      b = 0.6*b;
1081   }
1082   palette_set_color(machine(), offset+machine().total_colors()/2, MAKE_RGB(r, g, b));
1083}
1084
1085
9511086/*
9521087CPU1:
953108800-03 ROM (1)
r11224r11225
9971132*/
9981133
9991134
1000static ADDRESS_MAP_START( system24_cpu1_map, AS_PROGRAM, 16 )
1135static ADDRESS_MAP_START( system24_cpu1_map, AS_PROGRAM, 16, segas24_state )
10011136   AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x040000) AM_ROM AM_REGION("maincpu", 0)
10021137   AM_RANGE(0x080000, 0x0bffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("share1")
10031138   AM_RANGE(0x100000, 0x13ffff) AM_MIRROR(0x0c0000) AM_ROM AM_REGION("maincpu", 0)
1004   AM_RANGE(0x200000, 0x20ffff) AM_MIRROR(0x110000) AM_READWRITE(sys24_tile_r, sys24_tile_w)
1139   AM_RANGE(0x200000, 0x20ffff) AM_MIRROR(0x110000) AM_DEVREADWRITE("tile", segas24_tile, tile_r, tile_w)
10051140   AM_RANGE(0x220000, 0x220001) AM_MIRROR(0x11fffe) AM_WRITENOP      /* Horizontal split position (ABSEL) */
10061141   AM_RANGE(0x240000, 0x240001) AM_MIRROR(0x11fffe) AM_WRITENOP      /* Scanline trigger position (XHOUT) */
10071142   AM_RANGE(0x260000, 0x260001) AM_MIRROR(0x10fffe) AM_WRITENOP      /* Frame trigger position (XVOUT) */
10081143   AM_RANGE(0x270000, 0x270001) AM_MIRROR(0x10fffe) AM_WRITENOP      /* Synchronization mode */
1009   AM_RANGE(0x280000, 0x29ffff) AM_MIRROR(0x160000) AM_READWRITE(sys24_char_r, sys24_char_w)
1010   AM_RANGE(0x400000, 0x403fff) AM_MIRROR(0x1f8000) AM_READWRITE(system24temp_sys16_paletteram1_r, system24temp_sys16_paletteram1_w) AM_BASE_GENERIC(paletteram)
1011   AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_READWRITE(sys24_mixer_r, sys24_mixer_w)
1012   AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_READWRITE(sys24_sprite_r, sys24_sprite_w)
1013   AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(system24temp_sys16_io_r, system24temp_sys16_io_w)
1014   AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8("ymsnd", ym2151_r, ym2151_w, 0x00ff)
1144   AM_RANGE(0x280000, 0x29ffff) AM_MIRROR(0x160000) AM_DEVREADWRITE("tile", segas24_tile, char_r, char_w)
1145   AM_RANGE(0x400000, 0x403fff) AM_MIRROR(0x1f8000) AM_READWRITE(sys16_paletteram_r, sys16_paletteram_w) AM_BASE_GENERIC(paletteram)
1146   AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_DEVREADWRITE("mixer", segas24_mixer, read, write)
1147   AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_DEVREADWRITE("sprite", segas24_sprite, read, write)
1148   AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(sys16_io_r, sys16_io_w)
1149   AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2151_r, ym2151_w, 0x00ff)
10151150   AM_RANGE(0xa00000, 0xa00007) AM_MIRROR(0x0ffff8) AM_READWRITE(irq_r, irq_w)
10161151   AM_RANGE(0xb00000, 0xb00007) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_r, fdc_w)
10171152   AM_RANGE(0xb00008, 0xb0000f) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_status_r, fdc_ctrl_w)
r11224r11225
10341169 *
10351170 *************************************/
10361171
1037static ADDRESS_MAP_START( system24_cpu2_map, AS_PROGRAM, 16 )
1172static ADDRESS_MAP_START( system24_cpu2_map, AS_PROGRAM, 16, segas24_state )
10381173   AM_RANGE(0x000000, 0x03ffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("share2")
10391174   AM_RANGE(0x080000, 0x0bffff) AM_MIRROR(0x040000) AM_RAM AM_SHARE("share1")
10401175   AM_RANGE(0x100000, 0x13ffff) AM_MIRROR(0x0c0000) AM_ROM AM_REGION("maincpu", 0)
1041   AM_RANGE(0x200000, 0x20ffff) AM_MIRROR(0x110000) AM_READWRITE(sys24_tile_r, sys24_tile_w)
1176   AM_RANGE(0x200000, 0x20ffff) AM_MIRROR(0x110000) AM_DEVREADWRITE("tile", segas24_tile, tile_r, tile_w)
10421177   AM_RANGE(0x220000, 0x220001) AM_MIRROR(0x11fffe) AM_WRITENOP      /* Horizontal split position (ABSEL) */
10431178   AM_RANGE(0x240000, 0x240001) AM_MIRROR(0x11fffe) AM_WRITENOP      /* Scanline trigger position (XHOUT) */
10441179   AM_RANGE(0x260000, 0x260001) AM_MIRROR(0x10fffe) AM_WRITENOP      /* Frame trigger position (XVOUT) */
10451180   AM_RANGE(0x270000, 0x270001) AM_MIRROR(0x10fffe) AM_WRITENOP      /* Synchronization mode */
1046   AM_RANGE(0x280000, 0x29ffff) AM_MIRROR(0x160000) AM_READWRITE(sys24_char_r, sys24_char_w)
1047   AM_RANGE(0x400000, 0x403fff) AM_MIRROR(0x1f8000) AM_READWRITE(system24temp_sys16_paletteram1_r, system24temp_sys16_paletteram1_w)
1048   AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_READWRITE(sys24_mixer_r, sys24_mixer_w)
1049   AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_READWRITE(sys24_sprite_r, sys24_sprite_w)
1050   AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(system24temp_sys16_io_r, system24temp_sys16_io_w)
1051   AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8("ymsnd", ym2151_r, ym2151_w, 0x00ff)
1181   AM_RANGE(0x280000, 0x29ffff) AM_MIRROR(0x160000) AM_DEVREADWRITE("tile", segas24_tile, char_r, char_w)
1182   AM_RANGE(0x400000, 0x403fff) AM_MIRROR(0x1f8000) AM_READWRITE(sys16_paletteram_r, sys16_paletteram_w) AM_BASE_GENERIC(paletteram)
1183   AM_RANGE(0x404000, 0x40401f) AM_MIRROR(0x1fbfe0) AM_DEVREADWRITE("mixer", segas24_mixer, read, write)
1184   AM_RANGE(0x600000, 0x63ffff) AM_MIRROR(0x180000) AM_DEVREADWRITE("sprite", segas24_sprite, read, write)
1185   AM_RANGE(0x800000, 0x80007f) AM_MIRROR(0x1ffe00) AM_READWRITE(sys16_io_r, sys16_io_w)
1186   AM_RANGE(0x800100, 0x800103) AM_MIRROR(0x1ffe00) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2151_r, ym2151_w, 0x00ff)
10521187   AM_RANGE(0xa00000, 0xa00007) AM_MIRROR(0x0ffff8) AM_READWRITE(irq_r, irq_w)
10531188   AM_RANGE(0xb00000, 0xb00007) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_r, fdc_w)
10541189   AM_RANGE(0xb00008, 0xb0000f) AM_MIRROR(0x07fff0) AM_READWRITE(fdc_status_r, fdc_ctrl_w)
r11224r11225
10741209static MACHINE_START( system24 )
10751210{
10761211   segas24_state *state = machine.driver_data<segas24_state>();
1077   if (state->m_track_size)
1078      machine.device<nvram_device>("floppy_nvram")->set_base(machine.region("floppy")->base(), 2*state->m_track_size);
1212   if (state->track_size)
1213      machine.device<nvram_device>("floppy_nvram")->set_base(machine.region("floppy")->base(), 2*state->track_size);
10791214
10801215   UINT8 *usr1 = machine.region("romboard")->base();
10811216   if (usr1)
r11224r11225
10831218      memory_configure_bank(machine, "bank1", 0, 16, usr1, 0x40000);
10841219      memory_configure_bank(machine, "bank2", 0, 16, usr1, 0x40000);
10851220   }
1221
1222   state->vtile = machine.device<segas24_tile>("tile");
1223   state->vsprite = machine.device<segas24_sprite>("sprite");
1224   state->vmixer = machine.device<segas24_mixer>("mixer");
10861225}
10871226
10881227static MACHINE_RESET( system24 )
10891228{
10901229   segas24_state *state = machine.driver_data<segas24_state>();
10911230   cputag_set_input_line(machine, "sub", INPUT_LINE_HALT, ASSERT_LINE);
1092   state->m_prev_resetcontrol = state->m_resetcontrol = 0x06;
1093   fdc_init(machine);
1094   state->m_curbank = 0;
1095   reset_bank(machine);
1096   irq_init(machine);
1097   state->m_mlatch = 0x00;
1231   state->prev_resetcontrol = state->resetcontrol = 0x06;
1232   state->fdc_init();
1233   state->curbank = 0;
1234   state->reset_bank();
1235   state->irq_init();
1236   state->mlatch = 0x00;
10981237}
10991238
11001239/*************************************
r11224r11225
17911930
17921931   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
17931932
1933   MCFG_S24TILE_DEVICE_ADD("tile", 0xfff)
1934   MCFG_S24SPRITE_DEVICE_ADD("sprite")
1935   MCFG_S24MIXER_DEVICE_ADD("mixer")
1936
17941937   MCFG_SCREEN_ADD("screen", RASTER)
17951938   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK/2, 656, 0/*+69*/, 496/*+69*/, 424, 0/*+25*/, 384/*+25*/)
17961939   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
r11224r11225
17981941
17991942   MCFG_PALETTE_LENGTH(8192*2)
18001943
1801   MCFG_VIDEO_START(system24)
1802
18031944   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
18041945
18051946   MCFG_SOUND_ADD("ymsnd", YM2151, 4000000)
r11224r11225
21622303static DRIVER_INIT( qgh )
21632304{
21642305   segas24_state *state = machine.driver_data<segas24_state>();
2165   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2166   state->m_mlatch_table = qgh_mlt;
2167   state->m_track_size = 0;
2306   state->io_r = &segas24_state::hotrod_io_r;
2307   state->io_w = &segas24_state::hotrod_io_w;
2308   state->mlatch_table = segas24_state::qgh_mlt;
2309   state->track_size = 0;
21682310}
21692311
21702312static DRIVER_INIT( dcclub )
21712313{
21722314   segas24_state *state = machine.driver_data<segas24_state>();
2173   system24temp_sys16_io_set_callbacks(machine, dcclub_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2174   state->m_mlatch_table = dcclub_mlt;
2175   state->m_track_size = 0;
2315   state->io_r = &segas24_state::dcclub_io_r;
2316   state->io_w = &segas24_state::hotrod_io_w;
2317   state->mlatch_table = segas24_state::dcclub_mlt;
2318   state->track_size = 0;
21762319}
21772320
21782321static DRIVER_INIT( qrouka )
21792322{
21802323   segas24_state *state = machine.driver_data<segas24_state>();
2181   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2182   state->m_mlatch_table = qrouka_mlt;
2183   state->m_track_size = 0;
2324   state->io_r = &segas24_state::hotrod_io_r;
2325   state->io_w = &segas24_state::hotrod_io_w;
2326   state->mlatch_table = segas24_state::qrouka_mlt;
2327   state->track_size = 0;
21842328}
21852329
21862330static DRIVER_INIT( quizmeku )
21872331{
21882332   segas24_state *state = machine.driver_data<segas24_state>();
2189   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2190   state->m_mlatch_table = quizmeku_mlt;
2191   state->m_track_size = 0;
2333   state->io_r = &segas24_state::hotrod_io_r;
2334   state->io_w = &segas24_state::hotrod_io_w;
2335   state->mlatch_table = segas24_state::quizmeku_mlt;
2336   state->track_size = 0;
21922337}
21932338
21942339static DRIVER_INIT( mahmajn )
21952340{
21962341   segas24_state *state = machine.driver_data<segas24_state>();
2197   system24temp_sys16_io_set_callbacks(machine, mahmajn_io_r, mahmajn_io_w, resetcontrol_w, iod_r, iod_w);
2198   state->m_mlatch_table = mahmajn_mlt;
2199   state->m_track_size = 0;
2200   state->m_cur_input_line = 0;
2342   state->io_r = &segas24_state::mahmajn_io_r;
2343   state->io_w = &segas24_state::mahmajn_io_w;
2344   state->mlatch_table = segas24_state::mahmajn_mlt;
2345   state->track_size = 0;
2346   state->cur_input_line = 0;
22012347}
22022348
22032349static DRIVER_INIT( mahmajn2 )
22042350{
22052351   segas24_state *state = machine.driver_data<segas24_state>();
2206   system24temp_sys16_io_set_callbacks(machine, mahmajn_io_r, mahmajn_io_w, resetcontrol_w, iod_r, iod_w);
2207   state->m_mlatch_table = mahmajn2_mlt;
2208   state->m_track_size = 0;
2209   state->m_cur_input_line = 0;
2352   state->io_r = &segas24_state::mahmajn_io_r;
2353   state->io_w = &segas24_state::mahmajn_io_w;
2354   state->mlatch_table = segas24_state::mahmajn2_mlt;
2355   state->track_size = 0;
2356   state->cur_input_line = 0;
22102357}
22112358
22122359static DRIVER_INIT( hotrod )
22132360{
22142361   segas24_state *state = machine.driver_data<segas24_state>();
2215   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2216   state->m_mlatch_table = 0;
2362   state->io_r = &segas24_state::hotrod_io_r;
2363   state->io_w = &segas24_state::hotrod_io_w;
2364   state->mlatch_table = 0;
22172365
22182366   // Sector  Size
22192367   // 1       8192
r11224r11225
22232371   // 5        512
22242372   // 6        256
22252373
2226   state->m_track_size = 0x2f00;
2374   state->track_size = 0x2f00;
22272375}
22282376
22292377static DRIVER_INIT( bnzabros )
22302378{
22312379   segas24_state *state = machine.driver_data<segas24_state>();
2232   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2233   state->m_mlatch_table = bnzabros_mlt;
2380   state->io_r = &segas24_state::hotrod_io_r;
2381   state->io_w = &segas24_state::hotrod_io_w;
2382   state->mlatch_table = segas24_state::bnzabros_mlt;
22342383
22352384   // Sector  Size
22362385   // 1       2048
r11224r11225
22412390   // 6       1024
22422391   // 7        256
22432392
2244   state->m_track_size = 0x2d00;
2393   state->track_size = 0x2d00;
22452394}
22462395
22472396static DRIVER_INIT( sspirits )
22482397{
22492398   segas24_state *state = machine.driver_data<segas24_state>();
2250   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2251   state->m_mlatch_table = 0;
2252   state->m_track_size = 0x2d00;
2399   state->io_r = &segas24_state::hotrod_io_r;
2400   state->io_w = &segas24_state::hotrod_io_w;
2401   state->mlatch_table = 0;
2402   state->track_size = 0x2d00;
22532403   s24_fd1094_driver_init(machine);
22542404}
22552405
22562406static DRIVER_INIT( sspiritj )
22572407{
22582408   segas24_state *state = machine.driver_data<segas24_state>();
2259   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2260   state->m_mlatch_table = 0;
2261   state->m_track_size = 0x2f00;
2409   state->io_r = &segas24_state::hotrod_io_r;
2410   state->io_w = &segas24_state::hotrod_io_w;
2411   state->mlatch_table = 0;
2412   state->track_size = 0x2f00;
22622413   s24_fd1094_driver_init(machine);
22632414}
22642415
22652416static DRIVER_INIT( dcclubfd )
22662417{
22672418   segas24_state *state = machine.driver_data<segas24_state>();
2268   system24temp_sys16_io_set_callbacks(machine, dcclub_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2269   state->m_mlatch_table = dcclub_mlt;
2270   state->m_track_size = 0x2d00;
2419   state->io_r = &segas24_state::dcclub_io_r;
2420   state->io_w = &segas24_state::hotrod_io_w;
2421   state->mlatch_table = segas24_state::dcclub_mlt;
2422   state->track_size = 0x2d00;
22712423   s24_fd1094_driver_init(machine);
22722424}
22732425
r11224r11225
22752427static DRIVER_INIT( sgmast )
22762428{
22772429   segas24_state *state = machine.driver_data<segas24_state>();
2278   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2279   state->m_mlatch_table = 0;
2280   state->m_track_size = 0x2d00;
2430   state->io_r = &segas24_state::hotrod_io_r;
2431   state->io_w = &segas24_state::hotrod_io_w;
2432   state->mlatch_table = 0;
2433   state->track_size = 0x2d00;
22812434   s24_fd1094_driver_init(machine);
22822435}
22832436
22842437static DRIVER_INIT( qsww )
22852438{
22862439   segas24_state *state = machine.driver_data<segas24_state>();
2287   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2288   state->m_mlatch_table = 0;
2289   state->m_track_size = 0x2d00;
2440   state->io_r = &segas24_state::hotrod_io_r;
2441   state->io_w = &segas24_state::hotrod_io_w;
2442   state->mlatch_table = 0;
2443   state->track_size = 0x2d00;
22902444   s24_fd1094_driver_init(machine);
22912445}
22922446
22932447static DRIVER_INIT( gground )
22942448{
22952449   segas24_state *state = machine.driver_data<segas24_state>();
2296   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2297   state->m_mlatch_table = 0;
2298   state->m_track_size = 0x2d00;
2450   state->io_r = &segas24_state::hotrod_io_r;
2451   state->io_w = &segas24_state::hotrod_io_w;
2452   state->mlatch_table = 0;
2453   state->track_size = 0x2d00;
22992454   s24_fd1094_driver_init(machine);
23002455}
23012456
23022457static DRIVER_INIT( crkdown )
23032458{
23042459   segas24_state *state = machine.driver_data<segas24_state>();
2305   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2306   state->m_mlatch_table = 0;
2307   state->m_track_size = 0x2d00;
2460   state->io_r = &segas24_state::hotrod_io_r;
2461   state->io_w = &segas24_state::hotrod_io_w;
2462   state->mlatch_table = 0;
2463   state->track_size = 0x2d00;
23082464   s24_fd1094_driver_init(machine);
23092465}
23102466
23112467static DRIVER_INIT( roughrac )
23122468{
23132469   segas24_state *state = machine.driver_data<segas24_state>();
2314   system24temp_sys16_io_set_callbacks(machine, hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
2315   state->m_mlatch_table = 0;
2316   state->m_track_size = 0x2d00;
2470   state->io_r = &segas24_state::hotrod_io_r;
2471   state->io_w = &segas24_state::hotrod_io_w;
2472   state->mlatch_table = 0;
2473   state->track_size = 0x2d00;
23172474   s24_fd1094_driver_init(machine);
23182475}
23192476
src/mame/drivers/combatsc.c
r11224r11225
687687   state->m_page[0] = MEM + 0x4000;
688688   state->m_page[1] = MEM + 0x6000;
689689
690   state->m_interleave_timer = machine.scheduler().timer_alloc(FUNC(NULL));
690   state->m_interleave_timer = machine.scheduler().timer_alloc(FUNC_NULL);
691691
692692   state->m_audiocpu = machine.device<cpu_device>("audiocpu");
693693   state->m_k007121_1 = machine.device("k007121_1");
src/mame/drivers/hng64.c
r11224r11225
11071107
11081108DIRECT_UPDATE_HANDLER( KL5C80_direct_handler )
11091109{
1110   hng64_state *state = machine->driver_data<hng64_state>();
1110   hng64_state *state = machine.driver_data<hng64_state>();
11111111
11121112   direct.explicit_configure(0x0000, 0xffff, 0xffff, state->m_com_op_base);
11131113   return ~0;
r11224r11225
17021702   KL5C80_virtual_mem_sync(state);
17031703
17041704   address_space *space = machine.device<z80_device>("comm")->space(AS_PROGRAM);
1705   space->set_direct_update_handler(direct_update_delegate_create_static(KL5C80_direct_handler, machine));
1705   space->set_direct_update_handler(direct_update_delegate(FUNC(KL5C80_direct_handler), &machine));
17061706
17071707   cputag_set_input_line(machine, "comm", INPUT_LINE_RESET, PULSE_LINE);     // reset the CPU and let 'er rip
17081708//  cputag_set_input_line(machine, "comm", INPUT_LINE_HALT, ASSERT_LINE);     // hold on there pardner...
src/mame/drivers/cidelsa.c
r11224r11225
1#define ADDRESS_MAP_MODERN
2
3#include "emu.h"
4#include "cpu/cosmac/cosmac.h"
5#include "cpu/cop400/cop400.h"
6#include "sound/cdp1869.h"
7#include "sound/ay8910.h"
8#include "machine/cdp1852.h"
9#include "machine/nvram.h"
101#include "includes/cidelsa.h"
112
123/* CDP1802 Interface */
r11224r11225
3930
4031/* Sound Interface */
4132
42WRITE8_MEMBER( cidelsa_state::draco_sound_bankswitch_w )
33WRITE8_MEMBER( draco_state::sound_bankswitch_w )
4334{
4435   /*
4536
r11224r11225
5748   memory_set_bank(m_machine, "bank1", bank);
5849}
5950
60WRITE8_MEMBER( cidelsa_state::draco_sound_g_w )
51WRITE8_MEMBER( draco_state::sound_g_w )
6152{
6253   /*
6354
r11224r11225
7364   switch (data)
7465   {
7566   case 0x01:
76      ay8910_data_w(m_psg, 0, m_draco_ay_latch);
67      ay8910_data_w(m_psg, 0, m_psg_latch);
7768      break;
7869
7970   case 0x02:
80      m_draco_ay_latch = ay8910_r(m_psg, 0);
71      m_psg_latch = ay8910_r(m_psg, 0);
8172      break;
8273
8374   case 0x03:
84      ay8910_address_w(m_psg, 0, m_draco_ay_latch);
75      ay8910_address_w(m_psg, 0, m_psg_latch);
8576      break;
8677   }
8778}
8879
89READ8_MEMBER( cidelsa_state::draco_sound_in_r )
80READ8_MEMBER( draco_state::sound_in_r )
9081{
91   return ~(m_draco_sound) & 0x07;
82   return ~(m_sound) & 0x07;
9283}
9384
94READ8_MEMBER( cidelsa_state::draco_sound_ay8910_r )
85READ8_MEMBER( draco_state::psg_r )
9586{
96   return m_draco_ay_latch;
87   return m_psg_latch;
9788}
9889
99WRITE8_MEMBER( cidelsa_state::draco_sound_ay8910_w )
90WRITE8_MEMBER( draco_state::psg_w )
10091{
101   m_draco_ay_latch = data;
92   m_psg_latch = data;
10293}
10394
10495/* Read/Write Handlers */
r11224r11225
141132   set_led_status(m_machine, 2, data & 0x20); // FIRE
142133}
143134
144WRITE8_MEMBER( cidelsa_state::draco_out1_w )
135WRITE8_MEMBER( draco_state::out1_w )
145136{
146137   /*
147138      bit   description
r11224r11225
156147        7   SONIDO C -> COP402 IN2
157148    */
158149
159   m_draco_sound = (data & 0xe0) >> 5;
150   m_sound = (data & 0xe0) >> 5;
160151}
161152
162153static CDP1852_INTERFACE( cidelsa_cdp1852_in0_intf )
r11224r11225
195186{
196187   CDP1852_MODE_OUTPUT,
197188   DEVCB_NULL,
198   DEVCB_DRIVER_MEMBER(cidelsa_state, draco_out1_w),
189   DEVCB_DRIVER_MEMBER(draco_state, out1_w),
199190   DEVCB_NULL
200191};
201192
r11224r11225
242233ADDRESS_MAP_END
243234
244235static ADDRESS_MAP_START( altair_io_map, AS_IO, 8, cidelsa_state )
245   AM_RANGE(0x01, 0x01) AM_DEVREAD_LEGACY("ic23", cdp1852_data_r) AM_DEVWRITE_LEGACY("ic26", cdp1852_data_w)
246   AM_RANGE(0x02, 0x02) AM_DEVREAD_LEGACY("ic24", cdp1852_data_r)
247   AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY("ic25", cdp1852_data_r)
236   AM_RANGE(0x01, 0x01) AM_DEVREAD("ic23", cdp1852_device, read) AM_DEVWRITE("ic26", cdp1852_device, write)
237   AM_RANGE(0x02, 0x02) AM_DEVREAD("ic24", cdp1852_device, read)
238   AM_RANGE(0x04, 0x04) AM_DEVREAD("ic25", cdp1852_device, read)
248239   AM_RANGE(0x03, 0x07) AM_WRITE(cdp1869_w)
249240ADDRESS_MAP_END
250241
251242// Draco
252243
253static ADDRESS_MAP_START( draco_map, AS_PROGRAM, 8, cidelsa_state )
244static ADDRESS_MAP_START( draco_map, AS_PROGRAM, 8, draco_state )
254245   AM_RANGE(0x0000, 0x3fff) AM_ROM
255246   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_SHARE("nvram")
256247   AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, char_ram_r, char_ram_w)
257248   AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, page_ram_r, page_ram_w)
258249ADDRESS_MAP_END
259250
260static ADDRESS_MAP_START( draco_io_map, AS_IO, 8, cidelsa_state )
261   AM_RANGE(0x01, 0x01) AM_DEVREAD_LEGACY("ic29", cdp1852_data_r) AM_DEVWRITE_LEGACY("ic32", cdp1852_data_w)
262   AM_RANGE(0x02, 0x02) AM_DEVREAD_LEGACY("ic30", cdp1852_data_r)
263   AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY("ic31", cdp1852_data_r)
264   AM_RANGE(0x03, 0x07) AM_WRITE(cdp1869_w)
251static ADDRESS_MAP_START( draco_io_map, AS_IO, 8, draco_state )
252   AM_RANGE(0x01, 0x01) AM_DEVREAD("ic29", cdp1852_device, read) AM_DEVWRITE("ic32", cdp1852_device, write)
253   AM_RANGE(0x02, 0x02) AM_DEVREAD("ic30", cdp1852_device, read)
254   AM_RANGE(0x04, 0x04) AM_DEVREAD("ic31", cdp1852_device, read)
255   AM_RANGE(0x03, 0x07) AM_WRITE_BASE(cidelsa_state, cdp1869_w)
265256ADDRESS_MAP_END
266257
267static ADDRESS_MAP_START( draco_sound_map, AS_PROGRAM, 8, cidelsa_state )
258static ADDRESS_MAP_START( draco_sound_map, AS_PROGRAM, 8, draco_state )
268259   AM_RANGE(0x000, 0x3ff) AM_ROMBANK("bank1")
269260ADDRESS_MAP_END
270261
271static ADDRESS_MAP_START( draco_sound_io_map, AS_IO, 8, cidelsa_state )
272   AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(draco_sound_bankswitch_w)
273   AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_WRITE(draco_sound_g_w)
274   AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(draco_sound_ay8910_r, draco_sound_ay8910_w)
275   AM_RANGE(COP400_PORT_IN, COP400_PORT_IN) AM_READ(draco_sound_in_r)
262static ADDRESS_MAP_START( draco_sound_io_map, AS_IO, 8, draco_state )
263   AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(sound_bankswitch_w)
264   AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_WRITE(sound_g_w)
265   AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(psg_r, psg_w)
266   AM_RANGE(COP400_PORT_IN, COP400_PORT_IN) AM_READ(sound_in_r)
276267   AM_RANGE(COP400_PORT_SIO, COP400_PORT_SIO) AM_NOP
277268   AM_RANGE(COP400_PORT_SK, COP400_PORT_SK) AM_WRITENOP
278269ADDRESS_MAP_END
r11224r11225
442433   state->m_reset = 1;
443434}
444435
445static MACHINE_START( cidelsa )
436void cidelsa_state::machine_start()
446437{
447   cidelsa_state *state = machine.driver_data<cidelsa_state>();
448
449438   /* register for state saving */
450   state->save_item(NAME(state->m_reset));
439   save_item(NAME(m_reset));
451440}
452441
453static MACHINE_START( draco )
442void draco_state::machine_start()
454443{
455   cidelsa_state *state = machine.driver_data<cidelsa_state>();
456
457   MACHINE_START_CALL( cidelsa );
458
459444   /* setup COP402 memory banking */
460   memory_configure_bank(machine, "bank1", 0, 2, machine.region(COP402N_TAG)->base(), 0x400);
461   memory_set_bank(machine, "bank1", 0);
445   memory_configure_bank(m_machine, "bank1", 0, 2, m_machine.region(COP402N_TAG)->base(), 0x400);
446   memory_set_bank(m_machine, "bank1", 0);
462447
463448   /* register for state saving */
464   state->save_item(NAME(state->m_draco_sound));
465   state->save_item(NAME(state->m_draco_ay_latch));
449   save_item(NAME(m_reset));
450   save_item(NAME(m_sound));
451   save_item(NAME(m_psg_latch));
466452}
467453
468454/* Machine Reset */
r11224r11225
484470   MCFG_CPU_CONFIG(cidelsa_cdp1802_config)
485471   MCFG_NVRAM_ADD_0FILL("nvram")
486472
487   MCFG_MACHINE_START(cidelsa)
488
489473   /* sound and video hardware */
490474   MCFG_FRAGMENT_ADD(destryer_video)
491475MACHINE_CONFIG_END
r11224r11225
498482   MCFG_CPU_CONFIG(cidelsa_cdp1802_config)
499483   MCFG_NVRAM_ADD_0FILL("nvram")
500484
501   MCFG_MACHINE_START(cidelsa)
502
503485   /* sound and video hardware */
504486   MCFG_FRAGMENT_ADD(destryer_video)
505487MACHINE_CONFIG_END
r11224r11225
512494   MCFG_CPU_CONFIG(cidelsa_cdp1802_config)
513495   MCFG_NVRAM_ADD_0FILL("nvram")
514496
515   MCFG_MACHINE_START(cidelsa)
516
517497   /* input/output hardware */
518498   MCFG_CDP1852_ADD("ic23", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in0_intf)   /* clock is really tied to CDP1869 CMSEL (pin 37) */
519499   MCFG_CDP1852_ADD("ic24", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in1_intf)
r11224r11225
524504   MCFG_FRAGMENT_ADD(altair_video)
525505MACHINE_CONFIG_END
526506
527static MACHINE_CONFIG_START( draco, cidelsa_state )
507static MACHINE_CONFIG_START( draco, draco_state )
528508   /* basic system hardware */
529509   MCFG_CPU_ADD(CDP1802_TAG, COSMAC, DRACO_CHR1)
530510   MCFG_CPU_PROGRAM_MAP(draco_map)
r11224r11225
532512   MCFG_CPU_CONFIG(cidelsa_cdp1802_config)
533513   MCFG_NVRAM_ADD_0FILL("nvram")
534514
535   MCFG_MACHINE_START(draco)
536
537515   MCFG_CPU_ADD(COP402N_TAG, COP402, DRACO_SND_CHR1)
538516   MCFG_CPU_PROGRAM_MAP(draco_sound_map)
539517   MCFG_CPU_IO_MAP(draco_sound_io_map)
src/mame/drivers/segas16b.c
r11224r11225
937937
938938static const segaic16_memory_map_entry rom_171_5358_info_small[] =
939939{
940   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r, NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
941   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,      "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
942   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,      "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
943   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,      "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
944   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,      "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
945   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,      "bank14", NULL,                  "bank14", &workram,     "work RAM" },
946   { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, NULL,      "bank15", NULL,                  NULL,     NULL,                  "ROM 2" },
947   { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, NULL,      "bank16", NULL,                  NULL,     NULL,                  "ROM 1" },
948   { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, NULL,      "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
940   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r), NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
941   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,       "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
942   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,       "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
943   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,       "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
944   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,       "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
945   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,       "bank14", FUNC_NULL,                   "bank14", &workram,     "work RAM" },
946   { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL,       "bank15", FUNC_NULL,                   NULL,     NULL,                  "ROM 2" },
947   { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x10000, FUNC_NULL,       "bank16", FUNC_NULL,                   NULL,     NULL,                  "ROM 1" },
948   { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL,       "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
949949   { 0 }
950950};
951951
952952static const segaic16_memory_map_entry rom_171_5358_info[] =
953953{
954   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r, NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
955   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,      "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
956   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,      "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
957   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,      "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
958   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,      "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
959   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,      "bank14", NULL,                  "bank14", &workram,     "work RAM" },
960   { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, NULL,      "bank15", NULL,                  NULL,     NULL,                  "ROM 2" },
961   { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, NULL,      "bank16", NULL,                  NULL,     NULL,                  "ROM 1" },
962   { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, NULL,      "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
954   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r), NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
955   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,       "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
956   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,       "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
957   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,       "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
958   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,       "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
959   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,       "bank14", FUNC_NULL,                   "bank14", &workram,     "work RAM" },
960   { 0x29/2, 0x00000, 0x20000, 0xfe0000, 0x40000, FUNC_NULL,       "bank15", FUNC_NULL,                   NULL,     NULL,                  "ROM 2" },
961   { 0x25/2, 0x00000, 0x20000, 0xfe0000, 0x20000, FUNC_NULL,       "bank16", FUNC_NULL,                   NULL,     NULL,                  "ROM 1" },
962   { 0x21/2, 0x00000, 0x20000, 0xfe0000, 0x00000, FUNC_NULL,       "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
963963   { 0 }
964964};
965965
966966static const segaic16_memory_map_entry rom_171_5704_info[] =
967967{
968   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r, NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
969   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,      "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
970   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,      "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
971   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,      "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
972   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,      "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
973   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,      "bank14", NULL,                  "bank14", &workram,     "work RAM" },
974   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, NULL,      NULL,     rom_5704_bank_w,       NULL,     NULL,                  "tile bank" },
975   { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, NULL,      "bank16", NULL,                  NULL,     NULL,                  "ROM 1" },
976   { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, NULL,      "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
968   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r), NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
969   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,       "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
970   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,       "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
971   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,       "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
972   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,       "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
973   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,       "bank14", FUNC_NULL,                   "bank14", &workram,     "work RAM" },
974   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, FUNC_NULL,       NULL,     FUNC(rom_5704_bank_w),       NULL,     NULL,                  "tile bank" },
975   { 0x25/2, 0x00000, 0x80000, 0xfc0000, 0x80000, FUNC_NULL,       "bank16", FUNC_NULL,                   NULL,     NULL,                  "ROM 1" },
976   { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL,       "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
977977   { 0 }
978978};
979979
980980static const segaic16_memory_map_entry rom_atomicp_info[] =
981981{
982   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r, NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
983   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,      "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
984   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,      "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
985   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,      "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
986   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,      "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
987   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,      "bank14", NULL,                  "bank14", &workram,     "work RAM" },
988   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, NULL,      NULL,     rom_5704_bank_w,       NULL,     NULL,                  "tile bank" },
989   { 0x25/2, 0x00000, 0x10000, 0xff0000,      ~0, NULL,      NULL,     atomicp_sound_w,       NULL,     NULL,                  "sound" },
990   { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, NULL,      "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
982   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r), NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
983   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,       "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
984   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,       "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
985   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,       "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
986   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,       "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
987   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,       "bank14", FUNC_NULL,                   "bank14", &workram,     "work RAM" },
988   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, FUNC_NULL,       NULL,     FUNC(rom_5704_bank_w),       NULL,     NULL,                  "tile bank" },
989   { 0x25/2, 0x00000, 0x10000, 0xff0000,      ~0, FUNC_NULL,       NULL,     FUNC(atomicp_sound_w),       NULL,     NULL,                  "sound" },
990   { 0x21/2, 0x00000, 0x80000, 0xfc0000, 0x00000, FUNC_NULL,       "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
991991   { 0 }
992992};
993993
994994static const segaic16_memory_map_entry rom_171_5797_info[] =
995995{
996   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, misc_io_r,            NULL,     misc_io_w,             NULL,     NULL,                  "I/O space" },
997   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, NULL,                 "bank10", segaic16_paletteram_w, NULL,     &segaic16_paletteram,  "color RAM" },
998   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, NULL,                 "bank11", segaic16_tileram_0_w,  NULL,     &segaic16_tileram_0,   "tile RAM" },
999   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, NULL,                 "bank12", segaic16_textram_0_w,  NULL,     &segaic16_textram_0,   "text RAM" },
1000   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, NULL,                 "bank13", NULL,                  "bank13", &segaic16_spriteram_0, "object RAM" },
1001   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, NULL,                 "bank14", NULL,                  "bank14", &workram,     "work RAM" },
1002   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, unknown_rgn2_r,       NULL,     unknown_rgn2_w,        NULL,     NULL,                  "???" },
1003   { 0x25/2, 0x00000, 0x04000, 0xffc000,      ~0, rom_5797_bank_math_r, NULL,     rom_5797_bank_math_w,  NULL,     NULL,                  "tile bank/math" },
1004   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, NULL,                 "bank17", NULL,                  NULL,     NULL,                  "ROM 0" },
996   { 0x3d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(misc_io_r),            NULL,     FUNC(misc_io_w),             NULL,     NULL,                  "I/O space" },
997   { 0x39/2, 0x00000, 0x01000, 0xfff000,      ~0, FUNC_NULL,                  "bank10", FUNC(segaic16_paletteram_w), NULL,     &segaic16_paletteram,  "color RAM" },
998   { 0x35/2, 0x00000, 0x10000, 0xfe0000,      ~0, FUNC_NULL,                  "bank11", FUNC(segaic16_tileram_0_w),  NULL,     &segaic16_tileram_0,   "tile RAM" },
999   { 0x35/2, 0x10000, 0x01000, 0xfef000,      ~0, FUNC_NULL,                  "bank12", FUNC(segaic16_textram_0_w),  NULL,     &segaic16_textram_0,   "text RAM" },
1000   { 0x31/2, 0x00000, 0x00800, 0xfff800,      ~0, FUNC_NULL,                  "bank13", FUNC_NULL,                   "bank13", &segaic16_spriteram_0, "object RAM" },
1001   { 0x2d/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC_NULL,                  "bank14", FUNC_NULL,                   "bank14", &workram,     "work RAM" },
1002   { 0x29/2, 0x00000, 0x10000, 0xff0000,      ~0, FUNC(unknown_rgn2_r),       NULL,     FUNC(unknown_rgn2_w),        NULL,     NULL,                  "???" },
1003   { 0x25/2, 0x00000, 0x04000, 0xffc000,      ~0, FUNC(rom_5797_bank_math_r), NULL,     FUNC(rom_5797_bank_math_w),  NULL,     NULL,                  "tile bank/math" },
1004   { 0x21/2, 0x00000, 0x80000, 0xf80000, 0x00000, FUNC_NULL,                  "bank17", FUNC_NULL,                   NULL,     NULL,                  "ROM 0" },
10051005   { 0 }
10061006};
10071007
src/mame/drivers/nwk-tr.c
r11224r11225
815815   ROM_LOAD( "888a10.14p",   0x400000, 0x400000, CRC(328ce610) SHA1(dbbc779a1890c53298c0db129d496df048929496) )
816816
817817   ROM_REGION(0x2000, "m48t58",0)
818   ROM_LOAD( "m48t58y-70pc1.35d", 0x000000, 0x002000, CRC(1aa43a1f) SHA1(814b691b8a358bf1545a13d595d17070e612e9a4) )
818   ROM_LOAD( "m48t58y-70pc1.35d", 0x000000, 0x002000, CRC(1aa43a1f) SHA1(814b691b8a358bf1545a13d595d17070e612e9a4) )
819819ROM_END
820820
821821ROM_START(thrilld)
src/mame/drivers/taito_f3.c
r11224r11225
151151static WRITE16_HANDLER( f3_unk_w )
152152{
153153   /*
154   Several games writes a value here at POST, dunno what kind of config this is ...
155   ringrage:  0x0000
156   arabianm:  0x0000
157   ridingf: (no init)
158   gseeker: (no init)
159   commandw:(no init)
160   cupfinal:  0x0100
161   trstar:  (no init)
162   gunlock:   0x0000
163   scfinals:  0x0100
164   lightbr: (no init)
165   intcup94:  0x0100
166   kaiserkn:  0x0100
167   dariusg:   0x278b
168   bublbob2:(no init)
169   pwrgoal:   0x0100
170   qtheater:  0x0090
171   elvactr:   0x278b
172   recalh:    0x0090
173   spcinv95:  0x0100
174   twinqix: (no init)
175   quizhuhu:  0x0000
176   pbobble2:  0x278b
177   gekiridn:  0x278b
178   tcobra2:   0x0000
179   bubblem: (no init)
180   cleopatr:  0x0100
181   pbobble3:  0x278b
182   arkretn:   0x0000
183   kirameki:  0x0100
184   puchicar:  0x0000
185   pbobble4:  0x278b
186   popnpop:   0x0000
187   landmakr:  0x278b
188   */
154    Several games writes a value here at POST, dunno what kind of config this is ...
155    ringrage:  0x0000
156    arabianm:  0x0000
157    ridingf: (no init)
158    gseeker: (no init)
159    commandw:(no init)
160    cupfinal:  0x0100
161    trstar:  (no init)
162    gunlock:   0x0000
163    scfinals:  0x0100
164    lightbr: (no init)
165    intcup94:  0x0100
166    kaiserkn:  0x0100
167    dariusg:   0x278b
168    bublbob2:(no init)
169    pwrgoal:   0x0100
170    qtheater:  0x0090
171    elvactr:   0x278b
172    recalh:    0x0090
173    spcinv95:  0x0100
174    twinqix: (no init)
175    quizhuhu:  0x0000
176    pbobble2:  0x278b
177    gekiridn:  0x278b
178    tcobra2:   0x0000
179    bubblem: (no init)
180    cleopatr:  0x0100
181    pbobble3:  0x278b
182    arkretn:   0x0000
183    kirameki:  0x0100
184    puchicar:  0x0000
185    pbobble4:  0x278b
186    popnpop:   0x0000
187    landmakr:  0x278b
188    */
189189   if(offset == 0)
190190      logerror("0x4c0000 write %04x\n",data);
191191   else
r11224r11225
202202   AM_RANGE(0x4a0000, 0x4a001f) AM_READWRITE(f3_control_r,  f3_control_w)
203203   AM_RANGE(0x4c0000, 0x4c0003) AM_WRITE16(f3_unk_w,0xffffffff)
204204   AM_RANGE(0x600000, 0x60ffff) AM_READWRITE16(f3_spriteram_r,f3_spriteram_w,0xffffffff) //AM_BASE_SIZE_MEMBER(taito_f3_state, m_spriteram, m_spriteram_size)
205   AM_RANGE(0x610000, 0x61bfff) AM_READWRITE16(f3_pf_data_r,f3_pf_data_w,0xffffffff)       //AM_BASE_MEMBER(taito_f3_state, m_f3_pf_data)
205   AM_RANGE(0x610000, 0x61bfff) AM_READWRITE16(f3_pf_data_r,f3_pf_data_w,0xffffffff)      //AM_BASE_MEMBER(taito_f3_state, m_f3_pf_data)
206206   AM_RANGE(0x61c000, 0x61dfff) AM_READWRITE16(f3_videoram_r,f3_videoram_w,0xffffffff)      //AM_BASE_MEMBER(taito_f3_state, m_videoram)
207207   AM_RANGE(0x61e000, 0x61ffff) AM_READWRITE16(f3_vram_r,f3_vram_w,0xffffffff)          //AM_BASE_MEMBER(taito_f3_state, m_f3_vram)
208208   AM_RANGE(0x620000, 0x62ffff) AM_READWRITE16(f3_lineram_r,f3_lineram_w,0xffffffff)      //AM_BASE_MEMBER(taito_f3_state, m_f3_line_ram)
209   AM_RANGE(0x630000, 0x63ffff) AM_READWRITE16(f3_pivot_r,f3_pivot_w,0xffffffff)          //AM_BASE_MEMBER(taito_f3_state, m_f3_pivot_ram)
209   AM_RANGE(0x630000, 0x63ffff) AM_READWRITE16(f3_pivot_r,f3_pivot_w,0xffffffff)         //AM_BASE_MEMBER(taito_f3_state, m_f3_pivot_ram)
210210   AM_RANGE(0x660000, 0x66000f) AM_WRITE16(f3_control_0_w,0xffffffff)
211211   AM_RANGE(0x660010, 0x66001f) AM_WRITE16(f3_control_1_w,0xffffffff)
212212   AM_RANGE(0xc00000, 0xc007ff) AM_RAM AM_SHARE("f3_shared")
src/mame/drivers/igs011.c
r11224r11225
476476   COMBINE_DATA(&state->m_igs_dips_sel);
477477}
478478
479INLINE UINT16 igs_dips_r(address_space *space, int NUM)
479INLINE UINT16 igs_dips_r(address_space *space, int NUM)
480480{
481481   igs011_state *state = space->machine().driver_data<igs011_state>();
482482   int i;
src/osd/sdl/sdl.mak
r11224r11225
420420CCOMFLAGS += -DNO_SDL_GLEXT
421421# Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
422422LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
423DEFS += -DMACOSX_USE_LIBSDL
423424endif
424425
425426endif   # Mac OS X
src/osd/sdl/sdlmain.c
r11224r11225
698698      name = "LucidaGrande";
699699   }
700700
701   /* handle bdf fonts in the core */
702   if (name.len() > 4)
703      if (name.toupper().substr(name.len()-4,4) == ".BDF" )
704         return NULL;
705
701706   font_name = CFStringCreateWithCString( NULL, _name, kCFStringEncodingUTF8 );
702707
703708   if( font_name != NULL )
src/osd/sdl/osd_opengl.h
r11224r11225
3232#endif
3333   #ifdef USE_DISPATCH_GL
3434
35#ifdef MACOSX_USE_LIBSDL
36   #ifndef APIENTRY
37   #define APIENTRY
38   #endif
39
40   #include "GL/gl.h"
41   #include "GL/glext.h"
42
43   typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target);
44#endif
45
3546   #define OSD_GL(ret,func,params) ret (APIENTRY *func) params;
3647   #define OSD_GL_UNUSED(ret,func,params)
3748
src/osd/osdcore.h
r11224r11225
742742
743743
744744/*-----------------------------------------------------------------------------
745    osd_malloc_array: allocate memory, hinting tha this memory contains an
745    osd_malloc_array: allocate memory, hinting tha this memory contains an
746746    array
747747
748748    Parameters:
src/emu/cpu/m68000/m68kcpu.h
r11224r11225
546546
547547/* Redirect memory calls */
548548
549typedef proto_delegate_1param<UINT8, offs_t> m68k_read8_proto_delegate;
550typedef proto_delegate_1param<UINT16, offs_t> m68k_readimm16_proto_delegate;
551typedef proto_delegate_1param<UINT16, offs_t> m68k_read16_proto_delegate;
552typedef proto_delegate_1param<UINT32, offs_t> m68k_read32_proto_delegate;
553typedef proto_delegate_2param<void, offs_t, UINT8> m68k_write8_proto_delegate;
554typedef proto_delegate_2param<void, offs_t, UINT16> m68k_write16_proto_delegate;
555typedef proto_delegate_2param<void, offs_t, UINT32> m68k_write32_proto_delegate;
549typedef delegate<UINT8 (offs_t)> m68k_read8_delegate;
550typedef delegate<UINT16 (offs_t)> m68k_readimm16_delegate;
551typedef delegate<UINT16 (offs_t)> m68k_read16_delegate;
552typedef delegate<UINT32 (offs_t)> m68k_read32_delegate;
553typedef delegate<void (offs_t, UINT8)> m68k_write8_delegate;
554typedef delegate<void (offs_t, UINT16)> m68k_write16_delegate;
555typedef delegate<void (offs_t, UINT32)> m68k_write32_delegate;
556556
557typedef delegate_1param<UINT8, offs_t> m68k_read8_delegate;
558typedef delegate_1param<UINT16, offs_t> m68k_readimm16_delegate;
559typedef delegate_1param<UINT16, offs_t> m68k_read16_delegate;
560typedef delegate_1param<UINT32, offs_t> m68k_read32_delegate;
561typedef delegate_2param<void, offs_t, UINT8> m68k_write8_delegate;
562typedef delegate_2param<void, offs_t, UINT16> m68k_write16_delegate;
563typedef delegate_2param<void, offs_t, UINT32> m68k_write32_delegate;
564
565557class m68k_memory_interface : public bindable_object
566558{
567559public:
src/emu/cpu/m68000/m68kcpu.c
r11224r11225
10841084   m_cpustate = get_safe_token(&space.device());
10851085   opcode_xor = 0;
10861086
1087   readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, m68008_read_immediate_16), *this);
1088   read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space);
1089   read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word), space);
1090   read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword), space);
1091   write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space);
1092   write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word), space);
1093   write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword), space);
1087   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::m68008_read_immediate_16), this);
1088   read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space);
1089   read16 = m68k_read16_delegate(FUNC(address_space::read_word), &space);
1090   read32 = m68k_read32_delegate(FUNC(address_space::read_dword), &space);
1091   write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space);
1092   write16 = m68k_write16_delegate(FUNC(address_space::write_word), &space);
1093   write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space);
10941094}
10951095
10961096/****************************************************************************
r11224r11225
11141114   m_cpustate = get_safe_token(&space.device());
11151115   opcode_xor = 0;
11161116
1117   readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, simple_read_immediate_16), *this);
1118   read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space);
1119   read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word), space);
1120   read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword), space);
1121   write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space);
1122   write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word), space);
1123   write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword), space);
1117   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::simple_read_immediate_16), this);
1118   read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space);
1119   read16 = m68k_read16_delegate(FUNC(address_space::read_word), &space);
1120   read32 = m68k_read32_delegate(FUNC(address_space::read_dword), &space);
1121   write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space);
1122   write16 = m68k_write16_delegate(FUNC(address_space::write_word), &space);
1123   write32 = m68k_write32_delegate(FUNC(address_space::write_dword), &space);
11241124}
11251125
11261126/****************************************************************************
r11224r11225
11351135   m_cpustate = get_safe_token(&space.device());
11361136   opcode_xor = WORD_XOR_BE(0);
11371137
1138   readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16), *this);
1139   read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(address_space, read_byte), space);
1140   read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(address_space, read_word_unaligned), space);
1141   read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(address_space, read_dword_unaligned), space);
1142   write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(address_space, write_byte), space);
1143   write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(address_space, write_word_unaligned), space);
1144   write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(address_space, write_dword_unaligned), space);
1138   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16), this);
1139   read8 = m68k_read8_delegate(FUNC(address_space::read_byte), &space);
1140   read16 = m68k_read16_delegate(FUNC(address_space::read_word_unaligned), &space);
1141   read32 = m68k_read32_delegate(FUNC(address_space::read_dword_unaligned), &space);
1142   write8 = m68k_write8_delegate(FUNC(address_space::write_byte), &space);
1143   write16 = m68k_write16_delegate(FUNC(address_space::write_word_unaligned), &space);
1144   write32 = m68k_write32_delegate(FUNC(address_space::write_dword_unaligned), &space);
11451145}
11461146
11471147/* interface for 32-bit data bus with PMMU (68EC020, 68020) */
r11224r11225
13531353   m_cpustate = get_safe_token(&space.device());
13541354   opcode_xor = WORD_XOR_BE(0);
13551355
1356   readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16_mmu), *this);
1357   read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(m68k_memory_interface, read_byte_32_mmu), *this);
1358   read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(m68k_memory_interface, readword_d32_mmu), *this);
1359   read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(m68k_memory_interface, readlong_d32_mmu), *this);
1360   write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(m68k_memory_interface, write_byte_32_mmu), *this);
1361   write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(m68k_memory_interface, writeword_d32_mmu), *this);
1362   write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(m68k_memory_interface, writelong_d32_mmu), *this);
1356   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_mmu), this);
1357   read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_32_mmu), this);
1358   read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::readword_d32_mmu), this);
1359   read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::readlong_d32_mmu), this);
1360   write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_32_mmu), this);
1361   write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::writeword_d32_mmu), this);
1362   write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::writelong_d32_mmu), this);
13631363}
13641364
13651365
r11224r11225
14801480   m_cpustate = get_safe_token(&space.device());
14811481   opcode_xor = WORD_XOR_BE(0);
14821482
1483   readimm16 = m68k_readimm16_delegate(m68k_readimm16_proto_delegate::create_member(m68k_memory_interface, read_immediate_16_hmmu), *this);
1484   read8 = m68k_read8_delegate(m68k_read8_proto_delegate::create_member(m68k_memory_interface, read_byte_32_hmmu), *this);
1485   read16 = m68k_read16_delegate(m68k_read16_proto_delegate::create_member(m68k_memory_interface, readword_d32_hmmu), *this);
1486   read32 = m68k_read32_delegate(m68k_read32_proto_delegate::create_member(m68k_memory_interface, readlong_d32_hmmu), *this);
1487   write8 = m68k_write8_delegate(m68k_write8_proto_delegate::create_member(m68k_memory_interface, write_byte_32_hmmu), *this);
1488   write16 = m68k_write16_delegate(m68k_write16_proto_delegate::create_member(m68k_memory_interface, writeword_d32_hmmu), *this);
1489   write32 = m68k_write32_delegate(m68k_write32_proto_delegate::create_member(m68k_memory_interface, writelong_d32_hmmu), *this);
1483   readimm16 = m68k_readimm16_delegate(FUNC(m68k_memory_interface::read_immediate_16_hmmu), this);
1484   read8 = m68k_read8_delegate(FUNC(m68k_memory_interface::read_byte_32_hmmu), this);
1485   read16 = m68k_read16_delegate(FUNC(m68k_memory_interface::readword_d32_hmmu), this);
1486   read32 = m68k_read32_delegate(FUNC(m68k_memory_interface::readlong_d32_hmmu), this);
1487   write8 = m68k_write8_delegate(FUNC(m68k_memory_interface::write_byte_32_hmmu), this);
1488   write16 = m68k_write16_delegate(FUNC(m68k_memory_interface::writeword_d32_hmmu), this);
1489   write32 = m68k_write32_delegate(FUNC(m68k_memory_interface::writelong_d32_hmmu), this);
14901490}
14911491
14921492void m68k_set_reset_callback(device_t *device, m68k_reset_func callback)
src/emu/cpu/dsp56k/dsp56k.c
r11224r11225
238238
239239   /* Setup the direct memory handler for this CPU */
240240   /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
241   const_cast<address_space *>(cpustate->program)->set_direct_update_handler(direct_update_delegate_create_static(dsp56k_direct_handler, device->machine()));
241   cpustate->program->set_direct_update_handler(direct_update_delegate(FUNC(dsp56k_direct_handler), &device->machine()));
242242}
243243
244244
src/emu/cpu/upd7725/upd7725.h
r11224r11225
3535struct necdsp_interface
3636{
3737   devcb_read_line      m_in_int_func;
38   //devcb_read8      m_in_si_func;
39   //devcb_read_line   m_in_sck_func;
40   //devcb_read_line   m_in_sien_func;
41   //devcb_read_line   m_in_soen_func;
42   //devcb_read_line   m_in_dack_func;
38   //devcb_read8       m_in_si_func;
39   //devcb_read_line   m_in_sck_func;
40   //devcb_read_line   m_in_sien_func;
41   //devcb_read_line   m_in_soen_func;
42   //devcb_read_line   m_in_dack_func;
4343   devcb_write_line   m_out_p0_func;
4444   devcb_write_line   m_out_p1_func;
45   //devcb_write8      m_out_so_func;
46   //devcb_write_line   m_out_sorq_func;
47   //devcb_write_line   m_out_drq_func;
45   //devcb_write8      m_out_so_func;
46   //devcb_write_line  m_out_sorq_func;
47   //devcb_write_line  m_out_drq_func;
4848};
4949
5050#define NECDSP_INTERFACE(name) \
r11224r11225
222222protected:
223223// device callbacks
224224   devcb_resolved_read_line   m_in_int_func;
225   //devcb_resolved_read8      m_in_si_func;
226   //devcb_resolved_read_line   m_in_sck_func;
227   //devcb_resolved_read_line   m_in_sien_func;
228   //devcb_resolved_read_line   m_in_soen_func;
229   //devcb_resolved_read_line   m_in_dack_func;
225   //devcb_resolved_read8      m_in_si_func;
226   //devcb_resolved_read_line  m_in_sck_func;
227   //devcb_resolved_read_line  m_in_sien_func;
228   //devcb_resolved_read_line  m_in_soen_func;
229   //devcb_resolved_read_line  m_in_dack_func;
230230   devcb_resolved_write_line   m_out_p0_func;
231231   devcb_resolved_write_line   m_out_p1_func;
232   //devcb_resolved_write8      m_out_so_func;
233   //devcb_resolved_write_line   m_out_sorq_func;
234   //devcb_resolved_write_line   m_out_drq_func;
232   //devcb_resolved_write8     m_out_so_func;
233   //devcb_resolved_write_line m_out_sorq_func;
234   //devcb_resolved_write_line m_out_drq_func;
235235
236236  const necdsp_device_config &m_config;
237237};
src/emu/video/pc_vga.c
r11224r11225
598598{
599599   address_space *space = machine.firstcpu->memory().space(AS_PROGRAM);
600600   static int sequencer, gc;
601   read8_space_func read_handler;
602   write8_space_func write_handler;
601   read8_space_func read_handler; const char *read_handler_name=NULL;
602   write8_space_func write_handler; const char *write_handler_name=NULL;
603603   read16_space_func read_handler16;
604604   write16_space_func write_handler16;
605605   read32_space_func read_handler32;
r11224r11225
616616
617617   if (vga.sequencer.data[4]&8)
618618   {
619      read_handler = vga_vga_r;
620      write_handler = vga_vga_w;
619      read_handler = vga_vga_r; read_handler_name = "vga_vga_r";
620      write_handler = vga_vga_w; write_handler_name = "vga_vga_w";
621621      read_handler16 = vga_vga16_r;
622622      write_handler16 = vga_vga16_w;
623623      read_handler32 = vga_vga32_r;
r11224r11225
627627   }
628628   else if (vga.sequencer.data[4] & 4)
629629   {
630      read_handler = vga_ega_r;
631      write_handler = vga_ega_w;
630      read_handler = vga_ega_r; read_handler_name = "vga_ega_r";
631      write_handler = vga_ega_w; read_handler_name = "vga_ega_w";
632632      read_handler16 = vga_ega16_r;
633633      write_handler16 = vga_ega16_w;
634634      read_handler32 = vga_ega32_r;
r11224r11225
638638   }
639639   else
640640   {
641      read_handler = vga_text_r;
642      write_handler = vga_text_w;
641      read_handler = vga_text_r; read_handler_name = "vga_text_r";
642      write_handler = vga_text_w; read_handler_name = "vga_text_w";
643643      read_handler16 = vga_text16_r;
644644      write_handler16 = vga_text16_w;
645645      read_handler32 = vga_text32_r;
r11224r11225
682682            sel = vga.gc.data[6] & 0x0c;
683683            if (sel)
684684            {
685               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler) ); else space->nop_read(0xa0000, 0xaffff);
686               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler) ); else space->nop_read(0xb0000, 0xb7fff);
687               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler) ); else space->nop_read(0xb8000, 0xbffff);
688               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler)); else space->nop_write(0xa0000, 0xaffff);
689               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler)); else space->nop_write(0xb0000, 0xb7fff);
690               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler)); else space->nop_write(0xb8000, 0xbffff);
685               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler, read_handler_name); else space->nop_read(0xa0000, 0xaffff);
686               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler, read_handler_name); else space->nop_read(0xb0000, 0xb7fff);
687               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler, read_handler_name); else space->nop_read(0xb8000, 0xbffff);
688               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
689               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
690               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
691691            }
692692            else
693693            {
r11224r11225
701701            sel = vga.gc.data[6] & 0x0c;
702702            if (sel)
703703            {
704               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler16) ); else space->nop_read(0xa0000, 0xaffff);
705               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler16) ); else space->nop_read(0xb0000, 0xb7fff);
706               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler16) ); else space->nop_read(0xb8000, 0xbffff);
707               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler16)); else space->nop_write(0xa0000, 0xaffff);
708               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler16)); else space->nop_write(0xb0000, 0xb7fff);
709               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler16)); else space->nop_write(0xb8000, 0xbffff);
704               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler16, read_handler_name); else space->nop_read(0xa0000, 0xaffff);
705               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler16, read_handler_name); else space->nop_read(0xb0000, 0xb7fff);
706               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler16, read_handler_name); else space->nop_read(0xb8000, 0xbffff);
707               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler16, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
708               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler16, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
709               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler16, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
710710            }
711711            else
712712            {
r11224r11225
720720            sel = vga.gc.data[6] & 0x0c;
721721            if (sel)
722722            {
723               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler32) ); else space->nop_read(0xa0000, 0xaffff);
724               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler32) ); else space->nop_read(0xb0000, 0xb7fff);
725               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler32) ); else space->nop_read(0xb8000, 0xbffff);
726               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler32)); else space->nop_write(0xa0000, 0xaffff);
727               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler32)); else space->nop_write(0xb0000, 0xb7fff);
728               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler32)); else space->nop_write(0xb8000, 0xbffff);
723               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler32, read_handler_name); else space->nop_read(0xa0000, 0xaffff);
724               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler32, read_handler_name); else space->nop_read(0xb0000, 0xb7fff);
725               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler32, read_handler_name); else space->nop_read(0xb8000, 0xbffff);
726               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler32, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
727               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler32, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
728               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler32, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
729729            }
730730            else
731731            {
r11224r11225
739739            sel = vga.gc.data[6] & 0x0c;
740740            if (sel)
741741            {
742               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler64) ); else space->nop_read(0xa0000, 0xaffff);
743               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler64) ); else space->nop_read(0xb0000, 0xb7fff);
744               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler64) ); else space->nop_read(0xb8000, 0xbffff);
745               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler64)); else space->nop_write(0xa0000, 0xaffff);
746               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler64)); else space->nop_write(0xb0000, 0xb7fff);
747               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler64)); else space->nop_write(0xb8000, 0xbffff);
742               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler64, read_handler_name); else space->nop_read(0xa0000, 0xaffff);
743               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler64, read_handler_name); else space->nop_read(0xb0000, 0xb7fff);
744               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler64, read_handler_name); else space->nop_read(0xb8000, 0xbffff);
745               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler64, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
746               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler64, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
747               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler64, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
748748            }
749749            else
750750            {
src/emu/video/upd3301.c
r11224r11225
107107//**************************************************************************
108108
109109//-------------------------------------------------
110//  set_interrupt -
110//  set_interrupt -
111111//-------------------------------------------------
112112
113113inline void upd3301_device::set_interrupt(int state)
r11224r11225
369369
370370
371371//-------------------------------------------------
372//  read -
372//  read -
373373//-------------------------------------------------
374374
375375READ8_MEMBER( upd3301_device::read )
r11224r11225
392392
393393
394394//-------------------------------------------------
395//  write -
395//  write -
396396//-------------------------------------------------
397397
398398WRITE8_MEMBER( upd3301_device::write )
r11224r11225
533533
534534
535535//-------------------------------------------------
536//  dack_w -
536//  dack_w -
537537//-------------------------------------------------
538538
539539WRITE8_MEMBER( upd3301_device::dack_w )
r11224r11225
557557   if ((m_data_fifo_pos == m_h) && (m_attr_fifo_pos == (m_attr << 1)))
558558   {
559559      m_input_fifo = !m_input_fifo;
560     
560
561561      m_data_fifo_pos = 0;
562562      m_attr_fifo_pos = 0;
563     
563
564564      draw_scanline();
565565
566566      if (m_y == (m_l * m_r))
r11224r11225
573573
574574
575575//-------------------------------------------------
576//  lpen_w -
576//  lpen_w -
577577//-------------------------------------------------
578578
579579WRITE_LINE_MEMBER( upd3301_device::lpen_w )
r11224r11225
582582
583583
584584//-------------------------------------------------
585//  hrtc_r -
585//  hrtc_r -
586586//-------------------------------------------------
587587
588588READ_LINE_MEMBER( upd3301_device::hrtc_r )
r11224r11225
592592
593593
594594//-------------------------------------------------
595//  vrtc_r -
595//  vrtc_r -
596596//-------------------------------------------------
597597
598598READ_LINE_MEMBER( upd3301_device::vrtc_r )
r11224r11225
602602
603603
604604//-------------------------------------------------
605//  draw_scanline -
605//  draw_scanline -
606606//-------------------------------------------------
607607
608608void upd3301_device::draw_scanline()
r11224r11225
630630
631631
632632//-------------------------------------------------
633//  update_screen -
633//  update_screen -
634634//-------------------------------------------------
635635
636636void upd3301_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
src/emu/video/upd3301.h
r11224r11225
5454   MCFG_DEVICE_ADD(_tag, UPD3301, _clock) \
5555   MCFG_DEVICE_CONFIG(_intrf)
5656
57   
57
5858#define UPD3301_INTERFACE(name) \
5959   const upd3301_interface (name) =
6060
r11224r11225
147147   inline void update_hrtc_timer(int state);
148148   inline void update_vrtc_timer(int state);
149149   inline void recompute_parameters();
150   
150
151151   void draw_scanline();
152   
152
153153   devcb_resolved_write_line      m_out_int_func;
154154   devcb_resolved_write_line      m_out_drq_func;
155155   devcb_resolved_write_line      m_out_hrtc_func;
r11224r11225
191191   int m_z;                  // horizontal blanking width
192192
193193   // attributes
194   int m_at1;                  //
195   int m_at0;                  //
196   int m_sc;                  //
194   int m_at1;                  //
195   int m_at0;                  //
196   int m_sc;                  //
197197   int m_attr;                  // attributes per row
198198   int m_attr_blink;            // attribute blink
199199   int m_attr_frame;            // attribute blink frame counter
src/emu/video/hd44102.c
r11224r11225
7474//**************************************************************************
7575
7676//-------------------------------------------------
77//  count_up_or_down -
77//  count_up_or_down -
7878//-------------------------------------------------
7979
8080inline void hd44102_device::count_up_or_down()
r11224r11225
235235      else
236236      {
237237         if (LOG) logerror("HD44102 '%s' Address X %u Y %u (%02x)\n", tag(), data, x, y);
238         
238
239239         m_x = x;
240240         m_y = y;
241241      }
src/emu/video/dm9368.c
r11224r11225
7171//**************************************************************************
7272
7373//-------------------------------------------------
74//  get_rbi -
74//  get_rbi -
7575//-------------------------------------------------
7676
7777inline int dm9368_device::get_rbi()
r11224r11225
8686
8787
8888//-------------------------------------------------
89//  set_rbo -
89//  set_rbo -
9090//-------------------------------------------------
9191
9292inline void dm9368_device::set_rbo(int state)
r11224r11225
131131
132132
133133//-------------------------------------------------
134//  a_w -
134//  a_w -
135135//-------------------------------------------------
136136
137137void dm9368_device::a_w(UINT8 data)
src/emu/video/sed1330.c
r11224r11225
278278
279279
280280//-------------------------------------------------
281//  status_r -
281//  status_r -
282282//-------------------------------------------------
283283
284284READ8_MEMBER( sed1330_device::status_r )
r11224r11225
290290
291291
292292//-------------------------------------------------
293//  command_w -
293//  command_w -
294294//-------------------------------------------------
295295
296296WRITE8_MEMBER( sed1330_device::command_w )
r11224r11225
326326
327327
328328//-------------------------------------------------
329//  data_r -
329//  data_r -
330330//-------------------------------------------------
331331
332332READ8_MEMBER( sed1330_device::data_r )
r11224r11225
342342
343343
344344//-------------------------------------------------
345//  data_w -
345//  data_w -
346346//-------------------------------------------------
347347
348348WRITE8_MEMBER( sed1330_device::data_w )
r11224r11225
617617
618618
619619//-------------------------------------------------
620//  draw_text_scanline -
620//  draw_text_scanline -
621621//-------------------------------------------------
622622
623623void sed1330_device::draw_text_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va)
r11224r11225
658658
659659
660660//-------------------------------------------------
661//  draw_graphics_scanline -
661//  draw_graphics_scanline -
662662//-------------------------------------------------
663663
664664void sed1330_device::draw_graphics_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va)
r11224r11225
679679
680680
681681//-------------------------------------------------
682//  update_graphics -
682//  update_graphics -
683683//-------------------------------------------------
684684
685685void sed1330_device::update_graphics(bitmap_t *bitmap, const rectangle *cliprect)
r11224r11225
688688
689689
690690//-------------------------------------------------
691//  update_text -
691//  update_text -
692692//-------------------------------------------------
693693
694694void sed1330_device::update_text(bitmap_t *bitmap, const rectangle *cliprect)
r11224r11225
721721
722722
723723//-------------------------------------------------
724//  update_screen -
724//  update_screen -
725725//-------------------------------------------------
726726
727727void sed1330_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
src/emu/video/cdp1861.c
r11224r11225
217217
218218
219219//-------------------------------------------------
220//  dma_w -
220//  dma_w -
221221//-------------------------------------------------
222222
223223WRITE8_MEMBER( cdp1861_device::dma_w )
r11224r11225
236236
237237
238238//-------------------------------------------------
239//  disp_on_w -
239//  disp_on_w -
240240//-------------------------------------------------
241241
242242WRITE_LINE_MEMBER( cdp1861_device::disp_on_w )
r11224r11225
248248
249249
250250//-------------------------------------------------
251//  disp_off_w -
251//  disp_off_w -
252252//-------------------------------------------------
253253
254254WRITE_LINE_MEMBER( cdp1861_device::disp_off_w )
r11224r11225
263263
264264
265265//-------------------------------------------------
266//  update_screen -
266//  update_screen -
267267//-------------------------------------------------
268268
269269void cdp1861_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
src/emu/video/cdp1862.c
r11224r11225
7474//**************************************************************************
7575
7676//-------------------------------------------------
77//  initialize_palette -
77//  initialize_palette -
7878//-------------------------------------------------
7979
8080inline void cdp1862_device::initialize_palette()
r11224r11225
160160
161161
162162//-------------------------------------------------
163//  dma_w -
163//  dma_w -
164164//-------------------------------------------------
165165
166166WRITE8_MEMBER( cdp1862_device::dma_w )
r11224r11225
194194
195195
196196//-------------------------------------------------
197//  disp_on_w -
197//  disp_on_w -
198198//-------------------------------------------------
199199
200200WRITE_LINE_MEMBER( cdp1862_device::bkg_w )
r11224r11225
203203   {
204204      m_bgcolor++;
205205
206      if (m_bgcolor > 3)
206      if (m_bgcolor > 3)
207207      {
208208         m_bgcolor = 0;
209209      }
r11224r11225
212212
213213
214214//-------------------------------------------------
215//  disp_off_w -
215//  disp_off_w -
216216//-------------------------------------------------
217217
218218WRITE_LINE_MEMBER( cdp1862_device::con_w )
r11224r11225
225225
226226
227227//-------------------------------------------------
228//  update_screen -
228//  update_screen -
229229//-------------------------------------------------
230230
231231void cdp1862_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect)
src/emu/video/sed1330.h
r11224r11225
9292   inline UINT8 readbyte(offs_t address);
9393   inline void writebyte(offs_t address, UINT8 m_data);
9494   inline void increment_csr();
95   
95
9696   void draw_text_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va);
9797   void draw_graphics_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va);
9898   void update_graphics(bitmap_t *bitmap, const rectangle *cliprect);
src/emu/devcb.h
r11224r11225
8686
8787// static template for a read16 stub function that calls through a given READ16_MEMBER
8888template<class _Class, UINT16 (_Class::*_Function)(address_space &, offs_t, UINT16)>
89UINT16 devcb_stub(device_t *device, offs_t offset)
89UINT16 devcb_stub16(device_t *device, offs_t offset)
9090{
9191   _Class *target = downcast<_Class *>(device);
9292   return (target->*_Function)(*memory_nonspecific_space(device->machine()), offset, 0xffff);
r11224r11225
110110
111111// static template for a write16 stub function that calls through a given WRITE16_MEMBER
112112template<class _Class, void (_Class::*_Function)(address_space &, offs_t, UINT16, UINT16)>
113void devcb_stub(device_t *device, offs_t offset, UINT16 data)
113void devcb_stub16(device_t *device, offs_t offset, UINT16 data)
114114{
115115   _Class *target = downcast<_Class *>(device);
116116   (target->*_Function)(*memory_nonspecific_space(device->machine()), offset, data, 0xffff);
src/emu/video.c
r11224r11225
180180   // if no screens, create a periodic timer to drive updates
181181   if (machine.primary_screen == NULL)
182182   {
183      m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(&screenless_update_callback), this);
183      m_screenless_frame_timer = machine.scheduler().timer_alloc(FUNC(screenless_update_callback), this);
184184      m_screenless_frame_timer->adjust(screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD);
185185   }
186186}
src/emu/emualloc.c
r11224r11225
157157
158158
159159//-------------------------------------------------
160//  malloc_array_file_line - allocate memory with
160//  malloc_array_file_line - allocate memory with
161161//  file and line number information, and a hint
162162//  that this object is an array
163163//-------------------------------------------------
src/emu/machine.c
r11224r11225
944944void driver_device_config_base::static_set_game(device_config *device, const game_driver *game)
945945{
946946   driver_device_config_base *base = downcast<driver_device_config_base *>(device);
947   
947
948948   base->m_system = game;
949949
950    // set the short name to the game's name
950   // set the short name to the game's name
951951   base->m_shortname = game->name;
952   
952
953953   // and set the search path to include all parents
954954   base->m_searchpath = game->name;
955955   for (int parent = driver_list::clone(*game); parent != -1; parent = driver_list::clone(parent))
src/emu/sound/ymz280b.c
r11224r11225
116116static TIMER_CALLBACK( update_irq_state_timer_6 );
117117static TIMER_CALLBACK( update_irq_state_timer_7 );
118118
119static const timer_expired_func update_irq_state_cb[] =
119static const struct { timer_expired_func func; const char *name; } update_irq_state_cb[] =
120120{
121   update_irq_state_timer_0,
122   update_irq_state_timer_1,
123   update_irq_state_timer_2,
124   update_irq_state_timer_3,
125   update_irq_state_timer_4,
126   update_irq_state_timer_5,
127   update_irq_state_timer_6,
128   update_irq_state_timer_7
121   { FUNC(update_irq_state_timer_0) },
122   { FUNC(update_irq_state_timer_1) },
123   { FUNC(update_irq_state_timer_2) },
124   { FUNC(update_irq_state_timer_3) },
125   { FUNC(update_irq_state_timer_4) },
126   { FUNC(update_irq_state_timer_5) },
127   { FUNC(update_irq_state_timer_6) },
128   { FUNC(update_irq_state_timer_7) }
129129};
130130
131131
r11224r11225
205205      struct YMZ280BVoice *voice = &chip->voice[j];
206206      update_step(chip, voice);
207207      if(voice->irq_schedule)
208         machine.scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[j]), 0, chip);
208         machine.scheduler().timer_set(attotime::zero, update_irq_state_cb[j].func, update_irq_state_cb[j].name, 0, chip);
209209   }
210210}
211211
r11224r11225
581581            voice->playing = 0;
582582
583583            /* set update_irq_state_timer. IRQ is signaled on next CPU execution. */
584            chip->device->machine().scheduler().timer_set(attotime::zero, FUNC(update_irq_state_cb[v]), 0, chip);
584            chip->device->machine().scheduler().timer_set(attotime::zero, update_irq_state_cb[v].func, update_irq_state_cb[v].name, 0, chip);
585585            voice->irq_schedule = 1;
586586         }
587587      }
src/emu/sound/wave.c
r11224r11225
2828   double time_index;
2929   double duration;
3030   stream_sample_t *left_buffer = outputs[0];
31   stream_sample_t *right_buffer = NULL;   
31   stream_sample_t *right_buffer = NULL;
3232   int i;
3333
3434   if (speakers>1)
src/emu/sound/pokey.c
r11224r11225
648648   chip->clockmult = DIV_64;
649649   chip->KBCODE = 0x09;       /* Atari 800 'no key' */
650650   chip->SKCTL = SK_RESET;    /* let the RNG run after reset */
651   chip->rtimer = device->machine().scheduler().timer_alloc(FUNC(NULL));
651   chip->rtimer = device->machine().scheduler().timer_alloc(FUNC_NULL);
652652
653653   chip->timer[0] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip);
654654   chip->timer[1] = device->machine().scheduler().timer_alloc(FUNC(pokey_timer_expire), chip);
src/emu/sound/k053260.c
r11224r11225
258258
259259   /* setup SH1 timer if necessary */
260260   if ( ic->intf->irq )
261      device->machine().scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, FUNC(ic->intf->irq ));
261      device->machine().scheduler().timer_pulse( attotime::from_hz(device->clock()) * 32, ic->intf->irq, "ic->intf->irq" );
262262}
263263
264264INLINE void check_bounds( k053260_state *ic, int channel )
src/emu/sound/tms5220.c
r11224r11225
273273 * if VOICED_ZERO_HACK defined, acts as shown in patent, but the first and >=51 samples are 0x80 (-128)
274274 * if VOICED_PULSE_HACK defined, acts as a pulse waveform with a period of PWIDTH samples at PAMP, PWIDTH samples at ~PAMP, and the rest at 0
275275 * if VOICED_PULSE_MONOPOLAR_HACK defined, acts as a pulse waveform with a period of PWIDTH samples at PAMP, and the rest at 0
276 * If you want this to sound like MGE, set VOICED_PULSE_MONOPOLAR_HACK to 1, PAMP to 0x3F and PWIDTH to 1
276 * If you want this to sound like MGE, set VOICED_PULSE_MONOPOLAR_HACK to 1, PAMP to 0x3F and PWIDTH to 2, and set the perfect interpolation hack below on as well.
277277 */
278278#undef VOICED_INV_HACK
279279#undef VOICED_ZERO_HACK
r11224r11225
288288#undef ALLOW_4_LSB
289289
290290/* HACK: if defined, uses impossibly perfect 'straight line' interpolation */
291// TODO: as of around mame 0.141 this doesn't work right. please fix! - LN, to LN
292291#undef PERFECT_INTERPOLATION_HACK
293292
294293
r11224r11225
10011000      {
10021001         if (tms->interp_period == 0) tms->inhibit = 0; // disable inhibit when reaching the last interp period
10031002#ifdef PERFECT_INTERPOLATION_HACK
1004         int samples_per_frame = tms->subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
1005         int current_sample = ((tms->PC*(3-tms->subc_reload))+((tms->subc_reload?38:25)*tms->interp_period));
1003         int samples_per_frame = tms->subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
1004         //int samples_per_frame = tms->subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
1005         int current_sample = (tms->subcycle - tms->subc_reload)+(tms->PC*(3-tms->subc_reload))+((tms->subc_reload?25:38)*((tms->interp_period-1)&7));
1006
10061007         zpar = OLD_FRAME_UNVOICED_FLAG;
1008         //fprintf(stderr, "CS: %03d", current_sample);
10071009         // reset the current energy, pitch, etc to what it was at frame start
10081010         tms->current_energy = tms->coeff->energytable[tms->old_frame_energy_idx];
10091011         tms->current_pitch = tms->coeff->pitchtable[tms->old_frame_pitch_idx];
r11224r11225
10111013            tms->current_k[i] = tms->coeff->ktable[i][tms->old_frame_k_idx[i]];
10121014         for (i = 4; i < tms->coeff->num_k; i++)
10131015            tms->current_k[i] = (tms->coeff->ktable[i][tms->old_frame_k_idx[i]] * (1-zpar));
1014         // now adjust each value to be exactly correct for each of the samples per frsme
1015         tms->current_energy += (((tms->target_energy - tms->current_energy)*(1-tms->inhibit))*current_sample)/samples_per_frame;
1016         tms->current_pitch += (((tms->target_pitch - tms->current_pitch)*(1-tms->inhibit))*current_sample)/samples_per_frame;
1017         for (i = 0; i < tms->coeff->num_k; i++)
1018            tms->current_k[i] += (((tms->target_k[i] - tms->current_k[i])*(1-tms->inhibit))*current_sample)/samples_per_frame;
1016         // now adjust each value to be exactly correct for each of the samples per frame
1017         if (tms->interp_period != 0) // if we're still interpolating...
1018         {
1019            tms->current_energy += (((tms->target_energy - tms->current_energy)*(1-tms->inhibit))*current_sample)/samples_per_frame;
1020            tms->current_pitch += (((tms->target_pitch - tms->current_pitch)*(1-tms->inhibit))*current_sample)/samples_per_frame;
1021            for (i = 0; i < tms->coeff->num_k; i++)
1022               tms->current_k[i] += (((tms->target_k[i] - tms->current_k[i])*(1-tms->inhibit))*current_sample)/samples_per_frame;
1023         }
1024         else // we're done, play this frame for 1/8 frame.
1025         {
1026            tms->current_energy = tms->target_energy;
1027            tms->current_pitch = tms->target_pitch;
1028            for (i = 0; i < tms->coeff->num_k; i++)
1029               tms->current_k[i] = tms->target_k[i];
1030         }
10191031#else
10201032         //Updates to parameters only happen on subcycle '2' (B cycle) of PCs.
10211033         if (tms->subcycle == 2)
r11224r11225
11131125   }
11141126      this_sample = lattice_filter(tms); /* execute lattice filter */
11151127#ifdef DEBUG_GENERATION_VERBOSE
1128      //fprintf(stderr,"C: %01d; ",tms->subcycle);
11161129      //fprintf(stderr,"IP: %01d; PC: %02d; X:%04d; E:%04d; P:%04d; Pc:%04d ",tms->interp_period, tms->PC, tms->excitation_data, tms->current_energy, tms->current_pitch, tms->pitch_count);
11171130      fprintf(stderr,"X:%04d; E:%04d; P:%04d; Pc:%04d ", tms->excitation_data, tms->current_energy, tms->current_pitch, tms->pitch_count);
11181131      for (i=0; i<10; i++)
src/emu/emutempl.h
r11224r11225
247247
248248// ======================> simple_list_wrapper
249249
250// a simple_list_wrapper wraps an existing object with a next pointer so it
250// a simple_list_wrapper wraps an existing object with a next pointer so it
251251// can live in a simple_list without requiring the object to have a next
252252// pointer
253253template<class T>
r11224r11225
258258   simple_list_wrapper(T *object)
259259      : m_next(NULL),
260260        m_object(object) { }
261   
261
262262   // operators
263263   operator T *() { return m_object; }
264264   operator T *() const { return m_object; }
265265   T *operator *() { return m_object; }
266266   T *operator *() const { return m_object; }
267   
267
268268   // getters
269269   simple_list_wrapper *next() const { return m_next; }
270270   T *object() const { return m_object; }
src/emu/clifront.c
r11224r11225
231231
232232
233233//-------------------------------------------------
234//  listxml - output the XML data for one or more
234//  listxml - output the XML data for one or more
235235//  games
236236//-------------------------------------------------
237237
r11224r11225
249249
250250
251251//-------------------------------------------------
252//  listfull - output the name and description of
252//  listfull - output the name and description of
253253//  one or more games
254254//-------------------------------------------------
255 
255
256256void cli_frontend::listfull(const char *gamename)
257257{
258258   // determine which drivers to output; return an error if none found
r11224r11225
271271
272272
273273//-------------------------------------------------
274//  listsource - output the name and source
274//  listsource - output the name and source
275275//  filename of one or more games
276276//-------------------------------------------------
277277
r11224r11225
290290
291291
292292//-------------------------------------------------
293//  listclones - output the name and parent of all
293//  listclones - output the name and parent of all
294294//  clones matching the given pattern
295295//-------------------------------------------------
296296
r11224r11225
299299   // start with a filtered list of drivers
300300   driver_enumerator drivlist(m_options, gamename);
301301   int original_count = drivlist.count();
302   
302
303303   // iterate through the remaining ones to see if their parent matches
304304   while (drivlist.next_excluded())
305305   {
r11224r11225
309309         if (drivlist.matches(gamename, drivlist.driver(clone_of).name))
310310            drivlist.include();
311311   }
312   
312
313313   // return an error if none found
314314   if (drivlist.count() == 0)
315315   {
r11224r11225
336336
337337
338338//-------------------------------------------------
339//  listbrothers - for each matching game, output
340//  the list of other games that share the same
339//  listbrothers - for each matching game, output
340//  the list of other games that share the same
341341//  source file
342342//-------------------------------------------------
343343
r11224r11225
358358      // if we are already marked in the final list, we don't need to do anything
359359      if (drivlist.included(initial_drivlist.current()))
360360         continue;
361     
361
362362      // otherwise, walk excluded items in the final list and mark any that match
363363      drivlist.reset();
364364      while (drivlist.next_excluded())
365365         if (strcmp(drivlist.driver().source_file, initial_drivlist.driver().source_file) == 0)
366366            drivlist.include();
367367   }
368   
368
369369   // print the header
370370   mame_printf_info("Source file:     Name:            Parent:\n");
371371
r11224r11225
381381
382382
383383//-------------------------------------------------
384//  listcrc - output the CRC and name of all ROMs
384//  listcrc - output the CRC and name of all ROMs
385385//  referenced by the emulator
386386//-------------------------------------------------
387387
r11224r11225
407407
408408
409409//-------------------------------------------------
410//  listroms - output the list of ROMs referenced
410//  listroms - output the list of ROMs referenced
411411//  by a given game or set of games
412412//-------------------------------------------------
413413
r11224r11225
469469
470470
471471//-------------------------------------------------
472//  listsamples - output the list of samples
472//  listsamples - output the list of samples
473473//  referenced by a given game or set of games
474474//-------------------------------------------------
475475
r11224r11225
491491            break;
492492      if (devconfig == NULL)
493493         continue;
494   
494
495495      // print a header
496496      if (!first)
497497         mame_printf_info("\n");
r11224r11225
514514
515515
516516//-------------------------------------------------
517//  listdevices - output the list of devices
517//  listdevices - output the list of devices
518518//  referenced by a given game or set of games
519519//-------------------------------------------------
520520
r11224r11225
575575   // iterate over drivers
576576   while (drivlist.next())
577577   {
578      // iterate
578      // iterate
579579      const device_config_image_interface *imagedev = NULL;
580580      bool first = true;
581581      for (bool gotone = drivlist.config().m_devicelist.first(imagedev); gotone; gotone = imagedev->next(imagedev))
r11224r11225
596596            if (end == -1)
597597               break;
598598         }
599         
599
600600         // end the line
601601         printf("\n");
602602         first = false;
603603      }
604     
604
605605      // if we didn't get any at all, just print a none line
606606      if (first)
607607         printf("%-13s(none)\n", drivlist.driver().name);
r11224r11225
610610
611611
612612//-------------------------------------------------
613//  verifyroms - verify the ROM sets of one or
613//  verifyroms - verify the ROM sets of one or
614614//  more games
615615//-------------------------------------------------
616616
r11224r11225
636636      astring summary_string;
637637      auditor.summarize(&summary_string);
638638      mame_printf_info("%s", summary_string.cstr());
639     
639
640640      // if not found, count that and leave it at that
641641      if (summary == media_auditor::NOTFOUND)
642642         notfound++;
r11224r11225
667667               mame_printf_info("is best available\n");
668668               correct++;
669669               break;
670           
670
671671            default:
672672               break;
673673         }
r11224r11225
718718   {
719719      // audit the samples in this set
720720      media_auditor::summary summary = auditor.audit_samples();
721     
721
722722      // output the summary of the audit
723723      astring summary_string;
724724      auditor.summarize(&summary_string);
725725      mame_printf_info("%s", summary_string.cstr());
726     
726
727727      // if not found, print a message and set the flag
728728      if (summary == media_auditor::NOTFOUND)
729729      {
r11224r11225
757757               mame_printf_info("is best available\n");
758758               correct++;
759759               break;
760           
760
761761            default:
762762               break;
763763         }
r11224r11225
10731073
10741074
10751075//-------------------------------------------------
1076//  romident - identify ROMs by looking for
1076//  romident - identify ROMs by looking for
10771077//  matches in our internal database
10781078//-------------------------------------------------
10791079
r11224r11225
10841084   // identify the file, then output results
10851085   mame_printf_info("Identifying %s....\n", filename);
10861086   ident.identify(filename);
1087   mame_printf_info("%s\n", ident.result());
10881087
10891088   // return the appropriate error code
10901089   if (ident.matches() == ident.total())
r11224r11225
11751174      { CLICOMMAND_VERIFYROMS,   &cli_frontend::verifyroms },
11761175      { CLICOMMAND_VERIFYSAMPLES,   &cli_frontend::verifysamples },
11771176      { CLICOMMAND_LISTMEDIA,      &cli_frontend::listmedia },
1178//      { CLICOMMAND_LISTSOFTWARE,   &cli_frontend::listsoftware },
1177//      { CLICOMMAND_LISTSOFTWARE,  &cli_frontend::listsoftware },
11791178      { CLICOMMAND_ROMIDENT,      &cli_frontend::romident }
11801179   };
11811180
r11224r11225
12021201void cli_frontend::display_help()
12031202{
12041203   mame_printf_info(APPLONGNAME " v%s - " FULLLONGNAME "\n"
1205         COPYRIGHT_INFO "\n\n", build_version);         
1204         COPYRIGHT_INFO "\n\n", build_version);
12061205   mame_printf_info("%s\n", DISCLAIMER);
12071206   mame_printf_info(USAGE "\n\n"
12081207         "        " APPNAME " -showusage    for a brief list of options\n"
r11224r11225
12581257            astring curfile(filename, PATH_SEPARATOR, entry->name);
12591258            identify_file(curfile);
12601259         }
1261     
1260
12621261      // close the directory and be done
12631262      osd_closedir(directory);
12641263   }
r11224r11225
13111310   {
13121311      // output the name
13131312      astring basename;
1314      m_result.catprintf("%-20s", core_filename_extract_base(&basename, name, FALSE)->cstr());
1313      mame_printf_info("%-20s", core_filename_extract_base(&basename, name, FALSE)->cstr());
13151314      m_total++;
13161315
13171316      // attempt to open as a CHD; fail if not
r11224r11225
13191318      chd_error err = chd_open(name, CHD_OPEN_READ, NULL, &chd);
13201319      if (err != CHDERR_NONE)
13211320      {
1322         m_result.catprintf("NOT A CHD\n");
1321         mame_printf_info("NOT A CHD\n");
13231322         m_nonroms++;
13241323         return;
13251324      }
r11224r11225
13311330      // error on writable CHDs
13321331      if (header.flags & CHDFLAGS_IS_WRITEABLE)
13331332      {
1334         m_result.catprintf("is a writeable CHD\n");
1333         mame_printf_info("is a writeable CHD\n");
13351334         return;
13361335      }
1337     
1336
13381337      // otherwise, get the hash collection for this CHD
13391338      static const UINT8 nullhash[20] = { 0 };
13401339      hash_collection hashes;
r11224r11225
13471346      // determine whether this file exists
13481347      int found = find_by_hash(hashes, header.logicalbytes);
13491348      if (found == 0)
1350         m_result.catprintf("NO MATCH\n");
1349         mame_printf_info("NO MATCH\n");
13511350      else
13521351         m_matches++;
13531352   }
1354   
1353
13551354   // all other files have their hashes computed directly
13561355   else
13571356   {
r11224r11225
13921391   // output the name
13931392   m_total++;
13941393   astring basename;
1395   m_result.catprintf("%-20s", core_filename_extract_base(&basename, name, FALSE)->cstr());
1394   mame_printf_info("%-20s", core_filename_extract_base(&basename, name, FALSE)->cstr());
13961395
13971396   // see if we can find a match in the ROMs
13981397   int found = find_by_hash(hashes, length);
r11224r11225
14031402      // if not a power of 2, assume it is a non-ROM file
14041403      if ((length & (length - 1)) != 0)
14051404      {
1406         m_result.catprintf("NOT A ROM\n");
1405         mame_printf_info("NOT A ROM\n");
14071406         m_nonroms++;
14081407      }
14091408
14101409      // otherwise, it's just not a match
14111410      else
1412         m_result.catprintf("NO MATCH\n");
1411         mame_printf_info("NO MATCH\n");
14131412   }
14141413
14151414   // if we did find it, count it as a match
r11224r11225
14841483            }
14851484      }
14861485   }
1487   
1486
14881487   return found;
14891488}
src/emu/uiswlist.c
r11224r11225
33    uiswlist.c
44
55    Internal MAME user interface for software list.
6
6
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
r11224r11225
3232struct _software_entry_state
3333{
3434   software_entry_state *next;
35   
35
3636   const char *short_name;
3737   const char *long_name;
3838   const char *interface;
r11224r11225
6464static void ui_mess_menu_populate_software_parts(running_machine &machine, ui_menu *menu, const char *swlist, const char *swinfo, const char *interface)
6565{
6666   software_list *list = software_list_open(machine.options(), swlist, FALSE, NULL);
67   
67
6868   if (list)
6969   {
7070      software_info *info = software_list_find(list, swinfo, NULL);
71     
71
7272      if (info)
7373      {
7474         for (software_part *swpart = software_find_part(info, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
r11224r11225
9191            }
9292         }
9393      }
94     
94
9595      software_list_close(list);
9696   }
9797}
r11224r11225
103103   const char *swlist = sw_state->list_name;
104104   const char *swinfo = sw_state->short_name;
105105   const char *interface = sw_state->interface;
106   
106
107107   // generate list of available parts
108108   if (!ui_menu_populated(menu))
109109   {
r11224r11225
112112         ui_mess_menu_populate_software_parts(machine, menu, swlist, swinfo, interface);
113113      }
114114   }
115   
115
116116   /* process the menu */
117117   event = ui_menu_process(machine, menu, 0);
118   
118
119119   if (event != NULL && event->iptkey == IPT_UI_SELECT && event->itemref != NULL)
120120   {
121121      software_part_state *entry = (software_part_state *) event->itemref;
122     
122
123123      // build the name for the part to be loaded
124124      astring temp_name(sw_state->short_name);
125125      temp_name.cat(":");
126126      temp_name.cat(entry->part_name);
127127      //printf("%s\n", temp_name.cstr());
128     
128
129129      sw_state->image->load(temp_name.cstr());
130130   }
131131}
r11224r11225
146146      e1_basename = (e1->long_name != NULL) ? e1->long_name : "";
147147      e2_basename = (e2->long_name != NULL) ? e2->long_name : "";
148148   }
149   
149
150150   result = mame_stricmp(e1_basename, e2_basename);
151151   if (result == 0)
152152   {
r11224r11225
159159            result = 1;
160160      }
161161   }
162   
162
163163   return result;
164164}
165165
r11224r11225
171171   software_entry_state *entry = NULL;
172172   software_entry_state **entryptr;
173173   const char *interface = image->image_config().image_interface();
174   
174
175175   // check if at least one of the parts has the correct interface and add a menu entry only in this case
176176   for (software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
177177   {
r11224r11225
180180         // allocate a new entry
181181         entry = (software_entry_state *) ui_menu_pool_alloc(menu, sizeof(*entry));
182182         memset(entry, 0, sizeof(*entry));
183         
183
184184         entry->short_name = ui_menu_pool_strdup(menu, swinfo->shortname);
185185         entry->long_name = ui_menu_pool_strdup(menu, swinfo->longname);
186186         entry->list_name = list_name;
r11224r11225
189189         break;
190190      }
191191   }
192   
192
193193   // find the end of the list
194194   entryptr = &menustate->entrylist;
195195   while ((*entryptr != NULL) && (compare_software_entries(entry, *entryptr, menustate->ordered_by_shortname) >= 0))
196196      entryptr = &(*entryptr)->next;
197   
197
198198   // insert the entry
199199   entry->next = *entryptr;
200200   *entryptr = entry;
201   
201
202202   return entry;
203203}
204204
r11224r11225
206206static void ui_mess_menu_populate_software_entries(running_machine &machine, ui_menu *menu, software_menu_state *menustate)
207207{
208208   software_list *list = software_list_open(machine.options(), menustate->list_name, FALSE, NULL);
209   
209
210210   // build up the list of entries for the menu
211211   if (list)
212212   {
213213      for (software_info *swinfo = software_list_find(list, "*", NULL); swinfo != NULL; swinfo = software_list_find(list, "*", swinfo))
214214         append_software_entry(menu, menustate, swinfo, menustate->list_name, menustate->image);
215     
215
216216      software_list_close(list);
217217   }
218   
218
219219   // add an entry to change ordering
220220   ui_menu_item_append(menu, "Switch Item Ordering", NULL, 0, (void *)1);
221221
r11224r11225
227227bool swinfo_has_multiple_parts(software_info *swinfo, const char *interface)
228228{
229229   int count = 0;
230   
230
231231   for (software_part *swpart = software_find_part(swinfo, NULL, NULL); swpart != NULL; swpart = software_part_next(swpart))
232232   {
233233      if (strcmp(interface, swpart->interface_) == 0)
r11224r11225
243243   const software_entry_state *entry;
244244   const software_entry_state *selected_entry = NULL;
245245   int bestmatch = 0;
246   
246
247247   if (!ui_menu_populated(menu) || sw_state->reorder)
248248   {
249249      sw_state->reorder = 0;
r11224r11225
253253         ui_mess_menu_populate_software_entries(machine, menu, sw_state);
254254      }
255255   }
256   
256
257257   /* process the menu */
258258   event = ui_menu_process(machine, menu, 0);
259   
259
260260   if (event != NULL && event->itemref != NULL)
261261   {
262262      if ((FPTR)event->itemref == 1 && event->iptkey == IPT_UI_SELECT)
r11224r11225
278278         software_entry_state *entry = (software_entry_state *) event->itemref;
279279         software_list *tmp_list = software_list_open(machine.options(), sw_state->list_name, FALSE, NULL);
280280         software_info *tmp_info = software_list_find(tmp_list, entry->short_name, NULL);
281         
281
282282         // if the selected software has multiple parts that can be loaded, open the submenu
283283         if (swinfo_has_multiple_parts(tmp_info, image->image_config().image_interface()))
284284         {
r11224r11225
299299               popmessage("No matching device found for interface '%s'!", entry->interface);
300300         }
301301         software_list_close(tmp_list);
302         
302
303303         // reset the char buffer when pressing IPT_UI_SELECT
304304         if (sw_state->filename_buffer[0] != '\0')
305305            memset(sw_state->filename_buffer, '\0', ARRAY_LENGTH(sw_state->filename_buffer));
r11224r11225
308308      {
309309         int buflen = strlen(sw_state->filename_buffer);
310310         bool update_selected = FALSE;
311         
311
312312         /* if it's a backspace and we can handle it, do so */
313313         if ((event->unichar == 8 || event->unichar == 0x7f) && buflen > 0)
314314         {
315315            *(char *)utf8_previous_char(&sw_state->filename_buffer[buflen]) = 0;
316316            update_selected = TRUE;
317           
317
318318            if (ARRAY_LENGTH(sw_state->filename_buffer) > 0)
319319               ui_popup_time(ERROR_MESSAGE_TIME, "%s", sw_state->filename_buffer);
320320         }
r11224r11225
324324            buflen += utf8_from_uchar(&sw_state->filename_buffer[buflen], ARRAY_LENGTH(sw_state->filename_buffer) - buflen, event->unichar);
325325            sw_state->filename_buffer[buflen] = 0;
326326            update_selected = TRUE;
327           
327
328328            if (ARRAY_LENGTH(sw_state->filename_buffer) > 0)
329329               ui_popup_time(ERROR_MESSAGE_TIME, "%s", sw_state->filename_buffer);
330330         }
r11224r11225
354354                     if (mame_strnicmp(compare_name, sw_state->filename_buffer, i) == 0)
355355                        match = i;
356356                  }
357                 
357
358358                  if (match > bestmatch)
359359                  {
360360                     bestmatch = match;
r11224r11225
366366            for (entry = sw_state->entrylist; entry != cur_selected; entry = entry->next)
367367            {
368368               const char *compare_name = sw_state->ordered_by_shortname ? entry->short_name : entry->long_name;
369               
369
370370               if (compare_name != NULL && sw_state->filename_buffer != NULL)
371371               {
372372                  int match = 0;
r11224r11225
375375                     if (mame_strnicmp(compare_name, sw_state->filename_buffer, i) == 0)
376376                        match = i;
377377                  }
378                 
378
379379                  if (match > bestmatch)
380380                  {
381381                     bestmatch = match;
r11224r11225
383383                  }
384384               }
385385            }
386           
386
387387            if (selected_entry != NULL && selected_entry != cur_selected)
388388               ui_menu_set_selection(menu, (void *) selected_entry);
389389         }
r11224r11225
402402{
403403   bool haveCompatible = FALSE;
404404   const char *interface = image->image_config().image_interface();
405   
405
406406   // Add original software lists for this system
407407   for (const device_config *dev = machine.config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
408408   {
409409      software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
410     
410
411411      for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++)
412412      {
413413         if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_ORIGINAL_SYSTEM))
414414         {
415415            software_list *list = software_list_open(machine.options(), swlist->list_name[i], FALSE, NULL);
416           
416
417417            if (list)
418418            {
419419               bool found = FALSE;
r11224r11225
427427               if (found) {
428428                  ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]);
429429               }
430               
430
431431               software_list_close(list);
432432            }
433433         }
434434      }
435435   }
436   
436
437437   // Add compatible software lists for this system
438438   for (const device_config *dev = machine.config().m_devicelist.first(SOFTWARE_LIST); dev != NULL; dev = dev->typenext())
439439   {
440440      software_list_config *swlist = (software_list_config *)downcast<const legacy_device_config_base *>(dev)->inline_config();
441     
441
442442      for (int i = 0; i < DEVINFO_STR_SWLIST_MAX - DEVINFO_STR_SWLIST_0; i++)
443443      {
444444         if (swlist->list_name[i] && (swlist->list_type == SOFTWARE_LIST_COMPATIBLE_SYSTEM))
445445         {
446446            software_list *list = software_list_open(machine.options(), swlist->list_name[i], FALSE, NULL);
447           
447
448448            if (list)
449449            {
450450               bool found = FALSE;
r11224r11225
461461                  }
462462                  ui_menu_item_append(menu, list->description, NULL, 0, swlist->list_name[i]);
463463               }
464               
464
465465               haveCompatible = TRUE;
466466               software_list_close(list);
467467            }
468468         }
469469      }
470470   }
471   
471
472472}
473473
474474void ui_image_menu_software(running_machine &machine, ui_menu *menu, void *parameter, void *state)
r11224r11225
477477   device_image_interface* image = (device_image_interface*)parameter;
478478   if (!ui_menu_populated(menu))
479479      ui_mess_menu_populate_software_list(machine, menu, image);
480   
480
481481   /* process the menu */
482482   event = ui_menu_process(machine, menu, 0);
483   
483
484484   if (event != NULL && event->iptkey == IPT_UI_SELECT)
485485   {
486486      ui_menu *child_menu = ui_menu_alloc(machine, &machine.render().ui_container(), ui_mess_menu_software_list, NULL);
src/emu/clifront.h
r11224r11225
9999   // construction/destruction
100100   cli_frontend(cli_options &options, osd_interface &osd);
101101   ~cli_frontend();
102   
102
103103   // execute based on the incoming argc/argv
104104   int execute(int argc, char **argv);
105   
105
106106   // direct access to the command operations
107107   void listxml(const char *gamename = "*");
108108   void listfull(const char *gamename = "*");
r11224r11225
140140   media_identifier(cli_options &options);
141141
142142   // getters
143   const char *result() const { return m_result; }
144143   int total() const { return m_total; }
145144   int matches() const { return m_matches; }
146145   int nonroms() const { return m_nonroms; }
147146
148147   // operations
149   void reset() { m_total = m_matches = m_nonroms = 0; m_result.reset(); }
148   void reset() { m_total = m_matches = m_nonroms = 0; }
150149   void identify(const char *name);
151150   void identify_file(const char *name);
152151   void identify_data(const char *name, const UINT8 *data, int length);
r11224r11225
155154private:
156155   // internal state
157156   driver_enumerator   m_drivlist;
158   astring            m_result;
159157   int               m_total;
160158   int               m_matches;
161159   int               m_nonroms;
src/emu/imagedev/chd_cd.c
r11224r11225
173173      case DEVINFO_FCT_IMAGE_LOAD:            info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cdrom); break;
174174      case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cdrom); break;
175175      case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD:      info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(cdrom);   break;
176      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:         
176      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:
177177         if ( device && downcast<const legacy_image_device_config_base *>(device)->inline_config() && get_config_dev(device)->device_displayinfo) {
178178            info->f = (genf *) get_config_dev(device)->device_displayinfo;
179179         } else {
src/emu/imagedev/cassette.c
r11224r11225
428428      case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cassette); break;
429429      case DEVINFO_FCT_IMAGE_DISPLAY:            info->f = (genf *) DEVICE_IMAGE_DISPLAY_NAME(cassette); break;
430430      case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD:      info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(cassette);   break;
431      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:         
431      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:
432432         if ( device && downcast<const legacy_image_device_config_base *>(device)->inline_config() && get_config_dev(device)->device_displayinfo) {
433433            info->f = (genf *) get_config_dev(device)->device_displayinfo;
434434         } else {
src/emu/imagedev/flopdrv.c
r11224r11225
994994      case DEVINFO_FCT_IMAGE_LOAD:            info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(floppy); break;
995995      case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(floppy); break;
996996      case DEVINFO_FCT_IMAGE_SOFTLIST_LOAD:      info->f = (genf *) DEVICE_IMAGE_SOFTLIST_LOAD_NAME(floppy);   break;
997      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:         
997      case DEVINFO_FCT_IMAGE_DISPLAY_INFO:
998998         if ( device && downcast<const legacy_image_device_config_base *>(device)->inline_config() && get_config_dev(device)->device_displayinfo) {
999999            info->f = (genf *) get_config_dev(device)->device_displayinfo;
10001000         } else {
10011001            info->f = NULL;
10021002         }
10031003         break;
1004     
1004
10051005      case DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE:      info->p = (void *)floppy_option_guide; break;
10061006      case DEVINFO_INT_IMAGE_CREATE_OPTCOUNT:
10071007      {
src/emu/softlist.h
r11224r11225
6868{
6969   XML_Parser   parser;
7070   int         done;
71   
71
7272   void (*error_proc)(const char *message);
7373   void *param;
74   
74
7575   enum softlist_parse_position pos;
7676   char **text_dest;
7777};
src/emu/image.c
r11224r11225
155155
156156static void image_options_extract(running_machine &machine)
157157{
158   /* only extract the device options if we've added them
159      no need to assert in case they are missing */
158   /* only extract the device options if we've added them
159       no need to assert in case they are missing */
160160   {
161161      int index = 0;
162162      device_image_interface *image = NULL;
src/emu/hash.c
r11224r11225
445445   for (hash_base *hash = m_hashlist.first(); hash != NULL; hash = hash->next())
446446   {
447447      hash_base *rhs_hash = rhs.hash(hash->id());
448      if (hash != NULL)
448      if (rhs_hash != NULL)
449449      {
450         if (rhs_hash != NULL && *hash != *rhs_hash)
450         if (*hash != *rhs_hash)
451451            return false;
452452         matches++;
453453      }
src/emu/info.h
r11224r11225
5353public:
5454   // construction/destruction
5555   info_xml_creator(driver_enumerator &drivlist);
56   
56
5757   // output
5858   void output(FILE *out);
5959
src/emu/audit.c
r11224r11225
7474   // store validation for later
7575   m_validation = validation;
7676
77// temporary hack until romload is update: get the driver path and support it for
78// all searches
79const char *driverpath = m_enumerator.config().m_devicelist.find("root")->searchpath();
80
7781   // iterate over ROM sources and regions
7882   bool anyfound = false;
7983   bool anyrequired = false;
r11224r11225
8185   {
8286      // determine the search path for this source and iterate through the regions
8387      m_searchpath = source->searchpath();
84     
88
8589      // also determine if this is the driver's specific ROMs or not
8690      bool source_is_gamedrv = (dynamic_cast<const driver_device_config_base *>(source) != NULL);
87     
91
92// temporary hack: add the driver path
93astring combinedpath(m_searchpath, ";", driverpath);
94m_searchpath = combinedpath;
95
8896      // now iterate over regions and ROMs within
8997      for (const rom_entry *region = rom_first_region(*source); region != NULL; region = rom_next_region(region))
9098         for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom))
r11224r11225
94102            // if a dump exists, then at least one entry is required
95103            if (!hashes.flag(hash_collection::FLAG_NO_DUMP))
96104               anyrequired = true;
97           
105
98106            // audit a file
99107            audit_record *record = NULL;
100108            if (ROMREGION_ISROMDATA(region))
r11224r11225
103111            // audit a disk
104112            else if (ROMREGION_ISDISKDATA(region))
105113               record = audit_one_disk(rom);
106           
114
107115            // skip if no record
108116            if (record == NULL)
109117               continue;
110           
111            // if we got a record back,
118
119            // if we got a record back,
112120            if (record->status() != audit_record::STATUS_NOT_FOUND && source_is_gamedrv && also_used_by_parent(hashes) == -1)
113121               anyfound = true;
114122         }
r11224r11225
117125   // if we found nothing, we don't have the set at all
118126   if (!anyfound && anyrequired)
119127      m_record_list.reset();
120   
128
121129   // return a summary
122130   return summarize();
123131}
r11224r11225
152160                  searchpath.cat(";").cat(&intf->samplenames[sampnum][1]);
153161                  continue;
154162               }
155                 
163
156164               // create a new record
157165               audit_record &record = m_record_list.append(*global_alloc(audit_record(intf->samplenames[sampnum], audit_record::MEDIA_SAMPLE)));
158           
166
159167               // look for the files
160168               emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD);
161169               path_iterator path(searchpath);
r11224r11225
172180            }
173181         }
174182      }
175   
183
176184   // return a summary
177185   return summarize();
178186}
r11224r11225
256264         case audit_record::SUBSTATUS_NOT_FOUND_BIOS:
257265            if (string != NULL) string->catprintf("NOT FOUND (BIOS)\n");
258266            break;
259         
267
260268         default:
261269            assert(false);
262270      }
r11224r11225
293301         filerr = file.open(curpath, crc);
294302      else
295303         filerr = file.open(curpath);
296     
304
297305      // if it worked, get the actual length and hashes, then stop
298306      if (filerr == FILERR_NONE)
299307      {
r11224r11225
301309         break;
302310      }
303311   }
304   
312
305313   // compute the final status
306314   compute_status(record, rom, record.actual_length() != 0);
307315   return &record;
r11224r11225
321329   emu_file *source_file;
322330   chd_file *source;
323331   chd_error err = open_disk_image(m_enumerator.options(), &m_enumerator.driver(), rom, &source_file, &source, NULL);
324   
332
325333   // if we succeeded, get the hashes
326334   if (err == CHDERR_NONE)
327335   {
r11224r11225
334342         hashes.add_from_buffer(hash_collection::HASH_MD5, header.md5, sizeof(header.md5));
335343      if (memcmp(nullhash, header.sha1, sizeof(header.sha1)) != 0)
336344         hashes.add_from_buffer(hash_collection::HASH_SHA1, header.sha1, sizeof(header.sha1));
337     
345
338346      // update the actual values
339347      record.set_actual(hashes);
340348
r11224r11225
342350      chd_close(source);
343351      global_free(source_file);
344352   }
345   
353
346354   // compute the final status
347   compute_status(record, rom, record.actual_length() != 0);
355   compute_status(record, rom, err == CHDERR_NONE);
348356   return &record;
349357}
350358
r11224r11225
360368   if (!found)
361369   {
362370      int parent;
363     
371
364372      // no good dump
365373      if (record.expected_hashes().flag(hash_collection::FLAG_NO_DUMP))
366374         record.set_status(audit_record::STATUS_NOT_FOUND, audit_record::SUBSTATUS_NOT_FOUND_NODUMP);
r11224r11225
382390      else
383391         record.set_status(audit_record::STATUS_NOT_FOUND, audit_record::SUBSTATUS_NOT_FOUND);
384392   }
385   
393
386394   // if found, provide more details
387395   else
388396   {
src/emu/memory.c
r11224r11225
20822082         if (readorwrite == ROW_READ)
20832083            switch (data.m_bits)
20842084            {
2085               case 8:      install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read8_delegate(entry.m_rproto8, *object), data.m_mask);      break;
2086               case 16:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read16_delegate(entry.m_rproto16, *object), data.m_mask);      break;
2087               case 32:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read32_delegate(entry.m_rproto32, *object), data.m_mask);      break;
2088               case 64:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read64_delegate(entry.m_rproto64, *object), data.m_mask);      break;
2085               case 8:      install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read8_delegate(entry.m_rproto8, object), data.m_mask);      break;
2086               case 16:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read16_delegate(entry.m_rproto16, object), data.m_mask);      break;
2087               case 32:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read32_delegate(entry.m_rproto32, object), data.m_mask);      break;
2088               case 64:   install_read_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, read64_delegate(entry.m_rproto64, object), data.m_mask);      break;
20892089            }
20902090         else
20912091            switch (data.m_bits)
20922092            {
2093               case 8:      install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write8_delegate(entry.m_wproto8, *object), data.m_mask);      break;
2094               case 16:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write16_delegate(entry.m_wproto16, *object), data.m_mask);   break;
2095               case 32:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write32_delegate(entry.m_wproto32, *object), data.m_mask);   break;
2096               case 64:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write64_delegate(entry.m_wproto64, *object), data.m_mask);   break;
2093               case 8:      install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write8_delegate(entry.m_wproto8, object), data.m_mask);      break;
2094               case 16:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write16_delegate(entry.m_wproto16, object), data.m_mask);   break;
2095               case 32:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write32_delegate(entry.m_wproto32, object), data.m_mask);   break;
2096               case 64:   install_write_handler(entry.m_addrstart, entry.m_addrend, entry.m_addrmask, entry.m_addrmirror, write64_delegate(entry.m_wproto64, object), data.m_mask);   break;
20972097            }
20982098         break;
20992099
r11224r11225
37433743   {
37443744      // 8-bit case
37453745      case 8:
3746         m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate_create(address_table_read, unmap_r<UINT8>, *this));
3747         m_handlers[STATIC_NOP]->set_delegate(read8_delegate_create(address_table_read, nop_r<UINT8>, *this));
3748         m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate_create(address_table_read, watchpoint_r<UINT8>, *this));
3746         m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate(FUNC(address_table_read::unmap_r<UINT8>), this));
3747         m_handlers[STATIC_NOP]->set_delegate(read8_delegate(FUNC(address_table_read::nop_r<UINT8>), this));
3748         m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate(FUNC(address_table_read::watchpoint_r<UINT8>), this));
37493749         break;
37503750
37513751      // 16-bit case
37523752      case 16:
3753         m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate_create(address_table_read, unmap_r<UINT16>, *this));
3754         m_handlers[STATIC_NOP]->set_delegate(read16_delegate_create(address_table_read, nop_r<UINT16>, *this));
3755         m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate_create(address_table_read, watchpoint_r<UINT16>, *this));
3753         m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate(FUNC(address_table_read::unmap_r<UINT16>), this));
3754         m_handlers[STATIC_NOP]->set_delegate(read16_delegate(FUNC(address_table_read::nop_r<UINT16>), this));
3755         m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate(FUNC(address_table_read::watchpoint_r<UINT16>), this));
37563756         break;
37573757
37583758      // 32-bit case
37593759      case 32:
3760         m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate_create(address_table_read, unmap_r<UINT32>, *this));
3761         m_handlers[STATIC_NOP]->set_delegate(read32_delegate_create(address_table_read, nop_r<UINT32>, *this));
3762         m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate_create(address_table_read, watchpoint_r<UINT32>, *this));
3760         m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate(FUNC(address_table_read::unmap_r<UINT32>), this));
3761         m_handlers[STATIC_NOP]->set_delegate(read32_delegate(FUNC(address_table_read::nop_r<UINT32>), this));
3762         m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate(FUNC(address_table_read::watchpoint_r<UINT32>), this));
37633763         break;
37643764
37653765      // 64-bit case
37663766      case 64:
3767         m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate_create(address_table_read, unmap_r<UINT64>, *this));
3768         m_handlers[STATIC_NOP]->set_delegate(read64_delegate_create(address_table_read, nop_r<UINT64>, *this));
3769         m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate_create(address_table_read, watchpoint_r<UINT64>, *this));
3767         m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate(FUNC(address_table_read::unmap_r<UINT64>), this));
3768         m_handlers[STATIC_NOP]->set_delegate(read64_delegate(FUNC(address_table_read::nop_r<UINT64>), this));
3769         m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate(FUNC(address_table_read::watchpoint_r<UINT64>), this));
37703770         break;
37713771   }
37723772
r11224r11225
38193819   {
38203820      // 8-bit case
38213821      case 8:
3822         m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate_create(address_table_write, unmap_w<UINT8>, *this));
3823         m_handlers[STATIC_NOP]->set_delegate(write8_delegate_create(address_table_write, nop_w<UINT8>, *this));
3824         m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate_create(address_table_write, watchpoint_w<UINT8>, *this));
3822         m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate(FUNC(address_table_write::unmap_w<UINT8>), this));
3823         m_handlers[STATIC_NOP]->set_delegate(write8_delegate(FUNC(address_table_write::nop_w<UINT8>), this));
3824         m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate(FUNC(address_table_write::watchpoint_w<UINT8>), this));
38253825         break;
38263826
38273827      // 16-bit case
38283828      case 16:
3829         m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate_create(address_table_write, unmap_w<UINT16>, *this));
3830         m_handlers[STATIC_NOP]->set_delegate(write16_delegate_create(address_table_write, nop_w<UINT16>, *this));
3831         m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate_create(address_table_write, watchpoint_w<UINT16>, *this));
3829         m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate(FUNC(address_table_write::unmap_w<UINT16>), this));
3830         m_handlers[STATIC_NOP]->set_delegate(write16_delegate(FUNC(address_table_write::nop_w<UINT16>), this));
3831         m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate(FUNC(address_table_write::watchpoint_w<UINT16>), this));
38323832         break;
38333833
38343834      // 32-bit case
38353835      case 32:
3836         m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate_create(address_table_write, unmap_w<UINT32>, *this));
3837         m_handlers[STATIC_NOP]->set_delegate(write32_delegate_create(address_table_write, nop_w<UINT32>, *this));
3838         m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate_create(address_table_write, watchpoint_w<UINT32>, *this));
3836         m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate(FUNC(address_table_write::unmap_w<UINT32>), this));
3837         m_handlers[STATIC_NOP]->set_delegate(write32_delegate(FUNC(address_table_write::nop_w<UINT32>), this));
3838         m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate(FUNC(address_table_write::watchpoint_w<UINT32>), this));
38393839         break;
38403840
38413841      // 64-bit case
38423842      case 64:
3843         m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate_create(address_table_write, unmap_w<UINT64>, *this));
3844         m_handlers[STATIC_NOP]->set_delegate(write64_delegate_create(address_table_write, nop_w<UINT64>, *this));
3845         m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate_create(address_table_write, watchpoint_w<UINT64>, *this));
3843         m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate(FUNC(address_table_write::unmap_w<UINT64>), this));
3844         m_handlers[STATIC_NOP]->set_delegate(write64_delegate(FUNC(address_table_write::nop_w<UINT64>), this));
3845         m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate(FUNC(address_table_write::watchpoint_w<UINT64>), this));
38463846         break;
38473847   }
38483848
r11224r11225
44464446   {
44474447      configure_subunits(mask, 8);
44484448      if (m_datawidth == 16)
4449         set_delegate(read16_delegate(read16_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_16_from_8>(delegate.name()), *this));
4449         set_delegate(read16_delegate(&handler_entry_read::read_stub_16_from_8, delegate.name(), this));
44504450      else if (m_datawidth == 32)
4451         set_delegate(read32_delegate(read32_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_32_from_8>(delegate.name()), *this));
4451         set_delegate(read32_delegate(&handler_entry_read::read_stub_32_from_8, delegate.name(), this));
44524452      else if (m_datawidth == 64)
4453         set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_64_from_8>(delegate.name()), *this));
4453         set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_8, delegate.name(), this));
44544454   }
44554455}
44564456
r11224r11225
44754475   {
44764476      configure_subunits(mask, 16);
44774477      if (m_datawidth == 32)
4478         set_delegate(read32_delegate(read32_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_32_from_16>(delegate.name()), *this));
4478         set_delegate(read32_delegate(&handler_entry_read::read_stub_32_from_16, delegate.name(), this));
44794479      else if (m_datawidth == 64)
4480         set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_64_from_16>(delegate.name()), *this));
4480         set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_16, delegate.name(), this));
44814481   }
44824482}
44834483
r11224r11225
45024502   {
45034503      configure_subunits(mask, 32);
45044504      if (m_datawidth == 64)
4505         set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_64_from_32>(delegate.name()), *this));
4505         set_delegate(read64_delegate(&handler_entry_read::read_stub_64_from_32, delegate.name(), this));
45064506   }
45074507}
45084508
r11224r11225
45324532{
45334533   m_legacy_handler.space8 = func;
45344534   m_legacy_object.space = &space;
4535   set_delegate(read8_delegate(read8_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4535   set_delegate(read8_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45364536}
45374537
45384538void handler_entry_read::set_legacy_func(address_space &space, read16_space_func func, const char *name, UINT64 mask)
45394539{
45404540   m_legacy_handler.space16 = func;
45414541   m_legacy_object.space = &space;
4542   set_delegate(read16_delegate(read16_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4542   set_delegate(read16_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45434543}
45444544
45454545void handler_entry_read::set_legacy_func(address_space &space, read32_space_func func, const char *name, UINT64 mask)
45464546{
45474547   m_legacy_handler.space32 = func;
45484548   m_legacy_object.space = &space;
4549   set_delegate(read32_delegate(read32_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4549   set_delegate(read32_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45504550}
45514551
45524552void handler_entry_read::set_legacy_func(address_space &space, read64_space_func func, const char *name, UINT64 mask)
45534553{
45544554   m_legacy_handler.space64 = func;
45554555   m_legacy_object.space = &space;
4556   set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4556   set_delegate(read64_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45574557}
45584558
45594559
r11224r11225
45664566{
45674567   m_legacy_handler.device8 = func;
45684568   m_legacy_object.device = &device;
4569   set_delegate(read8_delegate(read8_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4569   set_delegate(read8_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45704570}
45714571
45724572void handler_entry_read::set_legacy_func(device_t &device, read16_device_func func, const char *name, UINT64 mask)
45734573{
45744574   m_legacy_handler.device16 = func;
45754575   m_legacy_object.device = &device;
4576   set_delegate(read16_delegate(read16_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4576   set_delegate(read16_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45774577}
45784578
45794579void handler_entry_read::set_legacy_func(device_t &device, read32_device_func func, const char *name, UINT64 mask)
45804580{
45814581   m_legacy_handler.device32 = func;
45824582   m_legacy_object.device = &device;
4583   set_delegate(read32_delegate(read32_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4583   set_delegate(read32_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45844584}
45854585
45864586void handler_entry_read::set_legacy_func(device_t &device, read64_device_func func, const char *name, UINT64 mask)
45874587{
45884588   m_legacy_handler.device64 = func;
45894589   m_legacy_object.device = &device;
4590   set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_legacy>(name), *this), mask);
4590   set_delegate(read64_delegate(&handler_entry_read::read_stub_legacy, name, this), mask);
45914591}
45924592
45934593
r11224r11225
46004600{
46014601   m_ioport = &ioport;
46024602   if (m_datawidth == 8)
4603      set_delegate(read8_delegate(read8_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_ioport<UINT8> >(ioport.tag), *this));
4603      set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport<UINT8>, ioport.tag, this));
46044604   else if (m_datawidth == 16)
4605      set_delegate(read16_delegate(read16_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_ioport<UINT16> >(ioport.tag), *this));
4605      set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport<UINT16>, ioport.tag, this));
46064606   else if (m_datawidth == 32)
4607      set_delegate(read32_delegate(read32_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_ioport<UINT32> >(ioport.tag), *this));
4607      set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport<UINT32>, ioport.tag, this));
46084608   else if (m_datawidth == 64)
4609      set_delegate(read64_delegate(read64_proto_delegate::_create_member<handler_entry_read, &handler_entry_read::read_stub_ioport<UINT64> >(ioport.tag), *this));
4609      set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport<UINT64>, ioport.tag, this));
46104610}
46114611
46124612
r11224r11225
47884788   {
47894789      configure_subunits(mask, 8);
47904790      if (m_datawidth == 16)
4791         set_delegate(write16_delegate(write16_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_16_from_8>(delegate.name()), *this));
4791         set_delegate(write16_delegate(&handler_entry_write::write_stub_16_from_8, delegate.name(), this));
47924792      else if (m_datawidth == 32)
4793         set_delegate(write32_delegate(write32_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_32_from_8>(delegate.name()), *this));
4793         set_delegate(write32_delegate(&handler_entry_write::write_stub_32_from_8, delegate.name(), this));
47944794      else if (m_datawidth == 64)
4795         set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_64_from_8>(delegate.name()), *this));
4795         set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_8, delegate.name(), this));
47964796   }
47974797}
47984798
r11224r11225
48124812   {
48134813      configure_subunits(mask, 16);
48144814      if (m_datawidth == 32)
4815         set_delegate(write32_delegate(write32_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_32_from_16>(delegate.name()), *this));
4815         set_delegate(write32_delegate(&handler_entry_write::write_stub_32_from_16, delegate.name(), this));
48164816      else if (m_datawidth == 64)
4817         set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_64_from_16>(delegate.name()), *this));
4817         set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_16, delegate.name(), this));
48184818   }
48194819}
48204820
r11224r11225
48344834   {
48354835      configure_subunits(mask, 32);
48364836      if (m_datawidth == 64)
4837         set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_64_from_32>(delegate.name()), *this));
4837         set_delegate(write64_delegate(&handler_entry_write::write_stub_64_from_32, delegate.name(), this));
48384838   }
48394839}
48404840
r11224r11225
48594859{
48604860   m_legacy_handler.space8 = func;
48614861   m_legacy_object.space = &space;
4862   set_delegate(write8_delegate(write8_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4862   set_delegate(write8_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
48634863}
48644864
48654865void handler_entry_write::set_legacy_func(address_space &space, write16_space_func func, const char *name, UINT64 mask)
48664866{
48674867   m_legacy_handler.space16 = func;
48684868   m_legacy_object.space = &space;
4869   set_delegate(write16_delegate(write16_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4869   set_delegate(write16_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
48704870}
48714871
48724872void handler_entry_write::set_legacy_func(address_space &space, write32_space_func func, const char *name, UINT64 mask)
48734873{
48744874   m_legacy_handler.space32 = func;
48754875   m_legacy_object.space = &space;
4876   set_delegate(write32_delegate(write32_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4876   set_delegate(write32_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
48774877}
48784878
48794879void handler_entry_write::set_legacy_func(address_space &space, write64_space_func func, const char *name, UINT64 mask)
48804880{
48814881   m_legacy_handler.space64 = func;
48824882   m_legacy_object.space = &space;
4883   set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4883   set_delegate(write64_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
48844884}
48854885
48864886
r11224r11225
48934893{
48944894   m_legacy_handler.device8 = func;
48954895   m_legacy_object.device = &device;
4896   set_delegate(write8_delegate(write8_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4896   set_delegate(write8_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
48974897}
48984898
48994899void handler_entry_write::set_legacy_func(device_t &device, write16_device_func func, const char *name, UINT64 mask)
49004900{
49014901   m_legacy_handler.device16 = func;
49024902   m_legacy_object.device = &device;
4903   set_delegate(write16_delegate(write16_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4903   set_delegate(write16_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
49044904}
49054905
49064906void handler_entry_write::set_legacy_func(device_t &device, write32_device_func func, const char *name, UINT64 mask)
49074907{
49084908   m_legacy_handler.device32 = func;
49094909   m_legacy_object.device = &device;
4910   set_delegate(write32_delegate(write32_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4910   set_delegate(write32_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
49114911}
49124912
49134913void handler_entry_write::set_legacy_func(device_t &device, write64_device_func func, const char *name, UINT64 mask)
49144914{
49154915   m_legacy_handler.device64 = func;
49164916   m_legacy_object.device = &device;
4917   set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_legacy>(name), *this), mask);
4917   set_delegate(write64_delegate(&handler_entry_write::write_stub_legacy, name, this), mask);
49184918}
49194919
49204920
r11224r11225
49274927{
49284928   m_ioport = &ioport;
49294929   if (m_datawidth == 8)
4930      set_delegate(write8_delegate(write8_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_ioport<UINT8> >(ioport.tag), *this));
4930      set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport<UINT8>, ioport.tag, this));
49314931   else if (m_datawidth == 16)
4932      set_delegate(write16_delegate(write16_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_ioport<UINT16> >(ioport.tag), *this));
4932      set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport<UINT16>, ioport.tag, this));
49334933   else if (m_datawidth == 32)
4934      set_delegate(write32_delegate(write32_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_ioport<UINT32> >(ioport.tag), *this));
4934      set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport<UINT32>, ioport.tag, this));
49354935   else if (m_datawidth == 64)
4936      set_delegate(write64_delegate(write64_proto_delegate::_create_member<handler_entry_write, &handler_entry_write::write_stub_ioport<UINT64> >(ioport.tag), *this));
4936      set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport<UINT64>, ioport.tag, this));
49374937}
49384938
49394939
src/emu/audit.h
r11224r11225
105105   // construction/destruction
106106   audit_record(const rom_entry &media, media_type type);
107107   audit_record(const char *name, media_type type);
108   
108
109109   // getters
110110   audit_record *next() const { return m_next; }
111111   media_type type() const { return m_type; }
r11224r11225
123123      m_status = status;
124124      m_substatus = substatus;
125125   }
126   
126
127127   void set_actual(const hash_collection &hashes, UINT64 length = 0)
128128   {
129129      m_hashes = hashes;
r11224r11225
139139   const char *      m_name;               /* name of item */
140140   UINT64            m_explength;         /* expected length of item */
141141   UINT64            m_length;            /* actual length of item */
142   hash_collection      m_exphashes;            /* expected hash data */
142   hash_collection      m_exphashes;          /* expected hash data */
143143   hash_collection      m_hashes;            /* actual hash information */
144144};
145145
r11224r11225
162162
163163   // construction/destruction
164164   media_auditor(const driver_enumerator &enumerator);
165   
165
166166   // getters
167167   audit_record *first() const { return m_record_list.first(); }
168168   int count() const { return m_record_list.count(); }
r11224r11225
171171   summary audit_media(const char *validation = AUDIT_VALIDATE_FULL);
172172   summary audit_samples();
173173   summary summarize(astring *output = NULL);
174   
174
175175private:
176176   // internal helpers
177177   audit_record *audit_one_rom(const rom_entry *rom);
src/emu/memory.h
r11224r11225
151151// ======================> direct_update_delegate
152152
153153// direct region update handler
154typedef proto_delegate_2param<offs_t, direct_read_data &, offs_t> direct_update_proto_delegate;
155typedef delegate_2param<offs_t, direct_read_data &, offs_t> direct_update_delegate;
154typedef delegate<offs_t (direct_read_data &, offs_t)> direct_update_delegate;
156155
157#define direct_update_delegate_create(_Class, _Method, _Object) direct_update_delegate(direct_update_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object)
158#define direct_update_delegate_create_static(_Function, _Object) direct_update_delegate(direct_update_proto_delegate::_create_static<running_machine, &_Function>(#_Function), _Object)
159156
160
161157// ======================> read_delegate
162158
163// declare proto-delegates for each width
164typedef proto_delegate_3param<UINT8, address_space &, offs_t, UINT8> read8_proto_delegate;
165typedef proto_delegate_3param<UINT16, address_space &, offs_t, UINT16> read16_proto_delegate;
166typedef proto_delegate_3param<UINT32, address_space &, offs_t, UINT32> read32_proto_delegate;
167typedef proto_delegate_3param<UINT64, address_space &, offs_t, UINT64> read64_proto_delegate;
168
169159// declare delegates for each width
170typedef delegate_3param<UINT8, address_space &, offs_t, UINT8> read8_delegate;
171typedef delegate_3param<UINT16, address_space &, offs_t, UINT16> read16_delegate;
172typedef delegate_3param<UINT32, address_space &, offs_t, UINT32> read32_delegate;
173typedef delegate_3param<UINT64, address_space &, offs_t, UINT64> read64_delegate;
160typedef delegate<UINT8 (address_space &, offs_t, UINT8)> read8_delegate;
161typedef delegate<UINT16 (address_space &, offs_t, UINT16)> read16_delegate;
162typedef delegate<UINT32 (address_space &, offs_t, UINT32)> read32_delegate;
163typedef delegate<UINT64 (address_space &, offs_t, UINT64)> read64_delegate;
174164
175// macros for creating read proto-delegates
176#define read8_proto_delegate_create(_Class, _Method) read8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
177#define read16_proto_delegate_create(_Class, _Method) read16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
178#define read32_proto_delegate_create(_Class, _Method) read32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
179#define read64_proto_delegate_create(_Class, _Method) read64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
180165
181// macros for creating read delegates, bound to the provided object
182#define read8_delegate_create(_Class, _Method, _Object) read8_delegate(read8_proto_delegate_create(_Class, _Method), _Object)
183#define read16_delegate_create(_Class, _Method, _Object) read16_delegate(read16_proto_delegate_create(_Class, _Method), _Object)
184#define read32_delegate_create(_Class, _Method, _Object) read32_delegate(read32_proto_delegate_create(_Class, _Method), _Object)
185#define read64_delegate_create(_Class, _Method, _Object) read64_delegate(read64_proto_delegate_create(_Class, _Method), _Object)
186
187
188166// ======================> write_delegate
189167
190// declare proto-delegates for each width
191typedef proto_delegate_4param<void, address_space &, offs_t, UINT8, UINT8> write8_proto_delegate;
192typedef proto_delegate_4param<void, address_space &, offs_t, UINT16, UINT16> write16_proto_delegate;
193typedef proto_delegate_4param<void, address_space &, offs_t, UINT32, UINT32> write32_proto_delegate;
194typedef proto_delegate_4param<void, address_space &, offs_t, UINT64, UINT64> write64_proto_delegate;
195
196168// declare delegates for each width
197typedef delegate_4param<void, address_space &, offs_t, UINT8, UINT8> write8_delegate;
198typedef delegate_4param<void, address_space &, offs_t, UINT16, UINT16> write16_delegate;
199typedef delegate_4param<void, address_space &, offs_t, UINT32, UINT32> write32_delegate;
200typedef delegate_4param<void, address_space &, offs_t, UINT64, UINT64> write64_delegate;
169typedef delegate<void (address_space &, offs_t, UINT8, UINT8)> write8_delegate;
170typedef delegate<void (address_space &, offs_t, UINT16, UINT16)> write16_delegate;
171typedef delegate<void (address_space &, offs_t, UINT32, UINT32)> write32_delegate;
172typedef delegate<void (address_space &, offs_t, UINT64, UINT64)> write64_delegate;
201173
202// macros for creating write proto-delegates
203#define write8_proto_delegate_create(_Class, _Method) write8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
204#define write16_proto_delegate_create(_Class, _Method) write16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
205#define write32_proto_delegate_create(_Class, _Method) write32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
206#define write64_proto_delegate_create(_Class, _Method) write64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method)
207174
208// macros for creating write delegates, bound to the provided object
209#define write8_delegate_create(_Class, _Method, _Object) write8_delegate(write8_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object)
210#define write16_delegate_create(_Class, _Method, _Object) write16_delegate(write16_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object)
211#define write32_delegate_create(_Class, _Method, _Object) write32_delegate(write32_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object)
212#define write64_delegate_create(_Class, _Method, _Object) write64_delegate(write64_proto_delegate::_create_member<_Class, &_Class::_Method>(#_Class "::" #_Method), _Object)
213
214
215175// ======================> direct_read_data
216176
217177// direct_read_data contains state data for direct read access
r11224r11225
604564
605565// opcode base adjustment handler function macro
606566#define DIRECT_UPDATE_MEMBER(name)      offs_t name(ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address)
607#define DIRECT_UPDATE_HANDLER(name)      offs_t name(ATTR_UNUSED running_machine *machine, ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address)
567#define DIRECT_UPDATE_HANDLER(name)      offs_t name(ATTR_UNUSED running_machine &machine, ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address)
608568
609569
610570// space read/write handler function macros
src/emu/machine/upd7201.c
r11224r11225
1111
1212    TODO:
1313
14   - this is a clone of Intel 8274?
14    - this is a clone of Intel 8274?
1515    - everything
1616
1717*/
r11224r11225
8080//**************************************************************************
8181
8282//-------------------------------------------------
83//  receive -
83//  receive -
8484//-------------------------------------------------
8585
8686inline void upd7201_device::receive(int channel)
r11224r11225
8989
9090
9191//-------------------------------------------------
92//  transmit -
92//  transmit -
9393//-------------------------------------------------
9494
9595inline void upd7201_device::transmit(int channel)
r11224r11225
161161
162162
163163//-------------------------------------------------
164//  cd_ba_r -
164//  cd_ba_r -
165165//-------------------------------------------------
166166
167167READ8_MEMBER( upd7201_device::cd_ba_r )
r11224r11225
171171
172172
173173//-------------------------------------------------
174//  cd_ba_w -
174//  cd_ba_w -
175175//-------------------------------------------------
176176
177177WRITE8_MEMBER( upd7201_device::cd_ba_w )
r11224r11225
180180
181181
182182//-------------------------------------------------
183//  ba_cd_r -
183//  ba_cd_r -
184184//-------------------------------------------------
185185
186186READ8_MEMBER( upd7201_device::ba_cd_r )
r11224r11225
190190
191191
192192//-------------------------------------------------
193//  ba_cd_w -
193//  ba_cd_w -
194194//-------------------------------------------------
195195
196196WRITE8_MEMBER( upd7201_device::ba_cd_w )
r11224r11225
199199
200200
201201//-------------------------------------------------
202//  intak_r -
202//  intak_r -
203203//-------------------------------------------------
204204
205205READ8_MEMBER( upd7201_device::intak_r )
r11224r11225
209209
210210
211211//-------------------------------------------------
212//  synca_w -
212//  synca_w -
213213//-------------------------------------------------
214214
215215WRITE_LINE_MEMBER( upd7201_device::synca_w )
r11224r11225
218218
219219
220220//-------------------------------------------------
221//  syncb_w -
221//  syncb_w -
222222//-------------------------------------------------
223223
224224WRITE_LINE_MEMBER( upd7201_device::syncb_w )
r11224r11225
227227
228228
229229//-------------------------------------------------
230//  ctsa_w -
230//  ctsa_w -
231231//-------------------------------------------------
232232
233233WRITE_LINE_MEMBER( upd7201_device::ctsa_w )
r11224r11225
236236
237237
238238//-------------------------------------------------
239//  ctsb_w -
239//  ctsb_w -
240240//-------------------------------------------------
241241
242242WRITE_LINE_MEMBER( upd7201_device::ctsb_w )
r11224r11225
245245
246246
247247//-------------------------------------------------
248//  dtra_r -
248//  dtra_r -
249249//-------------------------------------------------
250250
251251READ_LINE_MEMBER( upd7201_device::dtra_r )
r11224r11225
255255
256256
257257//-------------------------------------------------
258//  dtrb_r -
258//  dtrb_r -
259259//-------------------------------------------------
260260
261261READ_LINE_MEMBER( upd7201_device::dtrb_r )
r11224r11225
265265
266266
267267//-------------------------------------------------
268//  hai_w -
268//  hai_w -
269269//-------------------------------------------------
270270
271271WRITE_LINE_MEMBER( upd7201_device::hai_w )
r11224r11225
274274
275275
276276//-------------------------------------------------
277//  rxda_w -
277//  rxda_w -
278278//-------------------------------------------------
279279
280280WRITE_LINE_MEMBER( upd7201_device::rxda_w )
r11224r11225
283283
284284
285285//-------------------------------------------------
286//  txda_r -
286//  txda_r -
287287//-------------------------------------------------
288288
289289READ_LINE_MEMBER( upd7201_device::txda_r )
r11224r11225
293293
294294
295295//-------------------------------------------------
296//  rxdb_w -
296//  rxdb_w -
297297//-------------------------------------------------
298298
299299WRITE_LINE_MEMBER( upd7201_device::rxdb_w )
r11224r11225
302302
303303
304304//-------------------------------------------------
305//  txdb_r -
305//  txdb_r -
306306//-------------------------------------------------
307307
308308READ_LINE_MEMBER( upd7201_device::txdb_r )
r11224r11225
312312
313313
314314//-------------------------------------------------
315//  rxca_w -
315//  rxca_w -
316316//-------------------------------------------------
317317
318318WRITE_LINE_MEMBER( upd7201_device::rxca_w )
r11224r11225
321321
322322
323323//-------------------------------------------------
324//  rxcb_w -
324//  rxcb_w -
325325//-------------------------------------------------
326326
327327WRITE_LINE_MEMBER( upd7201_device::rxcb_w )
r11224r11225
330330
331331
332332//-------------------------------------------------
333//  txca_w -
333//  txca_w -
334334//-------------------------------------------------
335335
336336WRITE_LINE_MEMBER( upd7201_device::txca_w )
r11224r11225
339339
340340
341341//-------------------------------------------------
342//  txcb_w -
342//  txcb_w -
343343//-------------------------------------------------
344344
345345WRITE_LINE_MEMBER( upd7201_device::txcb_w )
src/emu/machine/upd7201.h
r11224r11225
145145    virtual void device_start();
146146    virtual void device_reset();
147147   virtual void device_timer(emu_timer &timer, device_timer_id id, int m_param, void *ptr);
148   
148
149149private:
150150   static const device_timer_id TIMER_RX_A = 0;
151151   static const device_timer_id TIMER_TX_A = 1;
src/emu/machine/mos6529.c
r11224r11225
8888
8989
9090//-------------------------------------------------
91//  read -
91//  read -
9292//-------------------------------------------------
9393
9494READ8_MEMBER( mos6529_device::read )
r11224r11225
9898
9999
100100//-------------------------------------------------
101//  write -
101//  write -
102102//-------------------------------------------------
103103
104104WRITE8_MEMBER( mos6529_device::write )
src/emu/machine/idectrl.c
r11224r11225
18511851   }
18521852
18531853   /* create a timer for timing status */
1854   ide->last_status_timer = device->machine().scheduler().timer_alloc(FUNC(NULL));
1854   ide->last_status_timer = device->machine().scheduler().timer_alloc(FUNC_NULL);
18551855   ide->reset_timer = device->machine().scheduler().timer_alloc(FUNC(reset_callback), (void *)device);
18561856
18571857   /* register ide states */
src/emu/machine/nvram.c
r11224r11225
104104//  helper to set a custom callback
105105//-------------------------------------------------
106106
107void nvram_device_config::static_set_custom_handler(device_config *device, nvram_init_proto_delegate handler)
107void nvram_device_config::static_set_custom_handler(device_config *device, nvram_init_delegate handler)
108108{
109109   nvram_device_config *nvram = downcast<nvram_device_config *>(device);
110110   nvram->m_default_value = DEFAULT_CUSTOM;
r11224r11225
139139{
140140   // bind our handler
141141   if (!m_config.m_custom_handler.isnull())
142      m_custom_handler = nvram_init_delegate(m_config.m_custom_handler, *m_owner);
142      m_custom_handler = nvram_init_delegate(m_config.m_custom_handler, m_owner);
143143}
144144
145145
src/emu/machine/nvram.h
r11224r11225
6666
6767#define MCFG_NVRAM_ADD_CUSTOM(_tag, _class, _method) \
6868   MCFG_DEVICE_ADD(_tag, NVRAM, 0) \
69   nvram_device_config::static_set_custom_handler(device, nvram_init_proto_delegate::_create_member<_class, &_class::_method>(#_class "::" #_method)); \
69   nvram_device_config::static_set_custom_handler(device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \
7070
7171
7272#define MCFG_NVRAM_REPLACE_0FILL(_tag) \
r11224r11225
8383
8484#define MCFG_NVRAM_REPLACE_CUSTOM(_tag, _class, _method) \
8585   MCFG_DEVICE_REPLACE(_tag, NVRAM, 0) \
86   nvram_device_config::static_set_custom_handler(device, nvram_init_proto_delegate::_create_member<_class, &_class::_method>(#_class "::" #_method)); \
86   nvram_device_config::static_set_custom_handler(device, nvram_init_delegate(&_class::_method, #_class "::" #_method, (_class *)0)); \
8787
8888
8989
r11224r11225
9595
9696
9797// custom initialization for default state
98typedef proto_delegate_3param<void, nvram_device &, void *, size_t> nvram_init_proto_delegate;
99typedef delegate_3param<void, nvram_device &, void *, size_t> nvram_init_delegate;
98typedef delegate<void (nvram_device &, void *, size_t)> nvram_init_delegate;
10099
101100
102101// ======================> nvram_device_config
r11224r11225
126125
127126   // inline configuration helpers
128127   static void static_set_default_value(device_config *device, default_value value);
129   static void static_set_custom_handler(device_config *device, nvram_init_proto_delegate callback);
128   static void static_set_custom_handler(device_config *device, nvram_init_delegate callback);
130129
131130protected:
132131   // internal state
133132   default_value            m_default_value;
134   nvram_init_proto_delegate   m_custom_handler;
133   nvram_init_delegate         m_custom_handler;
135134};
136135
137136
src/emu/machine/msm5832.c
r11224r11225
1111
1212    TODO:
1313
14   - 12/24 hour
15   - AM/PM
16   - leap year
17   - test input
18   - reference signal output
14    - 12/24 hour
15    - AM/PM
16    - leap year
17    - test input
18    - reference signal output
1919
2020*/
2121
r11224r11225
9999
100100
101101//-------------------------------------------------
102//  advance_seconds -
102//  advance_seconds -
103103//-------------------------------------------------
104104
105105inline void msm5832_device::advance_seconds()
r11224r11225
246246READ8_MEMBER( msm5832_device::data_r )
247247{
248248   UINT8 data = 0;
249   
249
250250   if (m_cs && m_read)
251251   {
252252      if (m_address == REGISTER_REF)
src/emu/machine/com8116.c
r11224r11225
123123
124124
125125//-------------------------------------------------
126//  str_w -
126//  str_w -
127127//-------------------------------------------------
128128
129129WRITE8_MEMBER( com8116_device::str_w )
r11224r11225
137137
138138
139139//-------------------------------------------------
140//  stt_w -
140//  stt_w -
141141//-------------------------------------------------
142142
143143WRITE8_MEMBER( com8116_device::stt_w )
src/emu/machine/pic8259.c
r11224r11225
3636   devcb_resolved_write_line out_int_func;
3737
3838   devcb_resolved_read_line sp_en_func;
39   
39
4040   devcb_resolved_read8 read_slave_ack_func;
41   
41
4242   emu_timer *timer;
4343
4444   pic8259_state_t state;
r11224r11225
183183         if (!pic8259->auto_eoi)
184184            pic8259->isr |= mask;
185185         pic8259_set_timer(pic8259);
186         
186
187187         if ((pic8259->cascade!=0) && (pic8259->master!=0) && (mask & pic8259->slave)) {
188188            // it's from slave device
189189            return devcb_call_read8(&pic8259->read_slave_ack_func,irq);
190190         } else {
191191            if (pic8259->is_x86) {
192192               /* For x86 mode*/
193               return irq + pic8259->base;               
193               return irq + pic8259->base;
194194            } else {
195195               /* in case of 8080/85) */
196196               return 0xcd0000 + (pic8259->vector_addr_high << 8) + pic8259->vector_addr_low + (irq << (3-pic8259->vector_size));
197197            }
198         }         
198         }
199199      }
200200   }
201201   return 0;
r11224r11225
422422   /* resolve callbacks */
423423   devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device);
424424   devcb_resolve_read_line(&pic8259->sp_en_func, &intf->sp_en_func, device);
425   devcb_resolve_read8(&pic8259->read_slave_ack_func, &intf->read_slave_ack_func, device);   
425   devcb_resolve_read8(&pic8259->read_slave_ack_func, &intf->read_slave_ack_func, device);
426426}
427427
428428
r11224r11225
450450   pic8259->is_x86 = 0;
451451   pic8259->vector_addr_low = 0;
452452   pic8259->vector_addr_high = 0;
453   
453
454454   pic8259->master = devcb_call_read_line(&pic8259->sp_en_func);
455455}
456456
src/emu/machine/i8214.c
r11224r11225
6565//**************************************************************************
6666
6767//-------------------------------------------------
68//  trigger_interrupt -
68//  trigger_interrupt -
6969//-------------------------------------------------
7070
7171inline void i8214_device::trigger_interrupt(int level)
r11224r11225
8787
8888
8989//-------------------------------------------------
90//  check_interrupt -
90//  check_interrupt -
9191//-------------------------------------------------
9292
9393inline void i8214_device::check_interrupt()
r11224r11225
154154
155155
156156//-------------------------------------------------
157//  a_r -
157//  a_r -
158158//-------------------------------------------------
159159
160160UINT8 i8214_device::a_r()
r11224r11225
168168
169169
170170//-------------------------------------------------
171//  b_w -
171//  b_w -
172172//-------------------------------------------------
173173
174174void i8214_device::b_w(UINT8 data)
r11224r11225
188188
189189
190190//-------------------------------------------------
191//  r_w -
191//  r_w -
192192//-------------------------------------------------
193193
194194void i8214_device::r_w(UINT8 data)
r11224r11225
202202
203203
204204//-------------------------------------------------
205//  sgs_w -
205//  sgs_w -
206206//-------------------------------------------------
207207
208208WRITE_LINE_MEMBER( i8214_device::sgs_w )
r11224r11225
216216
217217
218218//-------------------------------------------------
219//  etlg_w -
219//  etlg_w -
220220//-------------------------------------------------
221221
222222WRITE_LINE_MEMBER( i8214_device::etlg_w )
r11224r11225
228228
229229
230230//-------------------------------------------------
231//  inte_w -
231//  inte_w -
232232//-------------------------------------------------
233233
234234WRITE_LINE_MEMBER( i8214_device::inte_w )
src/emu/machine/pic8259.h
r11224r11225
4141   /* 1 - when master, 0 - when slave */
4242   devcb_read_line sp_en_func;
4343   /* Called when on master slave irq is trigered*/
44   devcb_read8 read_slave_ack_func;   
44   devcb_read8 read_slave_ack_func;
4545};
4646
4747
src/emu/machine/mc6852.c
r11224r11225
231231
232232
233233//-------------------------------------------------
234//  read -
234//  read -
235235//-------------------------------------------------
236236
237237READ8_MEMBER( mc6852_device::read )
r11224r11225
253253
254254
255255//-------------------------------------------------
256//  write -
256//  write -
257257//-------------------------------------------------
258258
259259WRITE8_MEMBER( mc6852_device::write )
r11224r11225
326326
327327
328328//-------------------------------------------------
329//  rx_clk_w -
329//  rx_clk_w -
330330//-------------------------------------------------
331331
332332WRITE_LINE_MEMBER( mc6852_device::rx_clk_w )
r11224r11225
336336
337337
338338//-------------------------------------------------
339//  tx_clk_w -
339//  tx_clk_w -
340340//-------------------------------------------------
341341
342342WRITE_LINE_MEMBER( mc6852_device::tx_clk_w )
r11224r11225
346346
347347
348348//-------------------------------------------------
349//  cts_w -
349//  cts_w -
350350//-------------------------------------------------
351351
352352WRITE_LINE_MEMBER( mc6852_device::cts_w )
r11224r11225
356356
357357
358358//-------------------------------------------------
359//  dcd_w -
359//  dcd_w -
360360//-------------------------------------------------
361361
362362WRITE_LINE_MEMBER( mc6852_device::dcd_w )
r11224r11225
366366
367367
368368//-------------------------------------------------
369//  sm_dtr_r -
369//  sm_dtr_r -
370370//-------------------------------------------------
371371
372372READ_LINE_MEMBER( mc6852_device::sm_dtr_r )
r11224r11225
376376
377377
378378//-------------------------------------------------
379//  tuf_r -
379//  tuf_r -
380380//-------------------------------------------------
381381
382382READ_LINE_MEMBER( mc6852_device::tuf_r )
src/emu/machine/mc6852.h
r11224r11225
116116    virtual void device_start();
117117    virtual void device_reset();
118118   virtual void device_timer(emu_timer &timer, device_timer_id id, int m_param, void *ptr);
119   
119
120120private:
121121   static const device_timer_id TIMER_RX = 0;
122122   static const device_timer_id TIMER_TX = 1;
r11224r11225
147147   int m_dcd;            // data carrier detect
148148   int m_sm_dtr;         // sync match/data terminal ready
149149   int m_tuf;            // transmitter underflow
150         
150
151151   // timers
152152   emu_timer *m_rx_timer;
153153   emu_timer *m_tx_timer;
src/emu/machine/rp5c01.c
r11224r11225
1212    TODO:
1313
1414    - 12 hour clock
15   - test register
15    - test register
1616    - timer reset
1717
1818*/
r11224r11225
176176   int alarm = ((m_mode & MODE_ALARM_EN) ? m_alarm_on : 1) &
177177            ((m_reset & RESET_16_HZ) ? 1 : m_16hz) &
178178            ((m_reset & RESET_1_HZ) ? 1 : m_1hz);
179   
179
180180   if (m_alarm != alarm)
181181   {
182182      if (LOG) logerror("RP5C01 '%s' Alarm %u\n", tag(), alarm);
r11224r11225
345345   // allocate timers
346346   m_clock_timer = timer_alloc(TIMER_CLOCK);
347347   m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384));
348   
348
349349   m_16hz_timer = timer_alloc(TIMER_16HZ);
350350   m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024));
351351
src/emu/machine/cdp1852.c
r11224r11225
11/**********************************************************************
22
33    RCA CDP1852 Byte-Wide Input/Output Port emulation
4   
4
55    Copyright Nicola Salmoria and the MAME Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
r11224r11225
6969//**************************************************************************
7070
7171//-------------------------------------------------
72//  get_mode -
72//  get_mode -
7373//-------------------------------------------------
7474
7575int cdp1852_device::get_mode()
r11224r11225
7979
8080
8181//-------------------------------------------------
82//  set_sr_line -
82//  set_sr_line -
8383//-------------------------------------------------
8484
8585void cdp1852_device::set_sr_line(int state)
src/emu/machine/msm58321.c
r11224r11225
1111
1212    TODO:
1313
14   - 12/24 hour
15   - AM/PM
16   - leap year
14    - 12/24 hour
15    - AM/PM
16    - leap year
1717    - stop
1818    - reset
1919    - reference registers
r11224r11225
123123
124124
125125//-------------------------------------------------
126//  advance_seconds -
126//  advance_seconds -
127127//-------------------------------------------------
128128
129129inline void msm58321_device::advance_seconds()
src/emu/mame.h
r11224r11225
6464                        "images is a violation of copyright law and should be promptly reported to the\n" \
6565                        "authors so that appropriate legal action can be taken.\n"
6666#define USAGE               "Usage:  %s [%s] [options]"
67#define XML_ROOT              "mame"
67#define XML_ROOT             "mame"
6868#define XML_TOP             "game"
6969#define STATE_MAGIC_NUM         'M', 'A', 'M', 'E', 'S', 'A', 'V', 'E'
7070#else
r11224r11225
9191                        "with these files is a violation of copyright law and should be promptly\n" \
9292                        "reported to the authors so that appropriate legal action can be taken.\n"
9393#define USAGE               "Usage:  %s [%s] [media] [software] [options]"
94#define XML_ROOT              "mess"
95#define XML_TOP             "machine"   
94#define XML_ROOT             "mess"
95#define XML_TOP             "machine"
9696#define STATE_MAGIC_NUM         'M', 'E', 'S', 'S', 'S', 'A', 'V', 'E'
9797#endif
9898
src/emu/emucore.h
r11224r11225
202202#define NAME(x) x, #x
203203
204204// this macro wraps a function 'x' and can be used to pass a function followed by its name
205#define FUNC(x) x, #x
205#define FUNC(x) &x, #x
206#define FUNC_NULL NULL, "(null)"
206207
207208// this macro wraps a member function 'x' from class 'c'
208209#define MFUNC(c,x) &c::x, #c "::" #x
src/emu/addrmap.c
r11224r11225
271271}
272272
273273
274void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 unitmask)
274void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 unitmask)
275275{
276276   assert(!func.isnull());
277277   assert(unitmask_is_appropriate(8, unitmask, func.name()));
r11224r11225
284284}
285285
286286
287void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 unitmask)
287void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 unitmask)
288288{
289289   assert(!func.isnull());
290290   assert(unitmask_is_appropriate(8, unitmask, func.name()));
r11224r11225
297297}
298298
299299
300void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 unitmask)
300void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 unitmask)
301301{
302302   internal_set_handler(devconfig, tag, rfunc, unitmask);
303303   internal_set_handler(devconfig, tag, wfunc, unitmask);
r11224r11225
373373}
374374
375375
376void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 unitmask)
376void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 unitmask)
377377{
378378   assert(!func.isnull());
379379   assert(unitmask_is_appropriate(16, unitmask, func.name()));
r11224r11225
386386}
387387
388388
389void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 unitmask)
389void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 unitmask)
390390{
391391   assert(!func.isnull());
392392   assert(unitmask_is_appropriate(16, unitmask, func.name()));
r11224r11225
399399}
400400
401401
402void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 unitmask)
402void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 unitmask)
403403{
404404   internal_set_handler(devconfig, tag, rfunc, unitmask);
405405   internal_set_handler(devconfig, tag, wfunc, unitmask);
r11224r11225
475475}
476476
477477
478void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 unitmask)
478void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 unitmask)
479479{
480480   assert(!func.isnull());
481481   assert(unitmask_is_appropriate(32, unitmask, func.name()));
r11224r11225
488488}
489489
490490
491void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 unitmask)
491void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 unitmask)
492492{
493493   assert(!func.isnull());
494494   assert(unitmask_is_appropriate(32, unitmask, func.name()));
r11224r11225
501501}
502502
503503
504void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 unitmask)
504void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 unitmask)
505505{
506506   internal_set_handler(devconfig, tag, rfunc, unitmask);
507507   internal_set_handler(devconfig, tag, wfunc, unitmask);
r11224r11225
577577}
578578
579579
580void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func, UINT64 unitmask)
580void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 unitmask)
581581{
582582   assert(!func.isnull());
583583   assert(unitmask_is_appropriate(64, unitmask, func.name()));
r11224r11225
590590}
591591
592592
593void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 unitmask)
593void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 unitmask)
594594{
595595   assert(!func.isnull());
596596   assert(unitmask_is_appropriate(64, unitmask, func.name()));
r11224r11225
603603}
604604
605605
606void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 unitmask)
606void address_map_entry::internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 unitmask)
607607{
608608   internal_set_handler(devconfig, tag, rfunc, unitmask);
609609   internal_set_handler(devconfig, tag, wfunc, unitmask);
src/emu/addrmap.h
r11224r11225
157157   offs_t               m_rgnoffs;            // offset within the region
158158
159159   // handlers
160   read8_proto_delegate   m_rproto8;            // 8-bit read proto-delegate
161   read16_proto_delegate   m_rproto16;            // 16-bit read proto-delegate
162   read32_proto_delegate   m_rproto32;            // 32-bit read proto-delegate
163   read64_proto_delegate   m_rproto64;            // 64-bit read proto-delegate
160   read8_delegate         m_rproto8;            // 8-bit read proto-delegate
161   read16_delegate         m_rproto16;            // 16-bit read proto-delegate
162   read32_delegate         m_rproto32;            // 32-bit read proto-delegate
163   read64_delegate         m_rproto64;            // 64-bit read proto-delegate
164164   read8_space_func      m_rspace8;            // 8-bit legacy address space handler
165165   read16_space_func      m_rspace16;            // 16-bit legacy address space handler
166166   read32_space_func      m_rspace32;            // 32-bit legacy address space handler
r11224r11225
169169   read16_device_func      m_rdevice16;         // 16-bit legacy device handler
170170   read32_device_func      m_rdevice32;         // 32-bit legacy device handler
171171   read64_device_func      m_rdevice64;         // 64-bit legacy device handler
172   write8_proto_delegate   m_wproto8;            // 8-bit write proto-delegate
173   write16_proto_delegate   m_wproto16;            // 16-bit write proto-delegate
174   write32_proto_delegate   m_wproto32;            // 32-bit write proto-delegate
175   write64_proto_delegate   m_wproto64;            // 64-bit write proto-delegate
172   write8_delegate         m_wproto8;            // 8-bit write proto-delegate
173   write16_delegate      m_wproto16;            // 16-bit write proto-delegate
174   write32_delegate      m_wproto32;            // 32-bit write proto-delegate
175   write64_delegate      m_wproto64;            // 64-bit write proto-delegate
176176   write8_space_func      m_wspace8;            // 8-bit legacy address space handler
177177   write16_space_func      m_wspace16;            // 16-bit legacy address space handler
178178   write32_space_func      m_wspace32;            // 32-bit legacy address space handler
r11224r11225
200200   void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask);
201201   void internal_set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask);
202202   void internal_set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask);
203   void internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 mask);
204   void internal_set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask);
205   void internal_set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask);
203   void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask);
204   void internal_set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask);
205   void internal_set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask);
206206
207207   // internal handler setters for 16-bit functions
208208   void internal_set_handler(read16_space_func func, const char *string, UINT64 mask);
r11224r11225
211211   void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask);
212212   void internal_set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask);
213213   void internal_set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask);
214   void internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 mask);
215   void internal_set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask);
216   void internal_set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask);
214   void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask);
215   void internal_set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask);
216   void internal_set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask);
217217
218218   // internal handler setters for 32-bit functions
219219   void internal_set_handler(read32_space_func func, const char *string, UINT64 mask);
r11224r11225
222222   void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask);
223223   void internal_set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask);
224224   void internal_set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask);
225   void internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 mask);
226   void internal_set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask);
227   void internal_set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask);
225   void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask);
226   void internal_set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask);
227   void internal_set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask);
228228
229229   // internal handler setters for 64-bit functions
230230   void internal_set_handler(read64_space_func func, const char *string, UINT64 mask);
r11224r11225
233233   void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string, UINT64 mask);
234234   void internal_set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string, UINT64 mask);
235235   void internal_set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring, UINT64 mask);
236   void internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func, UINT64 mask);
237   void internal_set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func, UINT64 mask);
238   void internal_set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc, UINT64 mask);
236   void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate func, UINT64 mask);
237   void internal_set_handler(const device_config &devconfig, const char *tag, write64_delegate func, UINT64 mask);
238   void internal_set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc, UINT64 mask);
239239
240240private:
241241   // helper functions
r11224r11225
260260   void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
261261   void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
262262   void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
263   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
264   void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
265   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
263   void set_handler(const device_config &devconfig, const char *tag, read8_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
264   void set_handler(const device_config &devconfig, const char *tag, write8_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
265   void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
266266};
267267
268268
r11224r11225
283283   void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
284284   void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
285285   void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
286   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
287   void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
288   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
286   void set_handler(const device_config &devconfig, const char *tag, read16_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
287   void set_handler(const device_config &devconfig, const char *tag, write16_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
288   void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
289289
290290   // 8-bit handlers
291291   void set_handler(read8_space_func func, const char *string, UINT16 mask) { internal_set_handler(func, string, mask); }
r11224r11225
294294   void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
295295   void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT16 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
296296   void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
297   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
298   void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
299   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
297   void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
298   void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT16 mask) { internal_set_handler(devconfig, tag, func, mask); }
299   void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT16 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
300300};
301301
302302
r11224r11225
317317   void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
318318   void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
319319   void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
320   void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
321   void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
322   void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
320   void set_handler(const device_config &devconfig, const char *tag, read32_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
321   void set_handler(const device_config &devconfig, const char *tag, write32_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
322   void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
323323
324324   // 16-bit handlers
325325   void set_handler(read16_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
r11224r11225
328328   void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
329329   void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
330330   void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
331   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
332   void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
333   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
331   void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
332   void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
333   void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
334334
335335   // 8-bit handlers
336336   void set_handler(read8_space_func func, const char *string, UINT32 mask) { internal_set_handler(func, string, mask); }
r11224r11225
339339   void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
340340   void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT32 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
341341   void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
342   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
343   void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
344   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
342   void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
343   void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT32 mask) { internal_set_handler(devconfig, tag, func, mask); }
344   void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT32 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
345345};
346346
347347
r11224r11225
362362   void set_handler(const device_config &devconfig, const char *tag, read64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
363363   void set_handler(const device_config &devconfig, const char *tag, write64_device_func func, const char *string) { internal_set_handler(devconfig, tag, func, string, 0); }
364364   void set_handler(const device_config &devconfig, const char *tag, read64_device_func rfunc, const char *rstring, write64_device_func wfunc, const char *wstring) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, 0); }
365   void set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
366   void set_handler(const device_config &devconfig, const char *tag, write64_proto_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
367   void set_handler(const device_config &devconfig, const char *tag, read64_proto_delegate rfunc, write64_proto_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
365   void set_handler(const device_config &devconfig, const char *tag, read64_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
366   void set_handler(const device_config &devconfig, const char *tag, write64_delegate func) { internal_set_handler(devconfig, tag, func, 0); }
367   void set_handler(const device_config &devconfig, const char *tag, read64_delegate rfunc, write64_delegate wfunc) { internal_set_handler(devconfig, tag, rfunc, wfunc, 0); }
368368
369369   // 32-bit handlers
370370   void set_handler(read32_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
r11224r11225
373373   void set_handler(const device_config &devconfig, const char *tag, read32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
374374   void set_handler(const device_config &devconfig, const char *tag, write32_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
375375   void set_handler(const device_config &devconfig, const char *tag, read32_device_func rfunc, const char *rstring, write32_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
376   void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
377   void set_handler(const device_config &devconfig, const char *tag, write32_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
378   void set_handler(const device_config &devconfig, const char *tag, read32_proto_delegate rfunc, write32_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
376   void set_handler(const device_config &devconfig, const char *tag, read32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
377   void set_handler(const device_config &devconfig, const char *tag, write32_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
378   void set_handler(const device_config &devconfig, const char *tag, read32_delegate rfunc, write32_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
379379
380380   // 16-bit handlers
381381   void set_handler(read16_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
r11224r11225
384384   void set_handler(const device_config &devconfig, const char *tag, read16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
385385   void set_handler(const device_config &devconfig, const char *tag, write16_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
386386   void set_handler(const device_config &devconfig, const char *tag, read16_device_func rfunc, const char *rstring, write16_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
387   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
388   void set_handler(const device_config &devconfig, const char *tag, write16_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
389   void set_handler(const device_config &devconfig, const char *tag, read16_proto_delegate rfunc, write16_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
387   void set_handler(const device_config &devconfig, const char *tag, read16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
388   void set_handler(const device_config &devconfig, const char *tag, write16_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
389   void set_handler(const device_config &devconfig, const char *tag, read16_delegate rfunc, write16_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
390390
391391   // 8-bit handlers
392392   void set_handler(read8_space_func func, const char *string, UINT64 mask) { internal_set_handler(func, string, mask); }
r11224r11225
395395   void set_handler(const device_config &devconfig, const char *tag, read8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
396396   void set_handler(const device_config &devconfig, const char *tag, write8_device_func func, const char *string, UINT64 mask) { internal_set_handler(devconfig, tag, func, string, mask); }
397397   void set_handler(const device_config &devconfig, const char *tag, read8_device_func rfunc, const char *rstring, write8_device_func wfunc, const char *wstring, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, rstring, wfunc, wstring, mask); }
398   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
399   void set_handler(const device_config &devconfig, const char *tag, write8_proto_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
400   void set_handler(const device_config &devconfig, const char *tag, read8_proto_delegate rfunc, write8_proto_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
398   void set_handler(const device_config &devconfig, const char *tag, read8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
399   void set_handler(const device_config &devconfig, const char *tag, write8_delegate func, UINT64 mask) { internal_set_handler(devconfig, tag, func, mask); }
400   void set_handler(const device_config &devconfig, const char *tag, read8_delegate rfunc, write8_delegate wfunc, UINT64 mask) { internal_set_handler(devconfig, tag, rfunc, wfunc, mask); }
401401};
402402
403403
r11224r11225
461461#define ADDRESS_MAP_START(_name, _space, _bits) \
462462void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
463463{ \
464   typedef read##_bits##_proto_delegate read_proto_delegate; \
465   typedef write##_bits##_proto_delegate write_proto_delegate; \
464   typedef read##_bits##_delegate read_delegate; \
465   typedef write##_bits##_delegate write_delegate; \
466466   address_map_entry##_bits *curentry = NULL; \
467467   (void)curentry; \
468468   map.configure(_space, _bits); \
r11224r11225
588588
589589// device reads
590590#define AM_DEVREAD_MODERN(_tag, _class, _handler) \
591   curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
591   curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
592592
593593#define AM_DEVREAD8_MODERN(_tag, _class, _handler, _unitmask) \
594   curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
594   curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
595595
596596#define AM_DEVREAD16_MODERN(_tag, _class, _handler, _unitmask) \
597   curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
597   curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
598598
599599#define AM_DEVREAD32_MODERN(_tag, _class, _handler, _unitmask) \
600   curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
600   curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
601601
602602
603603// device writes
604604#define AM_DEVWRITE_MODERN(_tag, _class, _handler) \
605   curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
605   curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
606606
607607#define AM_DEVWRITE8_MODERN(_tag, _class, _handler, _unitmask) \
608   curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
608   curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
609609
610610#define AM_DEVWRITE16_MODERN(_tag, _class, _handler, _unitmask) \
611   curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
611   curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
612612
613613#define AM_DEVWRITE32_MODERN(_tag, _class, _handler, _unitmask) \
614   curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
614   curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
615615
616616
617617// device reads/writes
618618#define AM_DEVREADWRITE_MODERN(_tag, _class, _rhandler, _whandler) \
619   curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \
619   curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
620620
621621#define AM_DEVREADWRITE8_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
622   curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
622   curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
623623
624624#define AM_DEVREADWRITE16_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
625   curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
625   curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
626626
627627#define AM_DEVREADWRITE32_MODERN(_tag, _class, _rhandler, _whandler, _unitmask) \
628   curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
628   curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
629629
630630
631631// special-case accesses
r11224r11225
730730#define ADDRESS_MAP_START(_name, _space, _bits, _class) \
731731void ADDRESS_MAP_NAME(_name)(address_map &map, const device_config &devconfig) \
732732{ \
733   typedef read##_bits##_proto_delegate read_proto_delegate; \
734   typedef write##_bits##_proto_delegate write_proto_delegate; \
733   typedef read##_bits##_delegate read_delegate; \
734   typedef write##_bits##_delegate write_delegate; \
735735   address_map_entry##_bits *curentry = NULL; \
736736   (void)curentry; \
737737   map.configure(_space, _bits); \
r11224r11225
858858
859859// driver data base reads
860860#define AM_READ_BASE(_class, _handler) \
861   curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler)); \
861   curentry->set_handler(devconfig, NULL, read_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
862862
863863#define AM_READ8_BASE(_class, _handler, _unitmask) \
864   curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
864   curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
865865
866866#define AM_READ16_BASE(_class, _handler, _unitmask) \
867   curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
867   curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
868868
869869#define AM_READ32_BASE(_class, _handler, _unitmask) \
870   curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
870   curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
871871
872872
873873// driver data base writes
874874#define AM_WRITE_BASE(_class, _handler) \
875   curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler)); \
875   curentry->set_handler(devconfig, NULL, write_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0)); \
876876
877877#define AM_WRITE8_BASE(_class, _handler, _unitmask) \
878   curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
878   curentry->set_handler(devconfig, NULL, write8_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
879879
880880#define AM_WRITE16_BASE(_class, _handler, _unitmask) \
881   curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
881   curentry->set_handler(devconfig, NULL, write16_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
882882
883883#define AM_WRITE32_BASE(_class, _handler, _unitmask) \
884   curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<_class, &_class::_handler>("driver_data::" #_handler), _unitmask); \
884   curentry->set_handler(devconfig, NULL, write32_delegate(&_class::_handler, "driver_data::" #_handler, (_class *)0), _unitmask); \
885885
886886
887887// driver data base reads/writes
888888#define AM_READWRITE_BASE(_class, _rhandler, _whandler) \
889   curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler)); \
889   curentry->set_handler(devconfig, NULL, read_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0)); \
890890
891891#define AM_READWRITE8_BASE(_class, _rhandler, _whandler, _unitmask) \
892   curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \
892   curentry->set_handler(devconfig, NULL, read8_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
893893
894894#define AM_READWRITE16_BASE(_class, _rhandler, _whandler, _unitmask) \
895   curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \
895   curentry->set_handler(devconfig, NULL, read16_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
896896
897897#define AM_READWRITE32_BASE(_class, _rhandler, _whandler, _unitmask) \
898   curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<_class, &_class::_rhandler>("driver_data::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>("driver_data::" #_whandler), _unitmask); \
898   curentry->set_handler(devconfig, NULL, read32_delegate(&_class::_rhandler, "driver_data::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, "driver_data::" #_whandler, (_class *)0), _unitmask); \
899899
900900
901901// driver data reads
902902#define AM_READ(_handler) \
903   curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler)); \
903   curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
904904
905905#define AM_READ8(_handler, _unitmask) \
906   curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
906   curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
907907
908908#define AM_READ16(_handler, _unitmask) \
909   curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
909   curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
910910
911911#define AM_READ32(_handler, _unitmask) \
912   curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
912   curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
913913
914914
915915// driver data writes
916916#define AM_WRITE(_handler) \
917   curentry->set_handler(devconfig, NULL, write_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler)); \
917   curentry->set_handler(devconfig, NULL, write_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0)); \
918918
919919#define AM_WRITE8(_handler, _unitmask) \
920   curentry->set_handler(devconfig, NULL, write8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
920   curentry->set_handler(devconfig, NULL, write8_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
921921
922922#define AM_WRITE16(_handler, _unitmask) \
923   curentry->set_handler(devconfig, NULL, write16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
923   curentry->set_handler(devconfig, NULL, write16_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
924924
925925#define AM_WRITE32(_handler, _unitmask) \
926   curentry->set_handler(devconfig, NULL, write32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_handler>("driver_data::" #_handler), _unitmask); \
926   curentry->set_handler(devconfig, NULL, write32_delegate(&drivdata_class::_handler, "driver_data::" #_handler, (drivdata_class *)0), _unitmask); \
927927
928928
929929// driver data reads/writes
930930#define AM_READWRITE(_rhandler, _whandler) \
931   curentry->set_handler(devconfig, NULL, read_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler)); \
931   curentry->set_handler(devconfig, NULL, read_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0)); \
932932
933933#define AM_READWRITE8(_rhandler, _whandler, _unitmask) \
934   curentry->set_handler(devconfig, NULL, read8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write8_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \
934   curentry->set_handler(devconfig, NULL, read8_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write8_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
935935
936936#define AM_READWRITE16(_rhandler, _whandler, _unitmask) \
937   curentry->set_handler(devconfig, NULL, read16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write16_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \
937   curentry->set_handler(devconfig, NULL, read16_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write16_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
938938
939939#define AM_READWRITE32(_rhandler, _whandler, _unitmask) \
940   curentry->set_handler(devconfig, NULL, read32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_rhandler>("driver_data::" #_rhandler), write32_proto_delegate::_create_member<drivdata_class, &drivdata_class::_whandler>("driver_data::" #_whandler), _unitmask); \
940   curentry->set_handler(devconfig, NULL, read32_delegate(&drivdata_class::_rhandler, "driver_data::" #_rhandler, (drivdata_class *)0), write32_delegate(&drivdata_class::_whandler, "driver_data::" #_whandler, (drivdata_class *)0), _unitmask); \
941941
942942
943943// device reads
944944#define AM_DEVREAD(_tag, _class, _handler) \
945   curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
945   curentry->set_handler(devconfig, _tag, read_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
946946
947947#define AM_DEVREAD8(_tag, _class, _handler, _unitmask) \
948   curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
948   curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
949949
950950#define AM_DEVREAD16(_tag, _class, _handler, _unitmask) \
951   curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
951   curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
952952
953953#define AM_DEVREAD32(_tag, _class, _handler, _unitmask) \
954   curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
954   curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
955955
956956
957957// device writes
958958#define AM_DEVWRITE(_tag, _class, _handler) \
959   curentry->set_handler(devconfig, _tag, write_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler)); \
959   curentry->set_handler(devconfig, _tag, write_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0)); \
960960
961961#define AM_DEVWRITE8(_tag, _class, _handler, _unitmask) \
962   curentry->set_handler(devconfig, _tag, write8_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
962   curentry->set_handler(devconfig, _tag, write8_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
963963
964964#define AM_DEVWRITE16(_tag, _class, _handler, _unitmask) \
965   curentry->set_handler(devconfig, _tag, write16_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
965   curentry->set_handler(devconfig, _tag, write16_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
966966
967967#define AM_DEVWRITE32(_tag, _class, _handler, _unitmask) \
968   curentry->set_handler(devconfig, _tag, write32_proto_delegate::_create_member<_class, &_class::_handler>(#_class "::" #_handler), _unitmask); \
968   curentry->set_handler(devconfig, _tag, write32_delegate(&_class::_handler, #_class "::" #_handler, (_class *)0), _unitmask); \
969969
970970
971971// device reads/writes
972972#define AM_DEVREADWRITE(_tag, _class, _rhandler, _whandler) \
973   curentry->set_handler(devconfig, _tag, read_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler)); \
973   curentry->set_handler(devconfig, _tag, read_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0)); \
974974
975975#define AM_DEVREADWRITE8(_tag, _class, _rhandler, _whandler, _unitmask) \
976   curentry->set_handler(devconfig, _tag, read8_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write8_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
976   curentry->set_handler(devconfig, _tag, read8_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write8_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
977977
978978#define AM_DEVREADWRITE16(_tag, _class, _rhandler, _whandler, _unitmask) \
979   curentry->set_handler(devconfig, _tag, read16_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write16_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
979   curentry->set_handler(devconfig, _tag, read16_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write16_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
980980
981981#define AM_DEVREADWRITE32(_tag, _class, _rhandler, _whandler, _unitmask) \
982   curentry->set_handler(devconfig, _tag, read32_proto_delegate::_create_member<_class, &_class::_rhandler>(#_class "::" #_rhandler), write32_proto_delegate::_create_member<_class, &_class::_whandler>(#_class "::" #_whandler), _unitmask); \
982   curentry->set_handler(devconfig, _tag, read32_delegate(&_class::_rhandler, #_class "::" #_rhandler, (_class *)0), write32_delegate(&_class::_whandler, #_class "::" #_whandler, (_class *)0), _unitmask); \
983983
984984
985985// special-case accesses
src/emu/driver.c
r11224r11225
6969   game_driver driver;
7070   driver.name = name;
7171   game_driver *driverptr = &driver;
72   
72
7373   // binary search to find it
7474   const game_driver **result = reinterpret_cast<const game_driver **>(bsearch(&driverptr, s_drivers_sorted, s_driver_count, sizeof(*s_drivers_sorted), driver_sort_callback));
7575   return (result == NULL) ? -1 : result - s_drivers_sorted;
r11224r11225
7777
7878
7979//-------------------------------------------------
80//  matches - true if we match, taking into
81//  account wildcards in the wildstring
82//-------------------------------------------------
83
84bool driver_list::matches(const char *wildstring, const char *string)
85{
86   // can only match internal drivers if the wildstring starts with an underscore
87   if (string[0] == '_' && (wildstring == NULL || wildstring[0] != '_'))
88      return false;
89
90   // match everything else normally
91   return (wildstring == NULL || mame_strwildcmp(wildstring, string) == 0);
92}
93
94
95//-------------------------------------------------
8096//  driver_sort_callback - compare two items in
8197//  an array of game_driver pointers
8298//-------------------------------------------------
r11224r11225
211227{
212228   // reset the count
213229   exclude_all();
214   
230
215231   // match name against each driver in the list
216232   for (int index = 0; index < s_driver_count; index++)
217233      if (matches(filterstring, s_drivers_sorted[index]->name))
r11224r11225
230246{
231247   // reset the count
232248   exclude_all();
233   
249
234250   // match name against each driver in the list
235251   for (int index = 0; index < s_driver_count; index++)
236252      if (s_drivers_sorted[index] == &driver)
r11224r11225
241257
242258
243259//-------------------------------------------------
260//  include_all - include all non-internal drivers
261//-------------------------------------------------
262
263void driver_enumerator::include_all()
264{
265   memset(m_included, 1, sizeof(m_included[0]) * s_driver_count); m_filtered_count = s_driver_count;
266   int empty = find("___empty");
267   assert(empty != -1);
268   m_included[empty] = 0;
269}
270
271
272//-------------------------------------------------
244273//  next - get the next driver matching the given
245274//  filter
246275//-------------------------------------------------
r11224r11225
249278{
250279   // always advance one
251280   m_current++;
252   
281
253282   // if we have a filter, scan forward to the next match
254283   while (m_current < s_driver_count)
255284   {
r11224r11225
272301{
273302   // always advance one
274303   m_current++;
275   
304
276305   // if we have a filter, scan forward to the next match
277306   while (m_current < s_driver_count)
278307   {
src/emu/driver.h
r11224r11225
121121public:
122122   // getters
123123   static int total() { return s_driver_count; }
124   
124
125125   // any item by index
126126   static const game_driver &driver(int index) { assert(index >= 0 && index < s_driver_count); return *s_drivers_sorted[index]; }
127127   static int clone(int index) { return find(driver(index).parent); }
r11224r11225
138138   static int find(const game_driver &driver) { return find(driver.name); }
139139
140140   // static helpers
141   static bool matches(const char *wildstring, const char *string) { return (wildstring == NULL || mame_strwildcmp(wildstring, string) == 0); }
141   static bool matches(const char *wildstring, const char *string);
142142
143143protected:
144144   // internal helpers
r11224r11225
147147
148148   // internal state
149149   static int                     s_driver_count;
150   static const game_driver * const    s_drivers_sorted[];
150   static const game_driver * const   s_drivers_sorted[];
151151};
152152
153153
r11224r11225
162162   driver_enumerator(emu_options &options, const char *filter);
163163   driver_enumerator(emu_options &options, const game_driver &filter);
164164   ~driver_enumerator();
165   
165
166166   // getters
167167   int count() const { return m_filtered_count; }
168168   int current() const { return m_current; }
169169   emu_options &options() const { return m_options; }
170   
170
171171   // current item
172172   const game_driver &driver() const { return driver_list::driver(m_current); }
173173   machine_config &config() const { return config(m_current); }
r11224r11225
191191   // filtering/iterating
192192   int filter(const char *string = NULL);
193193   int filter(const game_driver &driver);
194   void include_all() { memset(m_included, 1, sizeof(m_included[0]) * s_driver_count); m_filtered_count = s_driver_count; }
194   void include_all();
195195   void exclude_all() { memset(m_included, 0, sizeof(m_included[0]) * s_driver_count); m_filtered_count = 0; }
196196   void reset() { m_current = -1; }
197197   bool next();
src/emu/delegate.c
r11224r11225
7070
7171#if (USE_DELEGATE_TYPE == DELEGATE_TYPE_INTERNAL)
7272
73// NULL structure used in dummy constructor
74delegate_gcc_mfp_internal delegate_gcc_mfp_null;
75
76
7773//-------------------------------------------------
7874//  delegate_convert_raw - given an object and
7975//  an raw function, adjust the object base and
8076//  return the actual final code pointer
8177//-------------------------------------------------
8278
83delegate_generic_function delegate_convert_raw(delegate_generic_class *&object, delegate_gcc_mfp_internal &mfp)
79delegate_generic_function delegate_internal_mfp::convert_to_generic(delegate_generic_class *&object) const
8480{
8581   // apply the "this" delta to the object first
86   object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object) + mfp.this_delta);
82   object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<UINT8 *>(object) + m_this_delta);
8783
8884   // if the low bit of the vtable index is clear, then it is just a raw function pointer
89   if (!(mfp.u.vtable_index & 1))
90      return mfp.u.funcptr;
85   if (!(m_function & 1))
86      return reinterpret_cast<delegate_generic_function>(m_function);
9187
9288   // otherwise, it is the byte index into the vtable where the actual function lives
9389   UINT8 *vtable_base = *reinterpret_cast<UINT8 **>(object);
94   return *reinterpret_cast<delegate_generic_function *>(vtable_base + mfp.u.vtable_index - 1);
90   return *reinterpret_cast<delegate_generic_function *>(vtable_base + m_function - 1);
9591}
9692
9793#endif
src/emu/delegate.h
r11224r11225
123123#define USE_DELEGATE_TYPE DELEGATE_TYPE_COMPATIBLE
124124#endif
125125
126// nicer macros to hide the template gobblety-gook and to pass the names
127#define create_member_name(_class, _member, _name)   _create_member<_class, &_class::_member>(_name)
128#define create_member(_class, _member)            _create_member<_class, &_class::_member>(#_class "::" #_member)
129#define create_static(_class, _func)            _crate_static<_class, &_func>(#_func)
130126
131127
132
133128//**************************************************************************
134129//  HELPER CLASSES
135130//**************************************************************************
r11224r11225
169164typedef delegate_generic_class *(*deferred_cast_func)(bindable_object &object);
170165
171166
172// ======================> delegate_base
167// ======================> delegate_traits
173168
174// simple base class for all delegates to derive from; it is explicitly
175// polymorphic so that a delegate_base * can be used as a lowest-common
176// denominator, and then downcast to the appropriate type with proper
177// type checking
178class delegate_base
169// delegate_traits is a meta-template that is used to provide a static function pointer
170// and member function pointer of the appropriate type and number of parameters; we use
171// partial template specialization to support fewer parameters by defaulting the later
172// parameters to the special type delegate_param_none
173template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
174struct delegate_traits
179175{
180public:
181   delegate_base(deferred_cast_func caster, const char *name)
182      : m_caster(caster),
183        m_name(name) { }
184
185   virtual ~delegate_base() { }
186
187   // getters
188   bool isnull() const { return (m_caster == NULL); }
189   bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); }
190   const char *name() const { return m_name; }
191
192protected:
193   deferred_cast_func      m_caster;         // pointer to helper function that does the cast
194   const char *         m_name;            // name string
176   typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type, _P4Type);
177   typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type, _P4Type);
178   typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type, _P4Type);
195179};
196180
181// dummy class used to indicate a non-existant parameter
182class delegate_param_none { };
197183
198
199//**************************************************************************
200//  COMPATIBLE DELEGATES
201//**************************************************************************
202
203#if (USE_DELEGATE_TYPE == DELEGATE_TYPE_COMPATIBLE)
204
205// ======================> proto_delegate_0param
206
207template<typename _ReturnType>
208class proto_delegate_0param : public delegate_base
184// specialization for 3 parameters
185template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
186struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>
209187{
210protected:
211   // pointer to a static version of the function which takes the object as a first parameter
212   typedef _ReturnType (*static_func)(delegate_generic_class *);
213
214public:
215   // constructors
216   proto_delegate_0param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
217      : delegate_base(caster, name),
218        m_function(function) { }
219
220   proto_delegate_0param(const proto_delegate_0param &proto)
221      : delegate_base(proto.m_caster, proto.m_name),
222        m_function(proto.m_function) { }
223
224   // create a member function proto-delegate
225   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)()>
226   static proto_delegate_0param _create_member(const char *name = NULL)
227   {
228      return proto_delegate_0param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name);
229   }
230
231   // create a static function proto-delegate
232   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *)>
233   static proto_delegate_0param _create_static(const char *name = NULL)
234   {
235      return proto_delegate_0param(reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
236   }
237
238   // equality testing
239   bool operator==(const proto_delegate_0param &rhs) const
240   {
241      return (m_function == rhs.m_function && m_caster == rhs.m_caster);
242   }
243
244protected:
245   // helper stub that calls the member function
246   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)()>
247    static _ReturnType method_stub(delegate_generic_class *object_ptr)
248    {
249        _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr);
250        return (p->*_FunctionPtr)();
251    }
252
253   // internal state
254   static_func          m_function;         // pointer to the stub or static function
188   typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type, _P3Type);
189   typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type, _P3Type);
190   typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type, _P3Type);
255191};
256192
257
258// ======================> delegate_0param
259
260template<typename _ReturnType>
261class delegate_0param : public proto_delegate_0param<_ReturnType>
193// specialization for 2 parameters
194template<typename _ClassType, typename _ReturnType, typename _P1Type, typename _P2Type>
195struct delegate_traits<_ClassType, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>
262196{
263   typedef proto_delegate_0param<_ReturnType> proto_base;
264
265   using delegate_base::m_caster;
266   using proto_base::m_function;
267
268public:
269   // constructors
270   delegate_0param()
271      : m_object(NULL) { }
272
273   delegate_0param(proto_base proto)
274      : proto_delegate_0param<_ReturnType>(proto),
275        m_object(NULL) { }
276
277   delegate_0param(proto_base proto, bindable_object &object)
278      : proto_delegate_0param<_ReturnType>(proto),
279        m_object((*m_caster)(object)) { }
280
281   // bind the actual object
282   void bind(bindable_object &object) { m_object = (*m_caster)(object); }
283
284   // call the function
285   _ReturnType operator()() const { return (*m_function)(m_object); }
286
287   // testing
288   bool has_object() const { return (m_object != NULL); }
289   bool operator==(const delegate_0param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
290
291protected:
292   // internal state
293   delegate_generic_class *m_object;         // pointer to the post-cast object
197   typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type, _P2Type);
198   typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type, _P2Type);
199   typedef _ReturnType (_ClassType::*member_func_type)(_P1Type, _P2Type);
294200};
295201
296
297// ======================> proto_delegate_1param
298
299template<typename _ReturnType, typename _P1Type>
300class proto_delegate_1param : public delegate_base
202// specialization for 1 parameter
203template<typename _ClassType, typename _ReturnType, typename _P1Type>
204struct delegate_traits<_ClassType, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>
301205{
302protected:
303   // pointer to a static version of the function which takes the object as a first parameter
304   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type);
305
306public:
307   // constructors
308   proto_delegate_1param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
309      : delegate_base(caster, name),
310        m_function(function) { }
311
312   proto_delegate_1param(const proto_delegate_1param &proto)
313      : delegate_base(proto.m_caster, proto.m_name),
314        m_function(proto.m_function) { }
315
316   // create a member function proto-delegate
317   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type)>
318   static proto_delegate_1param _create_member(const char *name = NULL)
319   {
320      return proto_delegate_1param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name);
321   }
322
323   // create a static function proto-delegate
324   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type)>
325   static proto_delegate_1param _create_static(const char *name = NULL)
326   {
327      return proto_delegate_1param(reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
328   }
329
330   // equality testing
331   bool operator==(const proto_delegate_1param &rhs) const
332   {
333      return (m_function == rhs.m_function && m_caster == rhs.m_caster);
334   }
335
336protected:
337   // helper stub that calls the member function
338   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type)>
339    static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1)
340    {
341        _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr);
342        return (p->*_FunctionPtr)(p1);
343    }
344
345   // internal state
346   static_func          m_function;         // pointer to the stub or static function
206   typedef _ReturnType (*static_func_type)(_ClassType *, _P1Type);
207   typedef _ReturnType (*static_ref_func_type)(_ClassType &, _P1Type);
208   typedef _ReturnType (_ClassType::*member_func_type)(_P1Type);
347209};
348210
349
350// ======================> delegate_1param
351
352template<typename _ReturnType, typename _P1Type>
353class delegate_1param : public proto_delegate_1param<_ReturnType, _P1Type>
211// specialization for no parameters
212template<typename _ClassType, typename _ReturnType>
213struct delegate_traits<_ClassType, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>
354214{
355   typedef proto_delegate_1param<_ReturnType, _P1Type> proto_base;
215   typedef _ReturnType (*static_func_type)(_ClassType *);
216   typedef _ReturnType (*static_ref_func_type)(_ClassType &);
217   typedef _ReturnType (_ClassType::*member_func_type)();
218};
356219
357   using delegate_base::m_caster;
358   using proto_base::m_function;
359220
360public:
361   // constructors
362   delegate_1param()
363      : m_object(NULL) { }
364221
365   delegate_1param(proto_delegate_1param<_ReturnType, _P1Type> proto)
366      : proto_delegate_1param<_ReturnType, _P1Type>(proto),
367        m_object(NULL) { }
222//**************************************************************************
223//  COMPATIBLE DELEGATES
224//**************************************************************************
368225
369   delegate_1param(proto_delegate_1param<_ReturnType, _P1Type> proto, bindable_object &object)
370      : proto_delegate_1param<_ReturnType, _P1Type>(proto),
371        m_object((*m_caster)(object)) { }
226#if (USE_DELEGATE_TYPE == DELEGATE_TYPE_COMPATIBLE)
372227
373   // bind the actual object
374   void bind(bindable_object &object) { m_object = (*m_caster)(object); }
228// ======================> delegate_raw_mfp
375229
376   // call the function
377   _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_object, p1); }
378
379   // testing
380   bool has_object() const { return (m_object != NULL); }
381   bool operator==(const delegate_1param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
382
383protected:
384   // internal state
385   delegate_generic_class *m_object;         // pointer to the post-cast object
386};
387
388
389// ======================> proto_delegate_2param
390
391template<typename _ReturnType, typename _P1Type, typename _P2Type>
392class proto_delegate_2param : public delegate_base
230// delegate_raw_mfp is a class that wraps a generic member function pointer
231// in a static buffer, and can effectively recast itself back for later use;
232// it hides some of the gross details involved in copying artibtrary member
233// function pointers around
234struct delegate_raw_mfp
393235{
394protected:
395   // pointer to a static version of the function which takes the object as a first parameter
396   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type);
236   // for MSVC maximum size is one pointer, plus 3 ints
237   static const int MAX_MFP_SIZE = sizeof(void *) + 3 * sizeof(int);
397238
398public:
399   // constructors
400   proto_delegate_2param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
401      : delegate_base(caster, name),
402        m_function(function) { }
239   // default and copy constructors
240   delegate_raw_mfp() { memset(&m_rawdata, 0, sizeof(m_rawdata)); }
241   delegate_raw_mfp(const delegate_raw_mfp &src) : m_rawdata(src.m_rawdata) { }
403242
404   proto_delegate_2param(const proto_delegate_2param &proto)
405      : delegate_base(proto.m_caster, proto.m_name),
406        m_function(proto.m_function) { }
407
408   // create a member function proto-delegate
409   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type)>
410   static proto_delegate_2param _create_member(const char *name = NULL)
243   // construct from any member function pointer
244   template<typename _FunctionType>
245   delegate_raw_mfp(_FunctionType mfp)
411246   {
412      return proto_delegate_2param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name);
247      assert(sizeof(mfp) <= sizeof(m_rawdata));
248      memset(&m_rawdata, 0, sizeof(m_rawdata));
249      *reinterpret_cast<_FunctionType *>(&m_rawdata) = mfp;
413250   }
414251
415   // create a static function proto-delegate
416   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type)>
417   static proto_delegate_2param _create_static(const char *name = NULL)
252   // assignment operator
253   delegate_raw_mfp &operator=(const delegate_raw_mfp &src)
418254   {
419      return proto_delegate_2param(reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
255      if (this != &src)
256         m_rawdata = src.m_rawdata;
257      return *this;
420258   }
421259
422   // equality testing
423   bool operator==(const proto_delegate_2param &rhs) const
260   // comparison operator
261   bool operator==(const delegate_raw_mfp &rhs) const
424262   {
425      return (m_function == rhs.m_function && m_caster == rhs.m_caster);
263      return (memcmp(&m_rawdata, &rhs.m_rawdata, sizeof(m_rawdata)) == 0);
426264   }
427265
428protected:
429   // helper stub that calls the member function
430   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type)>
431    static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2)
432    {
433        _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr);
434        return (p->*_FunctionPtr)(p1, p2);
435    }
266   // convert back to a member function pointer
267   template<class _FunctionType>
268   _FunctionType &mfp() const { return *reinterpret_cast<_FunctionType *>(&m_rawdata); }
436269
437   // internal state
438   static_func          m_function;         // pointer to the stub or static function
270   // raw buffer to hold the copy of the function pointer
271   mutable struct { UINT8 bytes[MAX_MFP_SIZE]; } m_rawdata;
439272};
440273
441274
442// ======================> delegate_2param
275// ======================> delegate
443276
444template<typename _ReturnType, typename _P1Type, typename _P2Type>
445class delegate_2param : public proto_delegate_2param<_ReturnType, _P1Type, _P2Type>
277// general delegate class template supporting up to 4 parameters
278template<typename _ReturnType, typename _P1Type = delegate_param_none, typename _P2Type = delegate_param_none, typename _P3Type = delegate_param_none, typename _P4Type = delegate_param_none>
279class delegate_base
446280{
447   typedef proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto_base;
281   typedef typename delegate_traits<delegate_generic_class, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type generic_static_func;
448282
449   using delegate_base::m_caster;
450   using proto_base::m_function;
451
452283public:
453   // constructors
454   delegate_2param()
455      : m_object(NULL) { }
284   // generic constructor
285   delegate_base()
286      : m_caster(NULL),
287        m_name(NULL),
288        m_function(NULL),
289        m_object(NULL),
290        m_callobject(NULL) { }
456291
457   delegate_2param(proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto)
458      : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto),
459        m_object(NULL) { }
292   // copy constructor
293   delegate_base(const delegate_base &src)
294      : m_caster(src.m_caster),
295        m_name(src.m_name),
296        m_object(src.m_object),
297        m_callobject(src.is_mfp() ? reinterpret_cast<delegate_generic_class *>(this) : src.m_object),
298        m_function(src.m_function),
299        m_rawfunction(src.m_rawfunction) { }
460300
461   delegate_2param(proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto, bindable_object &object)
462      : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto),
463        m_object((*m_caster)(object)) { }
301   // copy constructor with re-bind
302   template<class _FunctionClass>
303   delegate_base(const delegate_base &src, _FunctionClass *object)
304      : m_caster(src.m_caster),
305        m_name(src.m_name),
306        m_object(src.m_object),
307        m_callobject(src.is_mfp() ? reinterpret_cast<delegate_generic_class *>(this) : src.m_object),
308        m_function(src.m_function),
309        m_rawfunction(src.m_rawfunction) { bind(object); }
464310
465   // bind the actual object
466   void bind(bindable_object &object) { m_object = (*m_caster)(object); }
311   // construct from member function with object pointer
312   template<class _FunctionClass>
313   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object)
314      : m_caster(&deferred_cast<_FunctionClass>),
315        m_name(name),
316        m_function(&delegate_base::method_stub<_FunctionClass>),
317        m_object(NULL),
318        m_callobject(reinterpret_cast<delegate_generic_class *>(this)),
319        m_rawfunction(funcptr) { bind(object); }
467320
468   // call the function
469   _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_object, p1, p2); }
321   // construct from static function with object pointer
322   template<class _FunctionClass>
323   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object)
324      : m_caster(&deferred_cast<_FunctionClass>),
325        m_name(name),
326        m_object(NULL),
327        m_callobject(NULL),
328        m_function(reinterpret_cast<generic_static_func>(funcptr)) { bind(object); }
470329
471   // testing
472   bool has_object() const { return (m_object != NULL); }
473   bool operator==(const delegate_2param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
330   // construct from static reference function with object pointer
331   template<class _FunctionClass>
332   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object)
333      : m_caster(&deferred_cast<_FunctionClass>),
334        m_name(name),
335        m_object(NULL),
336        m_callobject(NULL),
337        m_function(reinterpret_cast<generic_static_func>(funcptr)) { bind(object); }
474338
475protected:
476   // internal state
477   delegate_generic_class *m_object;         // pointer to the post-cast object
478};
479
480
481// ======================> proto_delegate_3param
482
483template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
484class proto_delegate_3param : public delegate_base
485{
486protected:
487   // pointer to a static version of the function which takes the object as a first parameter
488   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type);
489
490public:
491   // constructors
492   proto_delegate_3param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
493      : delegate_base(caster, name),
494        m_function(function) { }
495
496   proto_delegate_3param(const proto_delegate_3param &proto)
497      : delegate_base(proto.m_caster, proto.m_name),
498        m_function(proto.m_function) { }
499
500   // create a member function proto-delegate
501   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type)>
502   static proto_delegate_3param _create_member(const char *name = NULL)
339   // copy operator
340   delegate_base &operator=(const delegate_base &src)
503341   {
504      return proto_delegate_3param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name);
342      if (this != &src)
343      {
344         m_caster = src.m_caster;
345         m_name = src.m_name;
346         m_object = src.m_object;
347         m_callobject = src.is_mfp() ? reinterpret_cast<delegate_generic_class *>(this) : src.m_object;
348         m_function = src.m_function;
349         m_rawfunction = src.m_rawfunction;
350      }
351      return *this;
505352   }
506353
507   // create a static function proto-delegate
508   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type, _P3Type)>
509   static proto_delegate_3param _create_static(const char *name = NULL)
354   // comparison operator
355   bool operator==(const delegate_base &rhs) const
510356   {
511      return proto_delegate_3param(reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
357      return (m_caster == rhs.m_caster && m_object == rhs.m_object &&
358            m_function == m_function && m_rawfunction == m_rawfunction);
512359   }
513360
514   // equality testing
515   bool operator==(const proto_delegate_3param &rhs) const
516   {
517      return (m_function == rhs.m_function && m_caster == rhs.m_caster);
518   }
361   // getters
362   bool isnull() const { return (m_caster == NULL); }
363   bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); }
364   bool has_object() const { return (m_object != NULL); }
365   const char *name() const { return m_name; }
519366
520protected:
521   // helper stub that calls the member function
522   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type)>
523    static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2, _P3Type p3)
524    {
525        _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr);
526        return (p->*_FunctionPtr)(p1, p2, p3);
527    }
528
529   // internal state
530   static_func          m_function;         // pointer to the stub or static function
531};
532
533
534// ======================> delegate_3param
535
536template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
537class delegate_3param : public proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>
538{
539   typedef proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto_base;
540
541   using delegate_base::m_caster;
542   using proto_base::m_function;
543
544public:
545   // constructors
546   delegate_3param()
547      : m_object(NULL) { }
548
549   delegate_3param(proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto)
550      : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto),
551        m_object(NULL) { }
552
553   delegate_3param(proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto, bindable_object &object)
554      : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto),
555        m_object((*m_caster)(object)) { }
556
557   // bind the actual object
558   void bind(bindable_object &object) { m_object = (*m_caster)(object); }
559
560367   // call the function
561   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); }
368   _ReturnType operator()() const { return (*m_function)(m_callobject); }
369   _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_callobject, p1); }
370   _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_callobject, p1, p2); }
371   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_callobject, p1, p2, p3); }
372   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_callobject, p1, p2, p3, p4); }
562373
563   // testing
564   bool has_object() const { return (m_object != NULL); }
565   bool operator==(const delegate_3param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
566
567374protected:
568   // internal state
569   delegate_generic_class *m_object;         // pointer to the post-cast object
570};
571
572
573// ======================> proto_delegate_4param
574
575template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
576class proto_delegate_4param : public delegate_base
577{
578protected:
579   // pointer to a static version of the function which takes the object as a first parameter
580   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type);
581
582public:
583   // constructors
584   proto_delegate_4param(static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
585      : delegate_base(caster, name),
586        m_function(function) { }
587
588   proto_delegate_4param(const proto_delegate_4param &proto)
589      : delegate_base(proto.m_caster, proto.m_name),
590        m_function(proto.m_function) { }
591
592   // create a member function proto-delegate
593   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type, _P4Type)>
594   static proto_delegate_4param _create_member(const char *name = NULL)
375   // bind the actual object
376   void bind(bindable_object *object)
595377   {
596      return proto_delegate_4param(&method_stub<_FunctionClass, _FunctionPtr>, &deferred_cast<_FunctionClass>, name);
378      m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL;
379      if (!is_mfp()) m_callobject = m_object;
597380   }
598381
599   // create a static function proto-delegate
600   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type, _P3Type, _P4Type)>
601   static proto_delegate_4param _create_static(const char *name = NULL)
602   {
603      return proto_delegate_4param(reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
604   }
382   // internal helpers
383   bool is_mfp() const { return m_callobject == reinterpret_cast<const delegate_generic_class *>(this); }
605384
606   // equality testing
607   bool operator==(const proto_delegate_4param &rhs) const
608   {
609      return (m_function == rhs.m_function && m_caster == rhs.m_caster);
610   }
385   // helper stub that calls the member function; we need one for each parameter count
386   template<class _FunctionClass>
387    static _ReturnType method_stub(delegate_generic_class *object)
388    {
389       typedef _ReturnType (_FunctionClass::*mfptype)();
390       delegate_base *_this = reinterpret_cast<delegate_base *>(object);
391       mfptype &mfp = _this->m_rawfunction.mfp<mfptype>();
392       return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)();
393    }
611394
612protected:
613   // helper stub that calls the member function
614   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type, _P4Type)>
615    static _ReturnType method_stub(delegate_generic_class *object_ptr, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4)
395   template<class _FunctionClass>
396    static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1)
616397    {
617        _FunctionClass *p = reinterpret_cast<_FunctionClass *>(object_ptr);
618        return (p->*_FunctionPtr)(p1, p2, p3, p4);
398       typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1);
399       delegate_base *_this = reinterpret_cast<delegate_base *>(object);
400       mfptype &mfp = _this->m_rawfunction.mfp<mfptype>();
401       return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1);
619402    }
620403
621   // internal state
622   static_func          m_function;         // pointer to the stub or static function
623};
404   template<class _FunctionClass>
405    static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2)
406    {
407       typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2);
408       delegate_base *_this = reinterpret_cast<delegate_base *>(object);
409       mfptype &mfp = _this->m_rawfunction.mfp<mfptype>();
410       return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2);
411    }
624412
413   template<class _FunctionClass>
414    static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3)
415    {
416       typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3);
417       delegate_base *_this = reinterpret_cast<delegate_base *>(object);
418       mfptype &mfp = _this->m_rawfunction.mfp<mfptype>();
419       return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2, p3);
420    }
625421
626// ======================> delegate_4param
422   template<class _FunctionClass>
423    static _ReturnType method_stub(delegate_generic_class *object, _P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4)
424    {
425       typedef _ReturnType (_FunctionClass::*mfptype)(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4);
426       delegate_base *_this = reinterpret_cast<delegate_base *>(object);
427       mfptype &mfp = _this->m_rawfunction.mfp<mfptype>();
428       return (reinterpret_cast<_FunctionClass *>(_this->m_object)->*mfp)(p1, p2, p3, p4);
429    }
627430
628template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
629class delegate_4param : public proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>
630{
631   typedef proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto_base;
632
633   using delegate_base::m_caster;
634   using proto_base::m_function;
635
636public:
637   // constructors
638   delegate_4param()
639      : m_object(NULL) { }
640
641   delegate_4param(proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto)
642      : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto),
643        m_object(NULL) { }
644
645   delegate_4param(proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto, bindable_object &object)
646      : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto),
647        m_object((*m_caster)(object)) { }
648
649   // bind the actual object
650   void bind(bindable_object &object) { m_object = (*m_caster)(object); }
651
652   // call the function
653   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); }
654
655   // testing
656   bool has_object() const { return (m_object != NULL); }
657   bool operator==(const delegate_4param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
658
659protected:
660431   // internal state
661   delegate_generic_class *m_object;         // pointer to the post-cast object
432   deferred_cast_func         m_caster;         // pointer to helper function that does the cast
433   const char *            m_name;            // name string
434   generic_static_func         m_function;         // generic static function pointer
435   delegate_raw_mfp         m_rawfunction;      // copy of raw MFP
436   delegate_generic_class *   m_object;         // pointer to the post-cast object
437   delegate_generic_class *   m_callobject;      // pointer to the object used for calling
662438};
663439
664
665440#endif
666441
667442
r11224r11225
675450typedef void (*delegate_generic_function)();
676451
677452// struct describing the contents of a member function pointer
678struct delegate_gcc_mfp_internal
453struct delegate_internal_mfp
679454{
680   union                              // first item can be one of two things:
681   {
682      delegate_generic_function funcptr;      // if even, it's a pointer to the function
683      FPTR            vtable_index;      // if odd, it's the byte offset into the vtable
684   } u;
685   int                this_delta;         // delta to apply to the 'this' pointer
686};
455   // default constructor
456   delegate_internal_mfp()
457      : m_function(0),
458        m_this_delta(0) { }
687459
688// helper function
689delegate_generic_function delegate_convert_raw(delegate_generic_class *&object, delegate_gcc_mfp_internal &mfp);
460   // copy constructor
461   delegate_internal_mfp(const delegate_internal_mfp &src)
462      : m_function(src.m_function),
463        m_this_delta(src.m_this_delta) { }
690464
691// global dummy extern
692extern delegate_gcc_mfp_internal delegate_gcc_mfp_null;
693
694
695// ======================> proto_delegate_0param
696
697template<typename _ReturnType>
698class proto_delegate_0param : public delegate_base
699{
700protected:
701   // pointer to a static function which takes the object as a first parameter
702   typedef _ReturnType (*static_func)(delegate_generic_class *);
703
704public:
705   // constructors
706   proto_delegate_0param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
707      : delegate_base(caster, name),
708        m_function(function),
709        m_rawfunction(mfp) { }
710
711   proto_delegate_0param(const proto_delegate_0param &proto)
712      : delegate_base(proto.m_caster, proto.m_name),
713        m_function(proto.m_function),
714        m_rawfunction(proto.m_rawfunction) { }
715
716   // create a member function proto-delegate
717   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)()>
718   static proto_delegate_0param _create_member(const char *name = NULL)
465   // construct from any member function pointer
466   template<typename _FunctionPtr>
467   delegate_internal_mfp(_FunctionPtr funcptr)
719468   {
720      union
721      {
722         _ReturnType (_FunctionClass::*mfp)();
723         delegate_gcc_mfp_internal   internal;
724      } tempunion;
725      tempunion.mfp = _FunctionPtr;
726      return proto_delegate_0param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name);
469      assert(sizeof(funcptr) == sizeof(*this));
470      *reinterpret_cast<_FunctionPtr *>(this) = funcptr;
727471   }
728472
729   // create a static function proto-delegate
730   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *)>
731   static proto_delegate_0param _create_static(const char *name = NULL)
473   // assignment operator
474   delegate_internal_mfp &operator=(const delegate_internal_mfp &src)
732475   {
733      return proto_delegate_0param(delegate_gcc_mfp_null, reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
476      if (this != &src)
477      {
478         m_function = src.m_function;
479         m_this_delta = src.m_this_delta;
480      }
481      return *this;
734482   }
735483
736   // equality testing
737   bool operator==(const proto_delegate_0param &rhs) const
484   // comparison operator
485   bool operator==(const delegate_internal_mfp &rhs) const
738486   {
739      return (m_function == rhs.m_function && m_caster == rhs.m_caster &&
740            m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr &&
741            m_rawfunction.this_delta == rhs.m_rawfunction.this_delta);
487      return (m_function == rhs.m_function && m_this_delta == rhs.m_this_delta);
742488   }
743489
744protected:
745   // internal state
746   static_func               m_function;         // generic static function pointer
747   delegate_gcc_mfp_internal   m_rawfunction;      // raw member function definition
490   // extract the generic function and adjust the object pointer
491   delegate_generic_function convert_to_generic(delegate_generic_class *&object) const;
492
493   // actual state
494   FPTR               m_function;         // first item can be one of two things:
495                                    //    if even, it's a pointer to the function
496                                    //    if odd, it's the byte offset into the vtable
497   int                m_this_delta;      // delta to apply to the 'this' pointer
748498};
749499
750500
751// ======================> delegate_0param
501// ======================> delegate
752502
753template<typename _ReturnType>
754class delegate_0param : public proto_delegate_0param<_ReturnType>
503template<typename _ReturnType, typename _P1Type = delegate_param_none, typename _P2Type = delegate_param_none, typename _P3Type = delegate_param_none, typename _P4Type = delegate_param_none>
504class delegate_base
755505{
756   typedef _ReturnType (*static_func)(delegate_generic_class *);
757   typedef proto_delegate_0param<_ReturnType> proto_base;
506   typedef typename delegate_traits<delegate_generic_class, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type generic_static_func;
758507
759   using delegate_base::m_caster;
760   using proto_base::m_function;
761   using proto_base::m_rawfunction;
762
763508public:
764   // constructors
765   delegate_0param()
766      : m_object(NULL) { }
509   // generic constructor
510   delegate_base()
511      : m_caster(NULL),
512        m_name(NULL),
513        m_object(NULL),
514        m_function(NULL) { }
767515
768   delegate_0param(proto_base proto)
769      : proto_delegate_0param<_ReturnType>(proto),
770        m_object(NULL) { }
516   // copy constructor
517   delegate_base(const delegate_base &src)
518      : m_caster(src.m_caster),
519        m_name(src.m_name),
520        m_object(src.m_object),
521        m_function(src.m_function),
522        m_rawfunction(src.m_rawfunction) { }
771523
772   delegate_0param(proto_base proto, bindable_object &object)
773      : proto_delegate_0param<_ReturnType>(proto),
774        m_object(NULL) { bind(object); }
524   // copy constructor with re-bind
525   template<class _FunctionClass>
526   delegate_base(const delegate_base &src, _FunctionClass *object)
527      : m_caster(src.m_caster),
528        m_name(src.m_name),
529        m_object(src.m_object),
530        m_function(src.m_function),
531        m_rawfunction(src.m_rawfunction) { bind(object); }
775532
776   // bind the actual object
777   void bind(bindable_object &object)
778   {
779      m_object = (*this->m_caster)(object);
780      if (m_rawfunction.u.funcptr != NULL)
781         m_function = reinterpret_cast<static_func>(delegate_convert_raw(m_object, m_rawfunction));
782   }
533   // construct from member function with object pointer
534   template<class _FunctionClass>
535   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object)
536      : m_caster(&deferred_cast<_FunctionClass>),
537        m_name(name),
538        m_object(NULL),
539        m_function(NULL),
540        m_rawfunction(funcptr) { bind(object); }
783541
784   // call the function
785   _ReturnType operator()() const { return (*m_function)(m_object); }
542   // construct from static function with object pointer
543   template<class _FunctionClass>
544   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object)
545      : m_caster(&deferred_cast<_FunctionClass>),
546        m_name(name),
547        m_object(NULL),
548        m_function(reinterpret_cast<generic_static_func>(funcptr)) { bind(object); }
786549
787   // testing
788   bool has_object() const { return (m_object != NULL); }
789   bool operator==(const delegate_0param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
550   // construct from static reference function with object pointer
551   template<class _FunctionClass>
552   delegate_base(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object)
553      : m_caster(&deferred_cast<_FunctionClass>),
554        m_name(name),
555        m_object(NULL),
556        m_function(reinterpret_cast<generic_static_func>(funcptr)) { bind(object); }
790557
791protected:
792   // internal state
793   delegate_generic_class *m_object;         // pointer to the post-cast object
794};
795
796
797// ======================> proto_delegate_1param
798
799template<typename _ReturnType, typename _P1Type>
800class proto_delegate_1param : public delegate_base
801{
802protected:
803   // pointer to a static function which takes the object as a first parameter
804   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type);
805
806public:
807   // constructors
808   proto_delegate_1param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
809      : delegate_base(caster, name),
810        m_function(function),
811        m_rawfunction(mfp) { }
812
813   proto_delegate_1param(const proto_delegate_1param &proto)
814      : delegate_base(proto.m_caster, proto.m_name),
815        m_function(proto.m_function),
816        m_rawfunction(proto.m_rawfunction) { }
817
818   // create a member function proto-delegate
819   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type)>
820   static proto_delegate_1param _create_member(const char *name = NULL)
558   // copy operator
559   delegate_base &operator=(const delegate_base &src)
821560   {
822      union
561      if (this != &src)
823562      {
824         _ReturnType (_FunctionClass::*mfp)(_P1Type);
825         delegate_gcc_mfp_internal   internal;
826      } tempunion;
827      tempunion.mfp = _FunctionPtr;
828      return proto_delegate_1param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name);
563         m_caster = src.m_caster;
564         m_name = src.m_name;
565         m_object = src.m_object;
566         m_function = src.m_function;
567         m_rawfunction = src.m_rawfunction;
568      }
569      return *this;
829570   }
830571
831   // create a static function proto-delegate
832   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type)>
833   static proto_delegate_1param _create_static(const char *name = NULL)
572   // comparison operator
573   bool operator==(const delegate_base &rhs) const
834574   {
835      return proto_delegate_1param(delegate_gcc_mfp_null, reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
575      return (m_caster == rhs.m_caster && m_object == rhs.m_object &&
576            m_function == m_function && m_rawfunction == m_rawfunction);
836577   }
837578
838   // equality testing
839   bool operator==(const proto_delegate_1param &rhs) const
840   {
841      return (m_function == rhs.m_function && m_caster == rhs.m_caster &&
842            m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr &&
843            m_rawfunction.this_delta == rhs.m_rawfunction.this_delta);
844   }
579   // getters
580   bool isnull() const { return (m_caster == NULL); }
581   bool valid_target(bindable_object &object) const { return ((*m_caster)(object) != NULL); }
582   bool has_object() const { return (m_object != NULL); }
583   const char *name() const { return m_name; }
845584
846protected:
847   // internal state
848   static_func               m_function;         // generic static function pointer
849   delegate_gcc_mfp_internal   m_rawfunction;      // raw member function definition
850};
851
852
853// ======================> delegate_1param
854
855template<typename _ReturnType, typename _P1Type>
856class delegate_1param : public proto_delegate_1param<_ReturnType, _P1Type>
857{
858   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type);
859   typedef proto_delegate_1param<_ReturnType, _P1Type> proto_base;
860
861   using delegate_base::m_caster;
862   using proto_base::m_function;
863   using proto_base::m_rawfunction;
864
865public:
866   // constructors
867   delegate_1param()
868      : m_object(NULL) { }
869
870   delegate_1param(proto_base proto)
871      : proto_delegate_1param<_ReturnType, _P1Type>(proto),
872        m_object(NULL) { }
873
874   delegate_1param(proto_base proto, bindable_object &object)
875      : proto_delegate_1param<_ReturnType, _P1Type>(proto),
876        m_object(NULL) { bind(object); }
877
878   // bind the actual object
879   void bind(bindable_object &object)
880   {
881      m_object = (*this->m_caster)(object);
882      if (m_rawfunction.u.funcptr != NULL)
883         m_function = reinterpret_cast<static_func>(delegate_convert_raw(m_object, m_rawfunction));
884   }
885
886585   // call the function
586   _ReturnType operator()() const { return (*m_function)(m_object); }
887587   _ReturnType operator()(_P1Type p1) const { return (*m_function)(m_object, p1); }
588   _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_object, p1, p2); }
589   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); }
590   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); }
888591
889   // testing
890   bool has_object() const { return (m_object != NULL); }
891   bool operator==(const delegate_1param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
892
893592protected:
894   // internal state
895   delegate_generic_class *m_object;         // pointer to the post-cast object
896};
897
898
899// ======================> proto_delegate_2param
900
901template<typename _ReturnType, typename _P1Type, typename _P2Type>
902class proto_delegate_2param : public delegate_base
903{
904protected:
905   // pointer to a static function which takes the object as a first parameter
906   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type);
907
908public:
909   // constructors
910   proto_delegate_2param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
911      : delegate_base(caster, name),
912        m_function(function),
913        m_rawfunction(mfp) { }
914
915   proto_delegate_2param(const proto_delegate_2param &proto)
916      : delegate_base(proto.m_caster, proto.m_name),
917        m_function(proto.m_function),
918        m_rawfunction(proto.m_rawfunction) { }
919
920   // create a member function proto-delegate
921   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type)>
922   static proto_delegate_2param _create_member(const char *name = NULL)
593   // bind the actual object
594   void bind(bindable_object *object)
923595   {
924      union
925      {
926         _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type);
927         delegate_gcc_mfp_internal   internal;
928      } tempunion;
929      tempunion.mfp = _FunctionPtr;
930      return proto_delegate_2param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name);
596      m_object = (object != NULL) ? (*this->m_caster)(*object) : NULL;
597      if (m_object != NULL && m_rawfunction.m_function != 0)
598         m_function = reinterpret_cast<generic_static_func>(m_rawfunction.convert_to_generic(m_object));
931599   }
932600
933   // create a static function proto-delegate
934   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type)>
935   static proto_delegate_2param _create_static(const char *name = NULL)
936   {
937      return proto_delegate_2param(delegate_gcc_mfp_null, reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
938   }
939
940   // equality testing
941   bool operator==(const proto_delegate_2param &rhs) const
942   {
943      return (m_function == rhs.m_function && m_caster == rhs.m_caster &&
944            m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr &&
945            m_rawfunction.this_delta == rhs.m_rawfunction.this_delta);
946   }
947
948protected:
949601   // internal state
950   static_func               m_function;         // generic static function pointer
951   delegate_gcc_mfp_internal   m_rawfunction;      // raw member function definition
602   deferred_cast_func         m_caster;         // pointer to helper function that does the cast
603   const char *            m_name;            // name string
604   delegate_generic_class *   m_object;         // pointer to the post-cast object
605   generic_static_func         m_function;         // generic static function pointer
606   delegate_internal_mfp      m_rawfunction;      // raw member function definition
952607};
953608
609#endif
954610
955// ======================> delegate_2param
956611
957template<typename _ReturnType, typename _P1Type, typename _P2Type>
958class delegate_2param : public proto_delegate_2param<_ReturnType, _P1Type, _P2Type>
959{
960   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type);
961   typedef proto_delegate_2param<_ReturnType, _P1Type, _P2Type> proto_base;
612//**************************************************************************
613//  NATURAL SYNTAX
614//**************************************************************************
962615
963   using delegate_base::m_caster;
964   using proto_base::m_function;
965   using proto_base::m_rawfunction;
616// declare the base template
617template <typename Signature>
618class delegate;
966619
620// specialize for 0 parameters; we derive from the base class and provide equivalent
621// pass-through constructors for each type, as well as an assignment operator
622template<typename _ReturnType>
623class delegate<_ReturnType ()> : public delegate_base<_ReturnType>
624{
625   typedef delegate_base<_ReturnType> basetype;
967626public:
968   // constructors
969   delegate_2param()
970      : m_object(NULL) { }
971
972   delegate_2param(proto_base proto)
973      : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto),
974        m_object(NULL) { }
975
976   delegate_2param(proto_base proto, bindable_object &object)
977      : proto_delegate_2param<_ReturnType, _P1Type, _P2Type>(proto),
978        m_object(NULL) { bind(object); }
979
980   // bind the actual object
981   void bind(bindable_object &object)
982   {
983      m_object = (*this->m_caster)(object);
984      if (m_rawfunction.u.funcptr != NULL)
985         m_function = reinterpret_cast<static_func>(delegate_convert_raw(m_object, m_rawfunction));
986   }
987
988   // call the function
989   _ReturnType operator()(_P1Type p1, _P2Type p2) const { return (*m_function)(m_object, p1, p2); }
990
991   // testing
992   bool has_object() const { return (m_object != NULL); }
993   bool operator==(const delegate_2param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
994
995protected:
996   // internal state
997   delegate_generic_class *m_object;         // pointer to the post-cast object
627   delegate() : basetype() { }
628   delegate(const basetype &src) : basetype(src) { }
629   template<class _FunctionClass> delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { }
630   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
631   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
632   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, delegate_param_none, delegate_param_none, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
633   delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
998634};
999635
1000
1001// ======================> proto_delegate_3param
1002
1003template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
1004class proto_delegate_3param : public delegate_base
636// specialize for 1 parameter
637template<typename _ReturnType, typename _P1Type>
638class delegate<_ReturnType (_P1Type)> : public delegate_base<_ReturnType, _P1Type>
1005639{
1006protected:
1007   // pointer to a static function which takes the object as a first parameter
1008   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type);
1009
640   typedef delegate_base<_ReturnType, _P1Type> basetype;
1010641public:
1011   // constructors
1012   proto_delegate_3param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
1013      : delegate_base(caster, name),
1014        m_function(function),
1015        m_rawfunction(mfp) { }
1016
1017   proto_delegate_3param(const proto_delegate_3param &proto)
1018      : delegate_base(proto.m_caster, proto.m_name),
1019        m_function(proto.m_function),
1020        m_rawfunction(proto.m_rawfunction) { }
1021
1022   // create a member function proto-delegate
1023   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type)>
1024   static proto_delegate_3param _create_member(const char *name = NULL)
1025   {
1026      union
1027      {
1028         _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type, _P3Type);
1029         delegate_gcc_mfp_internal   internal;
1030      } tempunion;
1031      tempunion.mfp = _FunctionPtr;
1032      return proto_delegate_3param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name);
1033   }
1034
1035   // create a static function proto-delegate
1036   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type, _P3Type)>
1037   static proto_delegate_3param _create_static(const char *name = NULL)
1038   {
1039      return proto_delegate_3param(delegate_gcc_mfp_null, reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
1040   }
1041
1042   // equality testing
1043   bool operator==(const proto_delegate_3param &rhs) const
1044   {
1045      return (m_function == rhs.m_function && m_caster == rhs.m_caster &&
1046            m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr &&
1047            m_rawfunction.this_delta == rhs.m_rawfunction.this_delta);
1048   }
1049
1050protected:
1051   // internal state
1052   static_func               m_function;         // generic static function pointer
1053   delegate_gcc_mfp_internal   m_rawfunction;      // raw member function definition
642   delegate() : basetype() { }
643   delegate(const basetype &src) : basetype(src) { }
644   template<class _FunctionClass> delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { }
645   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
646   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
647   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, delegate_param_none, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
648   delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
1054649};
1055650
1056
1057// ======================> delegate_3param
1058
1059template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
1060class delegate_3param : public proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>
651// specialize for 2 parameters
652template<typename _ReturnType, typename _P1Type, typename _P2Type>
653class delegate<_ReturnType (_P1Type, _P2Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type>
1061654{
1062   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type);
1063   typedef proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type> proto_base;
1064
1065   using delegate_base::m_caster;
1066   using proto_base::m_function;
1067   using proto_base::m_rawfunction;
1068
655   typedef delegate_base<_ReturnType, _P1Type, _P2Type> basetype;
1069656public:
1070   // constructors
1071   delegate_3param()
1072      : m_object(NULL) { }
1073
1074   delegate_3param(proto_base proto)
1075      : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto),
1076        m_object(NULL) { }
1077
1078   delegate_3param(proto_base proto, bindable_object &object)
1079      : proto_delegate_3param<_ReturnType, _P1Type, _P2Type, _P3Type>(proto),
1080        m_object(NULL) { bind(object); }
1081
1082   // bind the actual object
1083   void bind(bindable_object &object)
1084   {
1085      m_object = (*this->m_caster)(object);
1086      if (m_rawfunction.u.funcptr != NULL)
1087         m_function = reinterpret_cast<static_func>(delegate_convert_raw(m_object, m_rawfunction));
1088   }
1089
1090   // call the function
1091   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3) const { return (*m_function)(m_object, p1, p2, p3); }
1092
1093   // testing
1094   bool has_object() const { return (m_object != NULL); }
1095   bool operator==(const delegate_3param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
1096
1097protected:
1098   // internal state
1099   delegate_generic_class *m_object;         // pointer to the post-cast object
657   delegate() : basetype() { }
658   delegate(const basetype &src) : basetype(src) { }
659   template<class _FunctionClass> delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { }
660   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
661   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
662   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, delegate_param_none, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
663   delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
1100664};
1101665
1102
1103// ======================> proto_delegate_4param
1104
1105template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
1106class proto_delegate_4param : public delegate_base
666// specialize for 3 parameters
667template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type>
668class delegate<_ReturnType (_P1Type, _P2Type, _P3Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type>
1107669{
1108protected:
1109   // pointer to a static function which takes the object as a first parameter
1110   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type);
1111
670   typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type> basetype;
1112671public:
1113   // constructors
1114   proto_delegate_4param(delegate_gcc_mfp_internal &mfp = delegate_gcc_mfp_null, static_func function = NULL, deferred_cast_func caster = NULL, const char *name = NULL)
1115      : delegate_base(caster, name),
1116        m_function(function),
1117        m_rawfunction(mfp) { }
1118
1119   proto_delegate_4param(const proto_delegate_4param &proto)
1120      : delegate_base(proto.m_caster, proto.m_name),
1121        m_function(proto.m_function),
1122        m_rawfunction(proto.m_rawfunction) { }
1123
1124   // create a member function proto-delegate
1125   template<class _FunctionClass, _ReturnType (_FunctionClass::*_FunctionPtr)(_P1Type, _P2Type, _P3Type, _P4Type)>
1126   static proto_delegate_4param _create_member(const char *name = NULL)
1127   {
1128      union
1129      {
1130         _ReturnType (_FunctionClass::*mfp)(_P1Type, _P2Type, _P3Type, _P4Type);
1131         delegate_gcc_mfp_internal   internal;
1132      } tempunion;
1133      tempunion.mfp = _FunctionPtr;
1134      return proto_delegate_4param(tempunion.internal, NULL, &deferred_cast<_FunctionClass>, name);
1135   }
1136
1137   // create a static function proto-delegate
1138   template<class _FunctionClass, _ReturnType (*_FunctionPtr)(_FunctionClass *, _P1Type, _P2Type, _P3Type, _P4Type)>
1139   static proto_delegate_4param _create_static(const char *name = NULL)
1140   {
1141      return proto_delegate_4param(delegate_gcc_mfp_null, reinterpret_cast<static_func>(_FunctionPtr), &deferred_cast<_FunctionClass>, name);
1142   }
1143
1144   // equality testing
1145   bool operator==(const proto_delegate_4param &rhs) const
1146   {
1147      return (m_function == rhs.m_function && m_caster == rhs.m_caster &&
1148            m_rawfunction.u.funcptr == rhs.m_rawfunction.u.funcptr &&
1149            m_rawfunction.this_delta == rhs.m_rawfunction.this_delta);
1150   }
1151
1152protected:
1153   // internal state
1154   static_func               m_function;         // generic static function pointer
1155   delegate_gcc_mfp_internal   m_rawfunction;      // raw member function definition
672   delegate() : basetype() { }
673   delegate(const basetype &src) : basetype(src) { }
674   template<class _FunctionClass> delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { }
675   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
676   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
677   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, delegate_param_none>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
678   delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
1156679};
1157680
1158
1159// ======================> delegate_4param
1160
681// specialize for 4 parameters
1161682template<typename _ReturnType, typename _P1Type, typename _P2Type, typename _P3Type, typename _P4Type>
1162class delegate_4param : public proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>
683class delegate<_ReturnType (_P1Type, _P2Type, _P3Type, _P4Type)> : public delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>
1163684{
1164   typedef _ReturnType (*static_func)(delegate_generic_class *, _P1Type, _P2Type, _P3Type, _P4Type);
1165   typedef proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> proto_base;
1166
1167   using delegate_base::m_caster;
1168   using proto_base::m_function;
1169   using proto_base::m_rawfunction;
1170
685   typedef delegate_base<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type> basetype;
1171686public:
1172   // constructors
1173   delegate_4param()
1174      : m_object(NULL) { }
1175
1176   delegate_4param(proto_base proto)
1177      : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto),
1178        m_object(NULL) { }
1179
1180   delegate_4param(proto_base proto, bindable_object &object)
1181      : proto_delegate_4param<_ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>(proto),
1182        m_object(NULL) { bind(object); }
1183
1184   // bind the actual object
1185   void bind(bindable_object &object)
1186   {
1187      m_object = (*this->m_caster)(object);
1188      if (m_rawfunction.u.funcptr != NULL)
1189         m_function = reinterpret_cast<static_func>(delegate_convert_raw(m_object, m_rawfunction));
1190   }
1191
1192   // call the function
1193   _ReturnType operator()(_P1Type p1, _P2Type p2, _P3Type p3, _P4Type p4) const { return (*m_function)(m_object, p1, p2, p3, p4); }
1194
1195   // testing
1196   bool has_object() const { return (m_object != NULL); }
1197   bool operator==(const delegate_4param &rhs) const { return (m_object == rhs.m_object && proto_base::operator==(rhs)); }
1198
1199protected:
1200   // internal state
1201   delegate_generic_class *m_object;         // pointer to the post-cast object
687   delegate() : basetype() { }
688   delegate(const basetype &src) : basetype(src) { }
689   template<class _FunctionClass> delegate(const basetype &src, _FunctionClass *object) : basetype(src, object) { }
690   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::member_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
691   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
692   template<class _FunctionClass> delegate(typename delegate_traits<_FunctionClass, _ReturnType, _P1Type, _P2Type, _P3Type, _P4Type>::static_ref_func_type funcptr, const char *name, _FunctionClass *object) : basetype(funcptr, name, object) { }
693   delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
1202694};
1203695
1204696
1205
1206#endif
1207
1208
1209697#endif   /* __DELEGATE_H__ */
src/version.c
r11224r11225
3838***************************************************************************/
3939
4040extern const char build_version[];
41const char build_version[] = "0.142 ("__DATE__")";
41const char build_version[] = "0.142u1 ("__DATE__")";
src/mess/machine/dgn_beta.c
r11224r11225
210210// Info for bank switcher
211211struct bank_info_entry
212212{
213   write8_space_func handler;   // Pointer to write handler
213   write8_space_func func;   // Pointer to write handler
214   const char *name;
214215   offs_t start;      // Offset of start of block
215216   offs_t end;      // offset of end of block
216217};
217218
218219static const struct bank_info_entry bank_info[] =
219220{
220   { dgnbeta_ram_b0_w, 0x0000, 0x0fff },
221   { dgnbeta_ram_b1_w, 0x1000, 0x1fff },
222   { dgnbeta_ram_b2_w, 0x2000, 0x2fff },
223   { dgnbeta_ram_b3_w, 0x3000, 0x3fff },
224   { dgnbeta_ram_b4_w, 0x4000, 0x4fff },
225   { dgnbeta_ram_b5_w, 0x5000, 0x5fff },
226   { dgnbeta_ram_b6_w, 0x6000, 0x6fff },
227   { dgnbeta_ram_b7_w, 0x7000, 0x7fff },
228   { dgnbeta_ram_b8_w, 0x8000, 0x8fff },
229   { dgnbeta_ram_b9_w, 0x9000, 0x9fff },
230   { dgnbeta_ram_bA_w, 0xA000, 0xAfff },
231   { dgnbeta_ram_bB_w, 0xB000, 0xBfff },
232   { dgnbeta_ram_bC_w, 0xC000, 0xCfff },
233   { dgnbeta_ram_bD_w, 0xD000, 0xDfff },
234   { dgnbeta_ram_bE_w, 0xE000, 0xEfff },
235   { dgnbeta_ram_bF_w, 0xF000, 0xFBff },
236   { dgnbeta_ram_bG_w, 0xFF00, 0xFfff }
221   { FUNC(dgnbeta_ram_b0_w), 0x0000, 0x0fff },
222   { FUNC(dgnbeta_ram_b1_w), 0x1000, 0x1fff },
223   { FUNC(dgnbeta_ram_b2_w), 0x2000, 0x2fff },
224   { FUNC(dgnbeta_ram_b3_w), 0x3000, 0x3fff },
225   { FUNC(dgnbeta_ram_b4_w), 0x4000, 0x4fff },
226   { FUNC(dgnbeta_ram_b5_w), 0x5000, 0x5fff },
227   { FUNC(dgnbeta_ram_b6_w), 0x6000, 0x6fff },
228   { FUNC(dgnbeta_ram_b7_w), 0x7000, 0x7fff },
229   { FUNC(dgnbeta_ram_b8_w), 0x8000, 0x8fff },
230   { FUNC(dgnbeta_ram_b9_w), 0x9000, 0x9fff },
231   { FUNC(dgnbeta_ram_bA_w), 0xA000, 0xAfff },
232   { FUNC(dgnbeta_ram_bB_w), 0xB000, 0xBfff },
233   { FUNC(dgnbeta_ram_bC_w), 0xC000, 0xCfff },
234   { FUNC(dgnbeta_ram_bD_w), 0xD000, 0xDfff },
235   { FUNC(dgnbeta_ram_bE_w), 0xE000, 0xEfff },
236   { FUNC(dgnbeta_ram_bF_w), 0xF000, 0xFBff },
237   { FUNC(dgnbeta_ram_bG_w), 0xFF00, 0xFfff }
237238};
238239
239240#define is_last_page(page)  (((page==LastPage) || (page==LastPage+1)) ? 1 : 0)
r11224r11225
260261   address_space *space_1 = machine.device(DMACPU_TAG)->memory().space(AS_PROGRAM);
261262   int                  Page;
262263   UINT8              *readbank;
263   write8_space_func   writebank;
264264   int                  bank_start;
265265   int                  bank_end;
266266   int                  MapPage;
r11224r11225
296296            readbank = &ram_get_ptr(machine.device(RAM_TAG))[(MapPage*RamPageSize)-256];
297297            logerror("Error RAM in Last page !\n");
298298         }
299         writebank=bank_info[Page].handler;
300         space_0->install_legacy_write_handler(bank_start, bank_end,FUNC(writebank));
301         space_1->install_legacy_write_handler(bank_start, bank_end,FUNC(writebank));
299         space_0->install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
300         space_1->install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
302301      }
303302      else               // Block is rom, or undefined
304303      {
src/mess/machine/hp48.c
r11224r11225
796796      else
797797      {
798798         if (state->m_modules[i].read != NULL)
799            space->install_legacy_read_handler( base, end, 0, mirror, FUNC(state->m_modules[i].read) );
799            space->install_legacy_read_handler( base, end, 0, mirror, state->m_modules[i].read, state->m_modules[i].read_name);
800800      }
801801
802802      if (state->m_modules[i].isnop)
r11224r11225
808808         else
809809         {
810810            if (state->m_modules[i].write != NULL)
811               space->install_legacy_write_handler( base, end, 0, mirror, FUNC(state->m_modules[i].write) );
811               space->install_legacy_write_handler( base, end, 0, mirror, state->m_modules[i].write, state->m_modules[i].write_name );
812812         }
813813      }
814814
r11224r11225
11841184   /* I/O RAM */
11851185   state->m_modules[0].off_mask = 0x0003f;  /* 32 B */
11861186   state->m_modules[0].read     = hp48_io_r;
1187   state->m_modules[0].read_name     = "hp48_io_r";   
11871188   state->m_modules[0].write    = hp48_io_w;
1189   state->m_modules[0].write_name    = "hp48_io_w";
11881190
11891191   /* internal RAM */
11901192   state->m_modules[1].off_mask = 2 * ram_size - 1;
r11224r11225
11971199      /* bank switcher */
11981200      state->m_modules[2].off_mask = 0x00fff;  /* 2 KB */
11991201      state->m_modules[2].read     = hp48_bank_r;
1202      state->m_modules[2].read_name    = "hp48_bank_r";
12001203      state->m_modules[2].write    = NULL;
12011204   }
12021205
src/mess/machine/apple3.c
r11224r11225
446446
447447   /* reinstall VIA handlers */
448448   {
449      device_t *via_0 = space->machine().device("via6522_0");
450      device_t *via_1 = space->machine().device("via6522_1");
449      via6522_device *via_0 = space->machine().device<via6522_device>("via6522_0");
450      via6522_device *via_1 = space->machine().device<via6522_device>("via6522_1");
451451
452        space->install_readwrite_handler(0xFFD0, 0xFFDF, 0, 0, read8_delegate_create(via6522_device, read, *via_0), write8_delegate_create(via6522_device, write, *via_0));
453      space->install_readwrite_handler(0xFFE0, 0xFFEF, 0, 0, read8_delegate_create(via6522_device, read, *via_1), write8_delegate_create(via6522_device, write, *via_1));
452      space->install_readwrite_handler(0xFFD0, 0xFFDF, 0, 0, read8_delegate(FUNC(via6522_device::read),via_0), write8_delegate(FUNC(via6522_device::write),via_0));
453      space->install_readwrite_handler(0xFFE0, 0xFFEF, 0, 0, read8_delegate(FUNC(via6522_device::read),via_1), write8_delegate(FUNC(via6522_device::write),via_1));
454454   }
455455}
456456
r11224r11225
659659
660660   if ((address & 0xFF00) == 0x0000)
661661   {
662      opptr = apple3_get_zpa_addr(*machine,address);
662      opptr = apple3_get_zpa_addr(machine,address);
663663      direct.explicit_configure(address, address, ~0, opptr - address);
664664      address = ~0;
665665   }
r11224r11225
735735   state->m_via_1_irq = 0;
736736   apple3_update_memory(machine);
737737
738   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(apple3_opbase, machine));
738   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(apple3_opbase), &machine));
739739}
src/mess/machine/isa_fdc.c
r11224r11225
125125void isa8_fdc_device::device_start()
126126{       
127127   m_isa->add_isa_card(this, m_config.m_isa_num);
128   m_isa->install_device(this, 0x03f0, 0x03f7, 0, 0, pc_fdc_r, pc_fdc_w );   
128   m_isa->install_device(this, 0x03f0, 0x03f7, 0, 0, FUNC(pc_fdc_r), FUNC(pc_fdc_w) );   
129129}
130130
131131//-------------------------------------------------
src/mess/machine/mbee.c
r11224r11225
283283      case 0x00:
284284         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
285285         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
286         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
287         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
286         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
287         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
288288         memory_set_bank(machine(), "bank8l", 0); // rom
289289         memory_set_bank(machine(), "bank8h", 0); // rom
290290         break;
291291      case 0x04:
292292         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
293293         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
294         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
295         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
294         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
295         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
296296         memory_set_bank(machine(), "bank8l", 1); // ram
297297         memory_set_bank(machine(), "bank8h", 1); // ram
298298         break;
r11224r11225
320320         break;
321321      case 0x10:
322322      case 0x14:
323         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
324         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
323         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
324         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
325325         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
326326         mem->install_read_bank (0xf800, 0xffff, "bankfh");
327327         memory_set_bank(machine(), "bankfl", 0); // ram
r11224r11225
365365      case 0x00:
366366         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
367367         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
368         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
369         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
368         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
369         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
370370         memory_set_bank(machine(), "bank8l", 0); // rom
371371         memory_set_bank(machine(), "bank8h", 0); // rom
372372         break;
373373      case 0x04:
374374         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
375375         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
376         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
377         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
376         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
377         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
378378         memory_set_bank(machine(), "bank8l", 1); // ram
379379         memory_set_bank(machine(), "bank8h", 1); // ram
380380         break;
r11224r11225
402402         break;
403403      case 0x10:
404404      case 0x14:
405         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate_create(mbee_state, mbeeppc_low_r, *this), write8_delegate_create(mbee_state, mbeeppc_low_w, *this));
406         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate_create(mbee_state, mbeeppc_high_r, *this), write8_delegate_create(mbee_state, mbeeppc_high_w, *this));
405         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
406         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
407407         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
408408         mem->install_read_bank (0xf800, 0xffff, "bankfh");
409409         memory_set_bank(machine(), "bankfl", 0); // ram
src/mess/machine/ti99/speech8.c
r11224r11225
153153         logerror("time to ready: %f -> %d\n", time_to_ready.as_double(), (int) cycles_to_ready);
154154
155155         device_adjust_icount(device->machine().device("maincpu"),-cycles_to_ready);
156         device->machine().scheduler().timer_set(attotime::zero, FUNC(NULL));
156         device->machine().scheduler().timer_set(attotime::zero, FUNC_NULL);
157157      }
158158      tms5220_data_w(spsys->vsp, offset, data);
159159   }
src/mess/machine/ti99/spchsyn.c
r11224r11225
164164         logerror("time to ready: %f -> %d\n", time_to_ready.as_double(), (int) cycles_to_ready);
165165
166166         device_adjust_icount(device->machine().device("maincpu"),-cycles_to_ready);
167         device->machine().scheduler().timer_set(attotime::zero, FUNC(NULL));
167         device->machine().scheduler().timer_set(attotime::zero, FUNC_NULL);
168168      }
169169      tms5220_data_w(adapter->vsp, offset, data);
170170   }
src/mess/machine/thomson.c
r11224r11225
35253525static void to8_kbd_init ( running_machine &machine )
35263526{
35273527   to8_kbd_timer = machine.scheduler().timer_alloc(FUNC(to8_kbd_timer_cb));
3528   to8_kbd_signal = machine.scheduler().timer_alloc(FUNC(NULL));
3528   to8_kbd_signal = machine.scheduler().timer_alloc(FUNC_NULL);
35293529   state_save_register_global( machine, to8_kbd_ack );
35303530   state_save_register_global( machine, to8_kbd_data );
35313531   state_save_register_global( machine, to8_kbd_step );
src/mess/machine/pmd85.c
r11224r11225
871871
872872DIRECT_UPDATE_HANDLER(pmd85_opbaseoverride)
873873{
874   if (input_port_read(*machine, "RESET") & 0x01)
875      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(pmd_reset));
874   if (input_port_read(machine, "RESET") & 0x01)
875      machine.scheduler().timer_set(attotime::from_usec(10), FUNC(pmd_reset));
876876   return address;
877877}
878878
r11224r11225
976976
977977   machine.scheduler().timer_set(attotime::zero, FUNC(setup_machine_state));
978978
979   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(pmd85_opbaseoverride, machine));
979   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pmd85_opbaseoverride), &machine));
980980}
src/mess/machine/vic1112.c
r11224r11225
312312   address_space *program = m_machine.firstcpu->memory().space(AS_PROGRAM);
313313
314314   // map VIAs to VIC-20 address space
315   program->install_readwrite_handler(0x9800, 0x980f, 0, 0, read8_delegate_create(via6522_device, read, *m_via0), write8_delegate_create(via6522_device, write, *m_via0));
316   program->install_readwrite_handler(0x9810, 0x981f, 0, 0, read8_delegate_create(via6522_device, read, *m_via1), write8_delegate_create(via6522_device, write, *m_via1));
315   program->install_readwrite_handler(0x9800, 0x980f, 0, 0, read8_delegate(FUNC(via6522_device::read), (via6522_device*)m_via0), write8_delegate(FUNC(via6522_device::write), (via6522_device*)m_via0));
316   program->install_readwrite_handler(0x9810, 0x981f, 0, 0, read8_delegate(FUNC(via6522_device::read), (via6522_device*)m_via1), write8_delegate(FUNC(via6522_device::write), (via6522_device*)m_via1));
317317
318318   // map ROM to VIC-20 address space
319319   program->install_rom(0xb000, 0xb7ff, subregion(VIC1112_TAG)->base());
src/mess/machine/genpc.c
r11224r11225
570570{
571571}
572572 
573void ibm5160_mb_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, write8_device_func whandler)
573void ibm5160_mb_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name)
574574{   
575575   int buswidth = m_machine.firstcpu->memory().space_config(AS_IO)->m_databus_width;
576576   switch(buswidth)
577577   {
578578      case 8:
579         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, FUNC(rhandler), FUNC(whandler),0);
579         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
580580         break;
581581      case 16:
582         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, FUNC(rhandler), FUNC(whandler),0xffff);
582         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
583583         break;
584584      default:
585585         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported", buswidth);
r11224r11225
587587   }
588588}
589589
590void ibm5160_mb_device::install_device_write(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_device_func whandler)
590void ibm5160_mb_device::install_device_write(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_device_func whandler, const char *whandler_name)
591591{   
592592   int buswidth = m_machine.firstcpu->memory().space_config(AS_IO)->m_databus_width;
593593   switch(buswidth)
594594   {
595595      case 8:
596         m_maincpu->memory().space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, FUNC(whandler),0);
596         m_maincpu->memory().space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name,0);
597597         break;
598598      case 16:
599         m_maincpu->memory().space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, FUNC(whandler),0xffff);
599         m_maincpu->memory().space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name, 0xffff);
600600         break;
601601      default:
602602         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported", buswidth);
r11224r11225
638638   devcb_resolve_write_line(&m_kb_set_clock_signal_func, &m_config.m_kb_set_clock_signal_func, this);
639639   devcb_resolve_write_line(&m_kb_set_data_signal_func,  &m_config.m_kb_set_data_signal_func,  this);
640640
641   install_device(m_dma8237, 0x0000, 0x000f, 0, 0, i8237_r, i8237_w );   
642   install_device(m_pic8259, 0x0020, 0x0021, 0, 0, pic8259_r, pic8259_w );   
643   install_device(m_pit8253, 0x0040, 0x0043, 0, 0, pit8253_r, pit8253_w );   
644   install_device(m_ppi8255, 0x0060, 0x0063, 0, 0, i8255a_r, i8255a_w );   
645   install_device(this,    0x0080, 0x0087, 0, 0, pc_page_r, pc_page_w );   
646   install_device_write(this,    0x00a0, 0x00a1, 0, 0, nmi_enable_w);   
641   install_device(m_dma8237, 0x0000, 0x000f, 0, 0, FUNC(i8237_r), FUNC(i8237_w) );   
642   install_device(m_pic8259, 0x0020, 0x0021, 0, 0, FUNC(pic8259_r), FUNC(pic8259_w) );   
643   install_device(m_pit8253, 0x0040, 0x0043, 0, 0, FUNC(pit8253_r), FUNC(pit8253_w) );   
644   install_device(m_ppi8255, 0x0060, 0x0063, 0, 0, FUNC(i8255a_r), FUNC(i8255a_w) );   
645   install_device(this,    0x0080, 0x0087, 0, 0, FUNC(pc_page_r), FUNC(pc_page_w) );   
646   install_device_write(this,    0x00a0, 0x00a1, 0, 0, FUNC(nmi_enable_w));   
647647   /* MESS managed RAM */
648648   if ( ram_get_ptr(m_machine.device(RAM_TAG)) )
649649      memory_set_bankptr( m_machine, "bank10", ram_get_ptr(m_machine.device(RAM_TAG)) );   
src/mess/machine/osborne1.c
r11224r11225
205205
206206DIRECT_UPDATE_HANDLER( osborne1_opbase )
207207{
208   osborne1_state *state = machine->driver_data<osborne1_state>();
208   osborne1_state *state = machine.driver_data<osborne1_state>();
209209   if ( ( address & 0xF000 ) == 0x2000 )
210210   {
211211      if ( ! state->m_bank2_enabled )
212212      {
213         direct.explicit_configure(0x2000, 0x2fff, 0x0fff, ram_get_ptr(machine->device(RAM_TAG)) + 0x2000);
213         direct.explicit_configure(0x2000, 0x2fff, 0x0fff, ram_get_ptr(machine.device(RAM_TAG)) + 0x2000);
214214         return ~0;
215215      }
216216   }
r11224r11225
458458      floppy_install_load_proc(floppy_get_device(machine, drive), osborne1_load_proc);
459459   }
460460
461   space->set_direct_update_handler(direct_update_delegate_create_static(osborne1_opbase, machine));
461   space->set_direct_update_handler(direct_update_delegate(FUNC(osborne1_opbase), &machine));
462462}
463463
464464
src/mess/machine/amstrad.c
r11224r11225
11271127/* used to setup computer if a snapshot was specified */
11281128DIRECT_UPDATE_HANDLER( amstrad_multiface_directoverride )
11291129{
1130   amstrad_state *state = machine->driver_data<amstrad_state>();
1130   amstrad_state *state = machine.driver_data<amstrad_state>();
11311131      int pc;
11321132
1133      pc = cpu_get_pc(machine->device("maincpu"));
1133      pc = cpu_get_pc(machine.device("maincpu"));
11341134
11351135      /* there are two places where CALL &0065 can be found
11361136        in the multiface rom. At this address there is a RET.
r11224r11225
11591159        state->m_multiface_flags &= ~(MULTIFACE_VISIBLE|MULTIFACE_STOP_BUTTON_PRESSED);
11601160
11611161       /* clear op base override */
1162        machine->device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(amstrad_default, *machine));
1162        machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(amstrad_default), &machine));
11631163      }
11641164
11651165      return pc;
r11224r11225
12551255      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
12561256
12571257      /* initialise 0065 override to monitor calls to 0065 */
1258      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(amstrad_multiface_directoverride, machine));
1258      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(amstrad_multiface_directoverride), &machine));
12591259   }
12601260
12611261}
src/mess/machine/sms.c
r11224r11225
16171617   if ((detect_tvdraw(state->m_cartridge[index].ROM)) && state->m_is_region_japan)
16181618   {
16191619      address_space *program = machine.device("maincpu")->memory().space(AS_PROGRAM);
1620      program->install_legacy_write_handler(0x6000, 0x6000, FUNC(&sms_tvdraw_axis_w));
1621      program->install_legacy_read_handler(0x8000, 0x8000, FUNC(&sms_tvdraw_status_r));
1622      program->install_legacy_read_handler(0xa000, 0xa000, FUNC(&sms_tvdraw_data_r));
1620      program->install_legacy_write_handler(0x6000, 0x6000, FUNC(sms_tvdraw_axis_w));
1621      program->install_legacy_read_handler(0x8000, 0x8000, FUNC(sms_tvdraw_status_r));
1622      program->install_legacy_read_handler(0xa000, 0xa000, FUNC(sms_tvdraw_data_r));
16231623      program->nop_write(0xa000, 0xa000);
16241624   }
16251625
r11224r11225
16291629      // and then the handlers should be installed here for all but the KOREAN_NOBANK carts
16301630      // However, to avoid memory map breakage, we currently go the other way around
16311631      address_space *program = machine.device("maincpu")->memory().space(AS_PROGRAM);
1632      program->install_legacy_readwrite_handler(0xfffc, 0xffff, FUNC(&sms_kor_nobank_r), FUNC(&sms_kor_nobank_w));
1632      program->install_legacy_readwrite_handler(0xfffc, 0xffff, FUNC(sms_kor_nobank_r), FUNC(sms_kor_nobank_w));
16331633   }
16341634
16351635   LOG(("Cart Features: %x\n", state->m_cartridge[index].features));
src/mess/machine/nes_pcb.c
r11224r11225
1165011650struct nes_memory_accessor
1165111651{
1165211652   write8_space_func write;
11653   const char        *write_name;
1165311654   read8_space_func  read;
11655   const char        *read_name;
1165411656};
1165511657
1165611658typedef struct _nes_pcb_intf  nes_pcb_intf;
r11224r11225
1166611668};
1166711669
1166811670#define NES_NOACCESS \
11669{NULL, NULL}
11671{FUNC_NULL, FUNC_NULL}
1167011672
1167111673#define NES_READONLY(a) \
11672{NULL, a}
11674{FUNC_NULL, FUNC(a)}
1167311675
1167411676#define NES_WRITEONLY(a) \
11675{a, NULL}
11677{FUNC(a), FUNC_NULL}
1167611678
1167711679static WRITE8_HANDLER( dummy_l_w )
1167811680{
r11224r11225
1173311735   { STD_TXROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
1173411736   { STD_TVROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
1173511737   { STD_TKROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txrom_w),               NULL, NULL, mmc3_irq },
11736   { STD_HKROM,            NES_NOACCESS, {hkrom_m_w, hkrom_m_r}, NES_WRITEONLY(hkrom_w),     NULL, NULL, mmc3_irq },
11738   { STD_HKROM,            NES_NOACCESS, {FUNC(hkrom_m_w), FUNC(hkrom_m_r)}, NES_WRITEONLY(hkrom_w),     NULL, NULL, mmc3_irq },
1173711739   { STD_TQROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tqrom_w),               NULL, NULL, mmc3_irq },
1173811740   { STD_TXSROM,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txsrom_w),              NULL, NULL, mmc3_irq },
1173911741   { STD_DXROM,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(dxrom_w),               NULL, NULL, NULL },
r11224r11225
1174211744   { NAMCOT_3425,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(namcot3425_w),          NULL, NULL, NULL },
1174311745   { NAMCOT_3446,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(namcot3446_w),          NULL, NULL, NULL },
1174411746   { NAMCOT_3453,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(namcot3453_w),          NULL, NULL, NULL },
11745   { STD_EXROM,            {exrom_l_w, exrom_l_r}, NES_NOACCESS, NES_NOACCESS,               NULL, NULL, mmc5_irq },
11747   { STD_EXROM,            {FUNC(exrom_l_w), FUNC(exrom_l_r)}, NES_NOACCESS, NES_NOACCESS,               NULL, NULL, mmc5_irq },
1174611748   { NES_QJ,               NES_NOACCESS, NES_WRITEONLY(qj_m_w), NES_WRITEONLY(txrom_w),      NULL, NULL, mmc3_irq },
1174711749   { PAL_ZZ,               NES_NOACCESS, NES_WRITEONLY(zz_m_w), NES_WRITEONLY(txrom_w),      NULL, NULL, mmc3_irq },
1174811750   { UXROM_CC,             NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(uxrom_cc_w),            NULL, NULL, NULL },
r11224r11225
1177511777   { KONAMI_VRC4,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc4_w),         NULL, NULL, konami_irq },
1177611778   { KONAMI_VRC6,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc6_w),         NULL, NULL, konami_irq },
1177711779   { KONAMI_VRC7,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(konami_vrc7_w),         NULL, NULL, konami_irq },
11778   { NAMCOT_163,           {namcot163_l_w, namcot163_l_r}, NES_NOACCESS, NES_WRITEONLY(namcot163_w), NULL, NULL, namcot_irq },
11780   { NAMCOT_163,           {FUNC(namcot163_l_w), FUNC(namcot163_l_r) }, NES_NOACCESS, NES_WRITEONLY(namcot163_w), NULL, NULL, namcot_irq },
1177911781   { SUNSOFT_1,            NES_NOACCESS, NES_WRITEONLY(sunsoft1_m_w), NES_NOACCESS,          NULL, NULL, NULL },
1178011782   { SUNSOFT_2,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sunsoft2_w),            NULL, NULL, NULL },
1178111783   { SUNSOFT_3,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sunsoft3_w),            NULL, NULL, sunsoft3_irq },
1178211784   { TAITO_TC0190FMC,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tc0190fmc_w),           NULL, NULL, NULL },
1178311785   { TAITO_TC0190FMCP,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tc0190fmc_p16_w),       NULL, NULL, mmc3_irq },
11784   { TAITO_X1_005,         NES_NOACCESS, {x1005_m_w, x1005_m_r}, NES_NOACCESS,               NULL, NULL, NULL },
11785   { TAITO_X1_005_A,       NES_NOACCESS, {x1005a_m_w, x1005_m_r}, NES_NOACCESS,              NULL, NULL, NULL },
11786   { TAITO_X1_017,         NES_NOACCESS, {x1017_m_w, x1017_m_r}, NES_NOACCESS,               NULL, NULL, NULL },
11786   { TAITO_X1_005,         NES_NOACCESS, {FUNC(x1005_m_w), FUNC(x1005_m_r)}, NES_NOACCESS,               NULL, NULL, NULL },
11787   { TAITO_X1_005_A,       NES_NOACCESS, {FUNC(x1005a_m_w), FUNC(x1005_m_r)}, NES_NOACCESS,              NULL, NULL, NULL },
11788   { TAITO_X1_017,         NES_NOACCESS, {FUNC(x1017_m_w), FUNC(x1017_m_r)}, NES_NOACCESS,               NULL, NULL, NULL },
1178711789   //
1178811790   { AGCI_50282,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(agci_50282_w),          NULL, NULL, NULL },
1178911791   { ACTENT_ACT52,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ae_act52_w),            NULL, NULL, NULL },
r11224r11225
1179711799   { CAMERICA_BF9097,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bf9093_w),              NULL, NULL, NULL },
1179811800   { CAMERICA_BF9096,      NES_NOACCESS, NES_WRITEONLY(bf9096_w), NES_WRITEONLY(bf9096_w),   NULL, NULL, NULL },
1179911801   { CAMERICA_GOLDENFIVE,  NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(golden5_w),             NULL, NULL, NULL },
11800   { CONY_BOARD,           {cony_l_w, cony_l_r}, NES_NOACCESS, NES_WRITEONLY(cony_w),        NULL, NULL, sunsoft3_irq },
11802   { CONY_BOARD,           {FUNC(cony_l_w), FUNC(cony_l_r)}, NES_NOACCESS, NES_WRITEONLY(cony_w),        NULL, NULL, sunsoft3_irq },
1180111803   { DREAMTECH_BOARD,      NES_WRITEONLY(dreamtech_l_w), NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
1180211804   { FUTUREMEDIA_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(futuremedia_w),         NULL, NULL, futuremedia_irq },
11803   { FUKUTAKE_BOARD,       {fukutake_l_w, fukutake_l_r}, NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
11804   { GOUDER_37017,         {gouder_sf4_l_w, gouder_sf4_l_r}, NES_NOACCESS, NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
11805   { FUKUTAKE_BOARD,       {FUNC(fukutake_l_w), FUNC(fukutake_l_r)}, NES_NOACCESS, NES_NOACCESS,         NULL, NULL, NULL },
11806   { GOUDER_37017,         {FUNC(gouder_sf4_l_w), FUNC(gouder_sf4_l_r)}, NES_NOACCESS, NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1180511807   { HENGEDIANZI_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(henggedianzi_w),        NULL, NULL, NULL },
1180611808   { HENGEDIANZI_XJZB,     NES_WRITEONLY(heng_xjzb_l_w), NES_NOACCESS, NES_WRITEONLY(heng_xjzb_w), NULL, NULL, NULL },
1180711809   { HES6IN1_BOARD,        NES_WRITEONLY(hes6in1_l_w), NES_NOACCESS, NES_NOACCESS,           NULL, NULL, NULL },
1180811810   { HES_BOARD,            NES_WRITEONLY(hes_l_w), NES_NOACCESS, NES_NOACCESS,               NULL, NULL, NULL },
1180911811   { HOSENKAN_BOARD,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(hosenkan_w),            NULL, NULL, mmc3_irq },
1181011812   { KAISER_KS7058,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks7058_w),              NULL, NULL, NULL },
11811   { KAISER_KS7022,        NES_NOACCESS, NES_NOACCESS, {ks7022_w, ks7022_r},                 NULL, NULL, NULL },
11813   { KAISER_KS7022,        NES_NOACCESS, NES_NOACCESS, {FUNC(ks7022_w), FUNC(ks7022_r)},                 NULL, NULL, NULL },
1181211814   { KAISER_KS7032,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks7032_w),              NULL, NULL, ks7032_irq },
1181311815   { KAISER_KS202,         NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ks202_w),               NULL, NULL, ks7032_irq },
1181411816   { KAISER_KS7017,      NES_WRITEONLY(ks7017_l_w), NES_NOACCESS, NES_NOACCESS,            NULL, NULL, mmc_fds_irq },
11815   { KAY_PANDAPRINCE,      {kay_pp_l_w, kay_pp_l_r}, NES_NOACCESS, NES_WRITEONLY(kay_pp_w),  NULL, NULL, mmc3_irq },
11817   { KAY_PANDAPRINCE,      {FUNC(kay_pp_l_w), FUNC(kay_pp_l_r)}, NES_NOACCESS, NES_WRITEONLY(kay_pp_w),  NULL, NULL, mmc3_irq },
1181611818   { KASING_BOARD,         NES_NOACCESS, NES_WRITEONLY(kasing_m_w), NES_WRITEONLY(txrom_w),  NULL, NULL, mmc3_irq },
11817   { SACHEN_74LS374,       {sachen_74x374_l_w, sachen_74x374_l_r}, NES_NOACCESS, NES_NOACCESS, NULL, NULL, NULL },
11819   { SACHEN_74LS374,       {FUNC(sachen_74x374_l_w), FUNC(sachen_74x374_l_r)}, NES_NOACCESS, NES_NOACCESS, NULL, NULL, NULL },
1181811820   { SACHEN_74LS374_A,     NES_WRITEONLY(sachen_74x374a_l_w), NES_NOACCESS, NES_NOACCESS,    NULL, NULL, NULL },
1181911821   { SACHEN_8259A,         NES_WRITEONLY(s8259_l_w), NES_WRITEONLY(s8259_m_w), NES_NOACCESS, NULL, NULL, NULL },
1182011822   { SACHEN_8259B,         NES_WRITEONLY(s8259_l_w), NES_WRITEONLY(s8259_m_w), NES_NOACCESS, NULL, NULL, NULL },
r11224r11225
1182711829   { SACHEN_SA72008,       NES_WRITEONLY(sa72008_l_w), NES_NOACCESS, NES_NOACCESS,           NULL, NULL, NULL },
1182811830   { SACHEN_TCA01,         NES_READONLY(tca01_l_r), NES_NOACCESS, NES_NOACCESS,              NULL, NULL, NULL },
1182911831   { SACHEN_TCU01,         NES_WRITEONLY(tcu01_l_w), NES_WRITEONLY(tcu01_m_w), NES_WRITEONLY(tcu01_w), NULL, NULL, NULL },
11830   { SACHEN_TCU02,         {tcu02_l_w, tcu02_l_r}, NES_NOACCESS, NES_NOACCESS,               NULL, NULL, NULL },
11832   { SACHEN_TCU02,         {FUNC(tcu02_l_w), FUNC(tcu02_l_r)}, NES_NOACCESS, NES_NOACCESS,               NULL, NULL, NULL },
1183111833   { SUBOR_TYPE0,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(subor0_w),              NULL, NULL, NULL },
1183211834   { SUBOR_TYPE1,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(subor1_w),              NULL, NULL, NULL },
1183311835   { MAGICSERIES_MD,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(magics_md_w),           NULL, NULL, NULL },
11834   { NANJING_BOARD,        {nanjing_l_w, nanjing_l_r}, NES_NOACCESS, NES_NOACCESS,           NULL, NULL, nanjing_irq },
11836   { NANJING_BOARD,        {FUNC(nanjing_l_w), FUNC(nanjing_l_r)}, NES_NOACCESS, NES_NOACCESS,           NULL, NULL, nanjing_irq },
1183511837   { NITRA_TDA,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(nitra_w),               NULL, NULL, mmc3_irq },
1183611838   { NTDEC_ASDER,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(ntdec_asder_w),         NULL, NULL, NULL },
1183711839   { NTDEC_FIGHTINGHERO,   NES_NOACCESS, NES_WRITEONLY(ntdec_fh_m_w), NES_NOACCESS,          NULL, NULL, NULL },
1183811840   { OPENCORP_DAOU306,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(daou306_w),             NULL, NULL, NULL },
1183911841   { RCM_GS2015,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(gs2015_w),              NULL, NULL, NULL },
1184011842   { RCM_TETRISFAMILY,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(rcm_tf_w),              NULL, NULL, NULL },
11841   { REXSOFT_DBZ5,         {rex_dbz_l_w, rex_dbz_l_r}, NES_READONLY(rex_dbz_l_r), NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
11843   { REXSOFT_DBZ5,         {FUNC(rex_dbz_l_w), FUNC(rex_dbz_l_r)}, NES_READONLY(rex_dbz_l_r), NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1184211844   { REXSOFT_SL1632,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(rex_sl1632_w),          NULL, NULL, mmc3_irq },
1184311845   { RUMBLESTATION_BOARD,  NES_NOACCESS, NES_WRITEONLY(rumblestation_m_w), NES_WRITEONLY(rumblestation_w),      NULL, NULL, NULL },
1184411846   { SOMERI_SL12,          NES_WRITEONLY(someri_l_w), NES_NOACCESS, NES_WRITEONLY(someri_w), NULL, NULL, mmc3_irq },
r11224r11225
1184711849   { TENGEN_800008,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800008_w),       NULL, NULL, NULL },
1184811850   { TENGEN_800032,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800032_w),       NULL, NULL, tengen_800032_irq },
1184911851   { TENGEN_800037,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(tengen_800037_w),       NULL, NULL, tengen_800032_irq },
11850   { TXC_22211A,           {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL },
11851   { TXC_22211B,           {txc_22211_l_w, txc_22211_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211b_w), NULL, NULL, NULL },
11852   { TXC_22211C,           {txc_22211_l_w, txc_22211c_l_r}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL },
11852   { TXC_22211A,           {FUNC(txc_22211_l_w), FUNC(txc_22211_l_r)}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL },
11853   { TXC_22211B,           {FUNC(txc_22211_l_w), FUNC(txc_22211_l_r)}, NES_NOACCESS, NES_WRITEONLY(txc_22211b_w), NULL, NULL, NULL },
11854   { TXC_22211C,           {FUNC(txc_22211_l_w), FUNC(txc_22211c_l_r)}, NES_NOACCESS, NES_WRITEONLY(txc_22211_w), NULL, NULL, NULL },
1185311855   { TXC_TW,               NES_WRITEONLY(txc_tw_l_w), NES_WRITEONLY(txc_tw_m_w), NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1185411856   { TXC_STRIKEWOLF,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(txc_strikewolf_w),      NULL, NULL, NULL },
1185511857   { TXC_MXMDHTWO,         NES_READONLY(txc_mxmdhtwo_l_r), NES_NOACCESS, NES_WRITEONLY(txc_mxmdhtwo_w), NULL, NULL, NULL },
r11224r11225
1187711879   { UNL_CC21,             NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_cc21_w),            NULL, NULL, NULL },
1187811880   { UNL_KOF97,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_kof97_w),           NULL, NULL, mmc3_irq },
1187911881   { UNL_T230,             NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_t230_w),            NULL, NULL, konami_irq },
11880   { UNL_KOF96,            {kof96_l_w, kof96_l_r}, NES_NOACCESS, NES_WRITEONLY(kof96_w),     NULL, NULL, mmc3_irq },
11882   { UNL_KOF96,            {FUNC(kof96_l_w), FUNC(kof96_l_r)}, NES_NOACCESS, NES_WRITEONLY(kof96_w),     NULL, NULL, mmc3_irq },
1188111883   { UNL_MK2,              NES_NOACCESS, NES_WRITEONLY(mk2_m_w), NES_NOACCESS,               NULL, NULL, mmc3_irq },
1188211884   { UNL_N625092,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(n625092_w),             NULL, NULL, NULL },
1188311885   { UNL_SC127,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sc127_w),               NULL, NULL, sc127_irq },
r11224r11225
1188611888   { UNL_XZY,              NES_WRITEONLY(unl_xzy_l_w), NES_NOACCESS, NES_NOACCESS,           NULL, NULL, NULL },
1188711889   { UNL_RACERMATE,        NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(unl_racmate_w),         NULL, NULL, NULL },
1188811890   { UNL_STUDYNGAME,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(sng32_w),               NULL, NULL, NULL },
11889   { UNL_603_5052,         {unl_6035052_extra_w, unl_6035052_extra_r}, {unl_6035052_extra_w, unl_6035052_extra_r}, NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
11891   { UNL_603_5052,         {FUNC(unl_6035052_extra_w), FUNC(unl_6035052_extra_r)}, {FUNC(unl_6035052_extra_w), FUNC(unl_6035052_extra_r)}, NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1189011892   { UNL_EDU2K,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(edu2k_w),               NULL, NULL, NULL },
1189111893   { UNL_SHJY3,            NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(shjy3_w),               NULL, NULL, shjy3_irq },
11892   { UNL_H2288,            {h2288_l_w, h2288_l_r}, NES_NOACCESS, NES_WRITEONLY(h2288_w),     NULL, NULL, mmc3_irq },
11894   { UNL_H2288,            {FUNC(h2288_l_w), FUNC(h2288_l_r)}, NES_NOACCESS, NES_WRITEONLY(h2288_w),     NULL, NULL, mmc3_irq },
1189311895   //
1189411896   { BTL_AISENSHINICOL,    NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_mariobaby_w),       NULL, NULL, NULL },
1189511897   { BTL_DRAGONNINJA,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_dn_w),              NULL, NULL, btl_dn_irq },
r11224r11225
1189911901   { BTL_SMB3,             NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_smb3_w),            NULL, NULL, btl_smb3_irq },
1190011902   { BTL_SUPERBROS11,      NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(btl_smb11_w),           NULL, NULL, mmc3_irq },
1190111903   { BTL_TOBIDASE,         NES_WRITEONLY(btl_tobi_l_w), NES_NOACCESS, NES_NOACCESS,          NULL, NULL, NULL },
11902   { BTL_PIKACHUY2K,       NES_NOACCESS, {btl_pika_y2k_m_w, btl_pika_y2k_m_r}, NES_WRITEONLY(btl_pika_y2k_w),  NULL, NULL, mmc3_irq },
11904   { BTL_PIKACHUY2K,       NES_NOACCESS, {FUNC(btl_pika_y2k_m_w), FUNC(btl_pika_y2k_m_r)}, NES_WRITEONLY(btl_pika_y2k_w),  NULL, NULL, mmc3_irq },
1190311905   { WHIRLWIND_2706,       NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(whirl2706_w),           NULL, NULL, NULL },
1190411906   //
1190511907   { BMC_190IN1,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_190in1_w),          NULL, NULL, NULL },
r11224r11225
1193811940   { BMC_15IN1,            NES_NOACCESS, NES_WRITEONLY(bmc_15in1_m_w), NES_WRITEONLY(txrom_w), NULL, NULL, mmc3_irq },
1193911941   { BMC_BALLGAMES_11IN1,  NES_NOACCESS, NES_WRITEONLY(bmc_ball11_m_w), NES_WRITEONLY(bmc_ball11_w), NULL, NULL, NULL },
1194011942   { BMC_GOLDENCARD_6IN1,  NES_WRITEONLY(bmc_gc6in1_l_w), NES_NOACCESS, NES_WRITEONLY(bmc_gc6in1_w), NULL, NULL, mmc3_irq },
11941   { BMC_VT5201,           NES_NOACCESS, NES_NOACCESS, {bmc_vt5201_w, bmc_vt5201_r},         NULL, NULL, NULL },
11943   { BMC_VT5201,           NES_NOACCESS, NES_NOACCESS, {FUNC(bmc_vt5201_w), FUNC(bmc_vt5201_r)},         NULL, NULL, NULL },
1194211944   { BMC_BENSHENG_BS5,     NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_bs5_w),             NULL, NULL, NULL },
1194311945   { BMC_810544,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_810544_w),          NULL, NULL, NULL },
1194411946   { BMC_NTD_03,           NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(bmc_ntd03_w),           NULL, NULL, NULL },
11945   { BMC_G63IN1,           NES_NOACCESS, NES_NOACCESS, {bmc_gb63_w, bmc_gb63_r},             NULL, NULL, NULL },
11947   { BMC_G63IN1,           NES_NOACCESS, NES_NOACCESS, {FUNC(bmc_gb63_w), FUNC(bmc_gb63_r)},             NULL, NULL, NULL },
1194611948   { BMC_FK23C,            NES_WRITEONLY(fk23c_l_w), NES_NOACCESS, NES_WRITEONLY(fk23c_w),   NULL, NULL, mmc3_irq },
1194711949   { BMC_FK23CA,           NES_WRITEONLY(fk23c_l_w), NES_NOACCESS, NES_WRITEONLY(fk23c_w),   NULL, NULL, mmc3_irq },
1194811950   { BMC_PJOY84,           NES_NOACCESS, NES_WRITEONLY(pjoy84_m_w), NES_WRITEONLY(txrom_w),  NULL, NULL, mmc3_irq },
r11224r11225
1195111953   { FFE_MAPPER8,          NES_NOACCESS, NES_NOACCESS, NES_WRITEONLY(mapper8_w),             NULL, NULL, NULL },
1195211954   { FFE_MAPPER17,         NES_WRITEONLY(mapper17_l_w), NES_NOACCESS, NES_NOACCESS,          NULL, NULL, ffe_irq },
1195311955   // for debug and development
11954   { UNKNOWN_BOARD,        {dummy_l_w, dummy_l_r}, {dummy_m_w, dummy_m_r}, {dummy_w, dummy_r}, NULL, NULL, NULL },
11956   { UNKNOWN_BOARD,        {FUNC(dummy_l_w), FUNC(dummy_l_r)}, {FUNC(dummy_m_w), FUNC(dummy_m_r)}, {FUNC(dummy_w), FUNC(dummy_r)}, NULL, NULL, NULL },
1195511957   //
1195611958   { UNSUPPORTED_BOARD,    NES_NOACCESS, NES_NOACCESS, NES_NOACCESS,                         NULL, NULL, NULL },
1195711959   //
r11224r11225
1198011982   if (intf)
1198111983   {
1198211984      state->m_mmc_write_low = intf->mmc_l.write;
11985      state->m_mmc_write_low_name = intf->mmc_l.write_name;
1198311986      state->m_mmc_write_mid = intf->mmc_m.write;
11987      state->m_mmc_write_mid_name = intf->mmc_m.write_name;
1198411988      state->m_mmc_write = intf->mmc_h.write;
11989      state->m_mmc_write_name = intf->mmc_h.write_name;
1198511990      state->m_mmc_read_low = intf->mmc_l.read;
11991      state->m_mmc_read_low_name = intf->mmc_l.read_name;
1198611992      state->m_mmc_read_mid = intf->mmc_m.read;   // in progress
11993      state->m_mmc_read_mid_name = intf->mmc_m.read_name;
1198711994      state->m_mmc_read = intf->mmc_h.read;   // in progress
11995      state->m_mmc_read_name = intf->mmc_h.read_name;
1198811996      ppu2c0x_set_latch(ppu, intf->mmc_ppu_latch);
1198911997   }
1199011998   else
src/mess/machine/comx35.c
r11224r11225
530530
531531DIRECT_UPDATE_HANDLER( comx35_opbase_handler )
532532{
533   comx35_state *state = machine->driver_data<comx35_state>();
533   comx35_state *state = machine.driver_data<comx35_state>();
534534
535535   if (address >= 0x0dd0 && address <= 0x0ddf)
536536   {
537537      if (state->is_dos_card_active())
538538      {
539539         // read opcode from DOS ROM
540         direct.explicit_configure(0x0dd0, 0x0ddf, 0x000f, machine->region("fdc")->base());
540         direct.explicit_configure(0x0dd0, 0x0ddf, 0x000f, machine.region("fdc")->base());
541541         return ~0;
542542      }
543543   }
r11224r11225
557557   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
558558
559559   /* opbase handling for DOS Card */
560   program->set_direct_update_handler(direct_update_delegate_create_static(comx35_opbase_handler, m_machine));
560   program->set_direct_update_handler(direct_update_delegate(FUNC(comx35_opbase_handler), &m_machine));
561561
562562   /* BASIC ROM banking */
563563   program->install_read_bank(0x1000, 0x17ff, "bank2");
src/mess/machine/compis.c
r11224r11225
13261326   state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
13271327   state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
13281328   state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
1329   state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
1330   state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
1331   state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
1329   state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
1330   state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
1331   state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
13321332   state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback));
13331333   state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback));
13341334}
src/mess/machine/vtech2.c
r11224r11225
4646static READ8_HANDLER ( mra_bank4 ) { return mra_bank(space->machine(),3,offset); }
4747
4848/* read banked memory (handle memory mapped i/o) */
49static const read8_space_func mra_bank_soft[4] =
49static const struct { read8_space_func func; const char *name; } mra_bank_soft[4] =
5050{
51    mra_bank1,  /* mapped in 0000-3fff */
52    mra_bank2,  /* mapped in 4000-7fff */
53    mra_bank3,  /* mapped in 8000-bfff */
54    mra_bank4   /* mapped in c000-ffff */
51    { FUNC(mra_bank1) },  /* mapped in 0000-3fff */
52    { FUNC(mra_bank2) },  /* mapped in 4000-7fff */
53    { FUNC(mra_bank3) },  /* mapped in 8000-bfff */
54    { FUNC(mra_bank4) }   /* mapped in c000-ffff */
5555};
5656
5757/* write banked memory (handle memory mapped i/o and videoram) */
58static const write8_space_func mwa_bank_soft[4] =
58static const struct { write8_space_func func; const char *name; } mwa_bank_soft[4] =
5959{
60    mwa_bank1,  /* mapped in 0000-3fff */
61    mwa_bank2,  /* mapped in 4000-7fff */
62    mwa_bank3,  /* mapped in 8000-bfff */
63    mwa_bank4   /* mapped in c000-ffff */
60    { FUNC(mwa_bank1) },  /* mapped in 0000-3fff */
61    { FUNC(mwa_bank2) },  /* mapped in 4000-7fff */
62    { FUNC(mwa_bank3) },  /* mapped in 8000-bfff */
63    { FUNC(mwa_bank4) }   /* mapped in c000-ffff */
6464};
6565
6666/* read banked memory (plain ROM/RAM) */
r11224r11225
157157        /* memory mapped I/O bank selected? */
158158      if (data == 2)
159159      {
160         space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, FUNC(mra_bank_soft[offset]));
161         space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, FUNC(mwa_bank_soft[offset]));
160         space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_soft[offset].func, mra_bank_soft[offset].name);
161         space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_soft[offset].func, mwa_bank_soft[offset].name);
162162      }
163163      else
164164      {
src/mess/machine/zx.c
r11224r11225
5959DIRECT_UPDATE_HANDLER ( zx_setdirect )
6060{
6161   if (address & 0xc000)
62      zx_ula_r(*machine, address, "maincpu", 0);
62      zx_ula_r(machine, address, "maincpu", 0);
6363   return address;
6464}
6565
6666DIRECT_UPDATE_HANDLER ( pc8300_setdirect )
6767{
6868   if (address & 0xc000)
69      zx_ula_r(*machine, address, "gfx1", 0);
69      zx_ula_r(machine, address, "gfx1", 0);
7070   return address;
7171}
7272
7373DIRECT_UPDATE_HANDLER ( pow3000_setdirect )
7474{
7575   if (address & 0xc000)
76      zx_ula_r(*machine, address, "gfx1", 1);
76      zx_ula_r(machine, address, "gfx1", 1);
7777   return address;
7878}
7979
8080MACHINE_RESET ( zx80 )
8181{
8282   zx_state *state = machine.driver_data<zx_state>();
83   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(zx_setdirect, machine));
83   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(zx_setdirect), &machine));
8484   state->m_tape_bit = 0x80;
8585}
8686
8787MACHINE_RESET ( pow3000 )
8888{
8989   zx_state *state = machine.driver_data<zx_state>();
90   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(pow3000_setdirect, machine));
90   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pow3000_setdirect), &machine));
9191   state->m_tape_bit = 0x80;
9292}
9393
9494MACHINE_RESET ( pc8300 )
9595{
9696   zx_state *state = machine.driver_data<zx_state>();
97   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(pc8300_setdirect, machine));
97   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pc8300_setdirect), &machine));
9898   state->m_tape_bit = 0x80;
9999}
100100
src/mess/machine/z80ne.c
r11224r11225
169169 */
170170DIRECT_UPDATE_HANDLER( z80ne_nmi_delay_count )
171171{
172   z80ne_state *state = machine->driver_data<z80ne_state>();
172   z80ne_state *state = machine.driver_data<z80ne_state>();
173173   state->m_nmi_delay_counter--;
174174
175175   if (!state->m_nmi_delay_counter)
176176   {
177      machine->device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, *machine));
178      cputag_set_input_line(*machine, "z80ne", INPUT_LINE_NMI, PULSE_LINE);
177      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
178      cputag_set_input_line(machine, "z80ne", INPUT_LINE_NMI, PULSE_LINE);
179179   }
180180   return address;
181181}
r11224r11225
186186 */
187187DIRECT_UPDATE_HANDLER( z80ne_reset_delay_count )
188188{
189   z80ne_state *state = machine->driver_data<z80ne_state>();
190   address_space *space = machine->device("z80ne")->memory().space(AS_PROGRAM);
189   z80ne_state *state = machine.driver_data<z80ne_state>();
190   address_space *space = machine.device("z80ne")->memory().space(AS_PROGRAM);
191191   /*
192192     * TODO: when debugger is active, his memory access causes this callback
193193     *
r11224r11225
198198   if (!state->m_reset_delay_counter)
199199   {
200200      /* remove this callback */
201      machine->device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, *machine));
201      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
202202      /* and switch to RAM bank at address 0x0000 */
203      memory_set_bank( space->machine(), "bank1", 0 ); /* RAM at 0x0000 (bank 1) */
203      memory_set_bank( machine, "bank1", 0 ); /* RAM at 0x0000 (bank 1) */
204204   }
205205   return address;
206206}
r11224r11225
224224
225225   /* after the first 3 bytes have been read from ROM, switch the RAM back in */
226226   state->m_reset_delay_counter = 2;
227   space->set_direct_update_handler(direct_update_delegate_create_static(z80ne_reset_delay_count, machine));
227   space->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_reset_delay_count), &machine));
228228}
229229
230230static void reset_lx390_banking(running_machine &machine)
r11224r11225
243243       memory_set_bank(machine, "bank4", 0);  /* RAM   at 0xF000 */
244244      /* after the first 3 bytes have been read from ROM, switch the RAM back in */
245245      state->m_reset_delay_counter = 2;
246      space->set_direct_update_handler(direct_update_delegate_create_static(z80ne_reset_delay_count, machine));
246      space->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_reset_delay_count), &machine));
247247       break;
248248   case 0x02: /* EP548  16k BASIC */
249249      if (VERBOSE)
r11224r11225
252252       memory_set_bank(machine, "bank2", 1);  /* ep548 at 0x0400-0x3FFF */
253253       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
254254       memory_set_bank(machine, "bank4", 0);  /* RAM   at 0xF000 */
255      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, machine));
255      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
256256       break;
257257   case 0x03: /* EP390  Boot Loader for 5.5k floppy BASIC */
258258      if (VERBOSE)
r11224r11225
261261       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
262262       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
263263       memory_set_bank(machine, "bank4", 1);  /* ep390 at 0xF000 */
264      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, machine));
264      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
265265       break;
266266   case 0x04: /* EP1390 Boot Loader for NE DOS 1.0/1.5 */
267267      if (VERBOSE)
r11224r11225
270270       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
271271       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
272272       memory_set_bank(machine, "bank4", 2);  /* ep1390 at 0xF000 */
273      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, machine));
273      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
274274       break;
275275   case 0x05: /* EP2390 Boot Loader for NE DOS G.1 */
276276      if (VERBOSE)
r11224r11225
279279       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
280280       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
281281       memory_set_bank(machine, "bank4", 3);  /* ep2390 at 0xF000 */
282      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_default, machine));
282      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
283283       break;
284284   }
285285
r11224r11225
488488    else
489489       /* after writing to port 0xF8 and the first ~M1 cycles strike a NMI for single step execution */
490490       state->m_nmi_delay_counter = 1;
491      space->machine().device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(z80ne_nmi_delay_count, space->machine()));
491      space->machine().device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_nmi_delay_count), &space->machine()));
492492}
493493
494494
src/mess/machine/apple2gs.c
r11224r11225
16301630
16311631DIRECT_UPDATE_HANDLER( apple2gs_opbase )
16321632{
1633   apple2gs_state *state = machine->driver_data<apple2gs_state>();
1633   apple2gs_state *state = machine.driver_data<apple2gs_state>();
16341634   UINT8 *opptr = NULL;
16351635   int slot;
16361636
r11224r11225
16381638   {
16391639      if ((state->m_shadow & 0x40) && ((address & 0xF00000) == 0x000000))
16401640      {
1641         opptr = &ram_get_ptr(machine->device(RAM_TAG))[address];
1641         opptr = &ram_get_ptr(machine.device(RAM_TAG))[address];
16421642      }
16431643      else if ((address & 0x000F00) == 0x000000)
16441644      {
16451645         if (((address & 0xFF) >= 0x71) && ((address & 0xFF) <= 0x7F))
1646            opptr = apple2gs_getslotmem(*machine, address);
1646            opptr = apple2gs_getslotmem(machine, address);
16471647      }
16481648      else
16491649      {
16501650         slot = (address & 0x000F00) / 0x100;
16511651
16521652         if ((slot > 7) || ((state->m_sltromsel & (1 << slot)) == 0))
1653            opptr = apple2gs_getslotmem(*machine, address);
1653            opptr = apple2gs_getslotmem(machine, address);
16541654      }
16551655
16561656      if (opptr != NULL)
r11224r11225
17721772   space->install_legacy_write_handler(0xe0c000, 0xe0cfff, FUNC(apple2gs_E0Cxxx_w));
17731773   space->install_legacy_read_handler(0xe1c000, 0xe1cfff, FUNC(apple2gs_E1Cxxx_r));
17741774   space->install_legacy_write_handler(0xe1c000, 0xe1cfff, FUNC(apple2gs_E1Cxxx_w));
1775   space->set_direct_update_handler(direct_update_delegate_create_static(apple2gs_opbase, machine));
1775   space->set_direct_update_handler(direct_update_delegate(FUNC(apple2gs_opbase), &machine));
17761776
17771777
17781778   /* install aux memory writes (for shadowing) */
src/mess/machine/isa_hdc.c
r11224r11225
206206{           
207207   m_isa->add_isa_card(this, m_config.m_isa_num);
208208   m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, "hdc", "hdc");
209   m_isa->install_device(this, 0x0320, 0x0323, 0, 0, pc_HDC_r, pc_HDC_w );   
209   m_isa->install_device(this, 0x0320, 0x0323, 0, 0, FUNC(pc_HDC_r), FUNC(pc_HDC_w) );   
210210   buffer = auto_alloc_array(m_machine, UINT8, 17*4*512);
211   timer = m_machine.scheduler().timer_alloc(FUNC(&pc_hdc_command), this);
211   timer = m_machine.scheduler().timer_alloc(FUNC(pc_hdc_command), this);
212212}
213213
214214//-------------------------------------------------
src/mess/machine/mac.c
r11224r11225
31573157
31583158DIRECT_UPDATE_HANDLER (overlay_opbaseoverride)
31593159{
3160   mac_state *mac = machine->driver_data<mac_state>();
3160   mac_state *mac = machine.driver_data<mac_state>();
31613161
31623162   if (mac->m_overlay != -1)
31633163   {
r11224r11225
32243224       (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((mac->m_model >= MODEL_MAC_II) && (mac->m_model <= MODEL_MAC_SE30)) ||
32253225       (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100))
32263226   {
3227      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(overlay_opbaseoverride, machine));
3227      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(overlay_opbaseoverride), &machine));
32283228   }
32293229
32303230   /* setup keyboard */
src/mess/machine/mpc105.c
r11224r11225
153153
154154            if (m_bank_base > 0)
155155            {
156               address_space *space = m_maincpu->memory().space(AS_PROGRAM);
157
158               space->install_legacy_read_handler(begin, end,
159                  0, 0, FUNC((read64_space_func)(FPTR)(bank + m_bank_base)));
160               space->install_legacy_write_handler(begin, end,
161                  0, 0, FUNC((write64_space_func)(FPTR)(bank + m_bank_base)));
162156               sprintf(bank_str,"bank%d",bank + m_bank_base);
163157               memory_set_bankptr(m_machine, bank_str, ram_get_ptr(m_machine.device(RAM_TAG)));
164158            }
src/mess/machine/nes.c
r11224r11225
146146
147147   // there are still some quirk about writes to bank5... I hope to fix them soon. (mappers 34,45,52,246 have both mid_w and WRAM-->check)
148148   if (state->m_mmc_write_mid)
149      space->install_legacy_write_handler(0x6000, 0x7fff, FUNC(state->m_mmc_write_mid));
149      space->install_legacy_write_handler(0x6000, 0x7fff, state->m_mmc_write_mid,state->m_mmc_write_mid_name);
150150   if (state->m_mmc_write)
151      space->install_legacy_write_handler(0x8000, 0xffff, FUNC(state->m_mmc_write));
151      space->install_legacy_write_handler(0x8000, 0xffff, state->m_mmc_write, state->m_mmc_write_name);
152152
153153   // In fact, we also allow single pcbs to overwrite the bank read handlers defined above,
154154   // because some pcbs (mainly pirate ones) require protection values to be read instead of
155155   // the expected ROM banks: these handlers, though, must take care of the ROM access as well
156156   if (state->m_mmc_read_mid)
157      space->install_legacy_read_handler(0x6000, 0x7fff, FUNC(state->m_mmc_read_mid));
157      space->install_legacy_read_handler(0x6000, 0x7fff, state->m_mmc_read_mid,state->m_mmc_read_mid_name);
158158   if (state->m_mmc_read)
159      space->install_legacy_read_handler(0x8000, 0xffff, FUNC(state->m_mmc_read));
159      space->install_legacy_read_handler(0x8000, 0xffff, state->m_mmc_read,state->m_mmc_read_name);
160160
161161   // install additional handlers
162162   if (state->m_pcb_id == BTL_SMB2B || state->m_mapper == 50)
src/mess/machine/isa_com.c
r11224r11225
147147void isa8_com_device::device_start()
148148{       
149149   m_isa->add_isa_card(this, m_config.m_isa_num);
150   m_isa->install_device(subdevice("ins8250_0"), 0x03f8, 0x03ff, 0, 0, ins8250_r, ins8250_w );
151   m_isa->install_device(subdevice("ins8250_1"), 0x02f8, 0x02ff, 0, 0, ins8250_r, ins8250_w );
152   m_isa->install_device(subdevice("ins8250_2"), 0x03e8, 0x03ef, 0, 0, ins8250_r, ins8250_w );
153   m_isa->install_device(subdevice("ins8250_3"), 0x02e8, 0x02ef, 0, 0, ins8250_r, ins8250_w );
150   m_isa->install_device(subdevice("ins8250_0"), 0x03f8, 0x03ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
151   m_isa->install_device(subdevice("ins8250_1"), 0x02f8, 0x02ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
152   m_isa->install_device(subdevice("ins8250_2"), 0x03e8, 0x03ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
153   m_isa->install_device(subdevice("ins8250_3"), 0x02e8, 0x02ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
154154}
155155
156156//-------------------------------------------------
src/mess/machine/isa_sblaster.c
r11224r11225
150150void isa8_sblaster_device::device_start()
151151{       
152152   m_isa->add_isa_card(this, m_config.m_isa_num);
153   m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, ym3812_16_r, ym3812_16_w );
154   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, saa1099_16_r, saa1099_16_w );
155   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, saa1099_16_r, saa1099_16_w );   
153   m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
154   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
155   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );   
156156}
157157
158158//-------------------------------------------------
src/mess/machine/isa.c
r11224r11225
131131   m_isa_device[pos] = card;
132132}
133133
134void isa8_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, write8_device_func whandler)
134void isa8_device::install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name)
135135{   
136136   int buswidth = m_maincpu->memory().space_config(AS_PROGRAM)->m_databus_width;
137137   switch(buswidth)
138138   {
139139      case 8:
140         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, FUNC(rhandler), FUNC(whandler),0);
140         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
141141         break;
142142      case 16:
143         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, FUNC(rhandler), FUNC(whandler),0xffff);
143         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
144144         break;
145145      default:
146146         fatalerror("ISA8: Bus width %d not supported", buswidth);
src/mess/machine/lviv.c
r11224r11225
4848
4949DIRECT_UPDATE_HANDLER(lviv_directoverride)
5050{
51   if (input_port_read(*machine, "RESET") & 0x01)
52      machine->scheduler().timer_set(attotime::from_usec(10), FUNC(lviv_reset));
51   if (input_port_read(machine, "RESET") & 0x01)
52      machine.scheduler().timer_set(attotime::from_usec(10), FUNC(lviv_reset));
5353   return address;
5454}
5555
r11224r11225
238238   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
239239   UINT8 *mem;
240240
241   space->set_direct_update_handler(direct_update_delegate_create_static(lviv_directoverride, machine));
241   space->set_direct_update_handler(direct_update_delegate(FUNC(lviv_directoverride), &machine));
242242
243243   state->m_video_ram = ram_get_ptr(machine.device(RAM_TAG)) + 0xc000;
244244
src/mess/machine/isa.h
r11224r11225
120120        isa8_device(running_machine &_machine, const isa8_device_config &config);
121121public:
122122      void add_isa_card(device_isa8_card_interface *card,int pos);
123      void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, write8_device_func whandler);
123      void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name);
124124      void install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data);
125125      void install_rom(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, const char *region);
126126
src/mess/machine/rmnimbus.c
r11224r11225
821821   state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
822822   state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
823823   state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int));
824   state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
825   state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
826   state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC(NULL));
824   state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
825   state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
826   state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL);
827827   state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback));
828828   state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback));
829829}
src/mess/machine/isa_adlib.c
r11224r11225
114114void isa8_adlib_device::device_start()
115115{       
116116   m_isa->add_isa_card(this, m_config.m_isa_num);
117   m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, ym3812_16_r, ym3812_16_w );   
117   m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );   
118118}
119119
120120//-------------------------------------------------
src/mess/machine/apple2.c
r11224r11225
108108   char rbank[10], wbank[10];
109109   int full_update = 0;
110110   apple2_meminfo meminfo;
111   read8_space_func rh;
112   write8_space_func wh;
111   read8_space_func rh; const char *rh_name;
112   write8_space_func wh; const char *wh_name;
113113   offs_t begin, end_r, end_w;
114114   UINT8 *rbase, *wbase, *rom, *slot_ram;
115115   UINT32 rom_length, slot_length, offset;
r11224r11225
160160         {
161161            /* handler */
162162            rh = meminfo.read_handler;
163            rh_name = meminfo.read_handler_name;
163164         }
164165         else if (meminfo.read_mem == APPLE2_MEM_FLOATING)
165166         {
166167            /* floating RAM */
167168            rh = read_floatingbus;
169            rh_name = "read_floatingbus";
168170         }
169171         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX)
170172         {
r11224r11225
179181            if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
180182            {
181183               rh = apple2_c1xx_r;
184               rh_name = "apple2_c1xx_r";
182185            }
183186            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
184187            {   // slots 4-7
185188               rh = apple2_c4xx_r;
189               rh_name = "apple2_c4xx_r";
186190            }
187191         }
188192         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_ROM)
r11224r11225
204208         /* install the actual handlers */
205209         if (begin <= end_r) {
206210            if (rh) {
207               space->install_legacy_read_handler(begin, end_r, FUNC(rh));
211               space->install_legacy_read_handler(begin, end_r, rh, rh_name);
208212            } else {
209213               space->install_read_bank(begin, end_r, rbank);
210214            }
r11224r11225
247251         {
248252            /* handler */
249253            wh = meminfo.write_handler;
254            wh_name = meminfo.write_handler_name;
250255         }
251256         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX)
252257         {
r11224r11225
263268            if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
264269            {
265270               wh = apple2_c1xx_w;
271               wh_name = "apple2_c1xx_w";
266272            }
267273            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
268274            {   // slots 4-7
269275               wh = apple2_c4xx_w;
276               wh_name = "apple2_c4xx_w";
270277            }
271278         }
272279         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_ROM)
r11224r11225
288295         /* install the actual handlers */
289296         if (begin <= end_w) {
290297            if (wh) {
291               space->install_legacy_write_handler(begin, end_w, FUNC(wh));
298               space->install_legacy_write_handler(begin, end_w, wh ,wh_name);
292299            } else {
293300               if (wh_nop) {
294301                  space->nop_write(begin, end_w);
src/mess/machine/isa_gblaster.c
r11224r11225
111111void isa8_gblaster_device::device_start()
112112{       
113113   m_isa->add_isa_card(this, m_config.m_isa_num);   
114   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, saa1099_16_r, saa1099_16_w );
115   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, saa1099_16_r, saa1099_16_w );
114   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
115   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
116116}
117117
118118//-------------------------------------------------
src/mess/machine/bbc.c
r11224r11225
218218
219219DIRECT_UPDATE_HANDLER( bbcbp_direct_handler )
220220{
221   bbc_state *state = machine->driver_data<bbc_state>();
222   UINT8 *ram = machine->region("maincpu")->base();
221   bbc_state *state = machine.driver_data<bbc_state>();
222   UINT8 *ram = machine.region("maincpu")->base();
223223   if (state->m_vdusel == 0)
224224   {
225225      // not in shadow ram mode so just read normal ram
226      memory_set_bankptr(*machine, "bank2", ram + 0x3000);
226      memory_set_bankptr(machine, "bank2", ram + 0x3000);
227227   }
228228   else
229229   {
230      if (vdudriverset(*machine))
230      if (vdudriverset(machine))
231231      {
232232         // if VDUDriver set then read from shadow ram
233         memory_set_bankptr(*machine, "bank2", ram + 0xb000);
233         memory_set_bankptr(machine, "bank2", ram + 0xb000);
234234      }
235235      else
236236      {
237237         // else read from normal ram
238         memory_set_bankptr(*machine, "bank2", ram + 0x3000);
238         memory_set_bankptr(machine, "bank2", ram + 0x3000);
239239      }
240240   }
241241   return address;
r11224r11225
479479
480480DIRECT_UPDATE_HANDLER( bbcm_direct_handler )
481481{
482   bbc_state *state = machine->driver_data<bbc_state>();
482   bbc_state *state = machine.driver_data<bbc_state>();
483483   if (state->m_ACCCON_X)
484484   {
485      memory_set_bankptr( *machine, "bank2", machine->region( "maincpu" )->base() + 0xb000 );
485      memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0xb000 );
486486   }
487487   else
488488   {
489      if (state->m_ACCCON_E && bbcm_vdudriverset(*machine))
489      if (state->m_ACCCON_E && bbcm_vdudriverset(machine))
490490      {
491         memory_set_bankptr( *machine, "bank2", machine->region( "maincpu" )->base() + 0xb000 );
491         memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0xb000 );
492492      }
493493      else
494494      {
495         memory_set_bankptr( *machine, "bank2", machine->region( "maincpu" )->base() + 0x3000 );
495         memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0x3000 );
496496      }
497497   }
498498
r11224r11225
21472147   bbc_state *state = machine.driver_data<bbc_state>();
21482148   state->m_mc6850_clock = 0;
21492149
2150   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(bbcbp_direct_handler, machine));
2150   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbcbp_direct_handler), &machine));
21512151
21522152   /* bank 6 is the paged ROMs     from b000 to bfff */
21532153   memory_configure_bank(machine, "bank6", 0, 16, machine.region("user1")->base() + 0x3000, 1<<14);
r11224r11225
21752175   bbc_state *state = machine.driver_data<bbc_state>();
21762176   state->m_mc6850_clock = 0;
21772177
2178   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(bbcm_direct_handler, machine));
2178   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbcm_direct_handler), &machine));
21792179
21802180   /* bank 5 is the paged ROMs     from 9000 to bfff */
21812181   memory_configure_bank(machine, "bank5", 0, 16, machine.region("user1")->base()+0x01000, 1<<14);
src/mess/video/pc_vga_mess.c
r11224r11225
536536{
537537   address_space *space = machine.firstcpu->memory().space(AS_PROGRAM);
538538   static int sequencer, gc;
539   read8_space_func read_handler;
540   write8_space_func write_handler;
539   read8_space_func read_handler; const char *read_handler_name;
540   write8_space_func write_handler; const char *write_handler_name;
541541   read16_space_func read_handler16;
542542   write16_space_func write_handler16;
543543   read32_space_func read_handler32;
r11224r11225
554554
555555   if (vga.sequencer.data[4]&8)
556556   {
557      read_handler = vga_vga_r;
558      write_handler = vga_vga_w;
557      read_handler = vga_vga_r; read_handler_name = "vga_vga_r";
558      write_handler = vga_vga_w; write_handler_name = "vga_vga_w";
559559      read_handler16 = vga_vga16_r;
560560      write_handler16 = vga_vga16_w;
561561      read_handler32 = vga_vga32_r;
r11224r11225
565565   }
566566   else if (vga.sequencer.data[4] & 4)
567567   {
568      read_handler = vga_ega_r;
569      write_handler = vga_ega_w;
568      read_handler = vga_ega_r; read_handler_name = "vga_ega_r";
569      write_handler = vga_ega_w; read_handler_name = "vga_ega_w";
570570      read_handler16 = vga_ega16_r;
571571      write_handler16 = vga_ega16_w;
572572      read_handler32 = vga_ega32_r;
r11224r11225
576576   }
577577   else
578578   {
579      read_handler = vga_text_r;
580      write_handler = vga_text_w;
579      read_handler = vga_text_r; read_handler_name = "vga_text_r";
580      write_handler = vga_text_w; read_handler_name = "vga_text_w";
581581      read_handler16 = vga_text16_r;
582582      write_handler16 = vga_text16_w;
583583      read_handler32 = vga_text32_r;
r11224r11225
596596         case 0x00:
597597            if (vga.vga_intf.vga_memory_bank != NULL)
598598            {
599               vga.vga_intf.map_vga_memory(machine, 0xA0000, 0xBFFFF, read_handler, write_handler);
599               vga.vga_intf.map_vga_memory(machine, 0xA0000, 0xBFFFF, read_handler, read_handler_name, write_handler, write_handler_name);
600600               memory_set_bankptr(machine, vga.vga_intf.vga_memory_bank, vga.memory);
601601            }
602602            break;
603603         case 0x04:
604            vga.vga_intf.map_vga_memory(machine, 0xA0000, 0xAFFFF, read_handler, write_handler);
604            vga.vga_intf.map_vga_memory(machine, 0xA0000, 0xAFFFF, read_handler, read_handler_name, write_handler, write_handler_name);
605605            break;
606606         case 0x08:
607            vga.vga_intf.map_vga_memory(machine, 0xB0000, 0xB7FFF, read_handler, write_handler);
607            vga.vga_intf.map_vga_memory(machine, 0xB0000, 0xB7FFF, read_handler, read_handler_name, write_handler, write_handler_name);
608608            break;
609609         case 0x0C:
610            vga.vga_intf.map_vga_memory(machine, 0xB8000, 0xBFFFF, read_handler, write_handler);
610            vga.vga_intf.map_vga_memory(machine, 0xB8000, 0xBFFFF, read_handler, read_handler_name, write_handler, write_handler_name);
611611            break;
612612      }
613613   }
r11224r11225
620620            sel = vga.gc.data[6] & 0x0c;
621621            if (sel)
622622            {
623               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler) ); else space->nop_read(0xa0000, 0xaffff);
624               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler) ); else space->nop_read(0xb0000, 0xb7fff);
625               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler) ); else space->nop_read(0xb8000, 0xbffff);
626               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler)); else space->nop_write(0xa0000, 0xaffff);
627               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler)); else space->nop_write(0xb0000, 0xb7fff);
628               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler)); else space->nop_write(0xb8000, 0xbffff);
623               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler, read_handler_name ); else space->nop_read(0xa0000, 0xaffff);
624               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler, read_handler_name ); else space->nop_read(0xb0000, 0xb7fff);
625               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler, read_handler_name ); else space->nop_read(0xb8000, 0xbffff);
626               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
627               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
628               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
629629            }
630630            else
631631            {
r11224r11225
639639            sel = vga.gc.data[6] & 0x0c;
640640            if (sel)
641641            {
642               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler16) ); else space->nop_read(0xa0000, 0xaffff);
643               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler16) ); else space->nop_read(0xb0000, 0xb7fff);
644               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler16) ); else space->nop_read(0xb8000, 0xbffff);
645               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler16)); else space->nop_write(0xa0000, 0xaffff);
646               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler16)); else space->nop_write(0xb0000, 0xb7fff);
647               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler16)); else space->nop_write(0xb8000, 0xbffff);
642               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler16, read_handler_name ); else space->nop_read(0xa0000, 0xaffff);
643               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler16, read_handler_name ); else space->nop_read(0xb0000, 0xb7fff);
644               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler16, read_handler_name ); else space->nop_read(0xb8000, 0xbffff);
645               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler16, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
646               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler16, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
647               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler16, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
648648            }
649649            else
650650            {
r11224r11225
658658            sel = vga.gc.data[6] & 0x0c;
659659            if (sel)
660660            {
661               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler32) ); else space->nop_read(0xa0000, 0xaffff);
662               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler32) ); else space->nop_read(0xb0000, 0xb7fff);
663               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler32) ); else space->nop_read(0xb8000, 0xbffff);
664               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler32)); else space->nop_write(0xa0000, 0xaffff);
665               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler32)); else space->nop_write(0xb0000, 0xb7fff);
666               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler32)); else space->nop_write(0xb8000, 0xbffff);
661               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler32, read_handler_name ); else space->nop_read(0xa0000, 0xaffff);
662               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler32, read_handler_name ); else space->nop_read(0xb0000, 0xb7fff);
663               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler32, read_handler_name ); else space->nop_read(0xb8000, 0xbffff);
664               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler32, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
665               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler32, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
666               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler32, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
667667            }
668668            else
669669            {
r11224r11225
677677            sel = vga.gc.data[6] & 0x0c;
678678            if (sel)
679679            {
680               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, FUNC(read_handler64) ); else space->nop_read(0xa0000, 0xaffff);
681               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, FUNC(read_handler64) ); else space->nop_read(0xb0000, 0xb7fff);
682               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, FUNC(read_handler64) ); else space->nop_read(0xb8000, 0xbffff);
683               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, FUNC(write_handler64)); else space->nop_write(0xa0000, 0xaffff);
684               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, FUNC(write_handler64)); else space->nop_write(0xb0000, 0xb7fff);
685               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, FUNC(write_handler64)); else space->nop_write(0xb8000, 0xbffff);
680               if (sel == 0x04) space->install_legacy_read_handler(0xa0000, 0xaffff, read_handler64, read_handler_name ); else space->nop_read(0xa0000, 0xaffff);
681               if (sel == 0x08) space->install_legacy_read_handler(0xb0000, 0xb7fff, read_handler64, read_handler_name ); else space->nop_read(0xb0000, 0xb7fff);
682               if (sel == 0x0C) space->install_legacy_read_handler(0xb8000, 0xbffff, read_handler64, read_handler_name ); else space->nop_read(0xb8000, 0xbffff);
683               if (sel == 0x04) space->install_legacy_write_handler(0xa0000, 0xaffff, write_handler64, write_handler_name); else space->nop_write(0xa0000, 0xaffff);
684               if (sel == 0x08) space->install_legacy_write_handler(0xb0000, 0xb7fff, write_handler64, write_handler_name); else space->nop_write(0xb0000, 0xb7fff);
685               if (sel == 0x0C) space->install_legacy_write_handler(0xb8000, 0xbffff, write_handler64, write_handler_name); else space->nop_write(0xb8000, 0xbffff);
686686            }
687687            else
688688            {
src/mess/video/pc_vga_mess.h
r11224r11225
2222{
2323   /* VGA memory mapper */
2424   const char *vga_memory_bank;
25   void (*map_vga_memory)(running_machine &machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh);
25   void (*map_vga_memory)(running_machine &machine, offs_t begin, offs_t end, read8_space_func rh, const char *rh_name, write8_space_func wh, const char *wh_name);
2626
2727   /* VGA dipswitch (???) */
2828   read8_space_func read_dipswitch;
src/mess/video/isa_mda.c
r11224r11225
206206{       
207207   m_isa->add_isa_card(this, m_config.m_isa_num);
208208   videoram = auto_alloc_array(m_machine, UINT8, 0x1000);
209   m_isa->install_device(this, 0x3b0, 0x3bf, 0, 0, pc_MDA_r, pc_MDA_w );
209   m_isa->install_device(this, 0x3b0, 0x3bf, 0, 0, FUNC(pc_MDA_r), FUNC(pc_MDA_w) );
210210   m_isa->install_bank(0xb0000, 0xb0fff, 0, 0x07000, "bank_mda", videoram);   
211211   
212212   /* Initialise the mda palette */
r11224r11225
655655{       
656656   videoram = auto_alloc_array(m_machine, UINT8, 0x10000);
657657
658   m_isa->install_device(this, 0x3b0, 0x3bf, 0, 0, hercules_r, hercules_w );
658   m_isa->install_device(this, 0x3b0, 0x3bf, 0, 0, FUNC(hercules_r), FUNC(hercules_w) );
659659   m_isa->install_bank(0xb0000, 0xbffff, 0, 0, "bank_hercules", videoram);
660660
661661   /* Initialise the mda palette */
src/mess/video/cirrus.c
r11224r11225
184184{
185185}
186186
187static void bebox_map_vga_memory(running_machine &machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh)
187static void bebox_map_vga_memory(running_machine &machine, offs_t begin, offs_t end, read8_space_func rh, const char *rh_name, write8_space_func wh, const char *wh_name )
188188{
189189   address_space *space = machine.device("ppc1")->memory().space(AS_PROGRAM);
190190
src/mess/video/thomson.c
r11224r11225
11531153   state_save_register_global(machine,  thom_floppy_rcount );
11541154   output_set_value( "floppy", 0 );
11551155
1156   thom_video_timer = machine.scheduler().timer_alloc(FUNC(NULL));
1156   thom_video_timer = machine.scheduler().timer_alloc(FUNC_NULL);
11571157
11581158   thom_scanline_timer = machine.scheduler().timer_alloc(FUNC(thom_scanline_start));
11591159
src/mess/video/ibm_vga.c
r11224r11225
330330   switch(buswidth)
331331   {
332332      case 8:
333         spaceio->install_readwrite_handler(0x3b0, 0x3bf, read8_delegate_create(ibm_vga_device,vga_port_03b0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03b0_w, *this));
334         spaceio->install_readwrite_handler(0x3c0, 0x3cf, read8_delegate_create(ibm_vga_device,vga_port_03c0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03c0_w, *this));
335         spaceio->install_readwrite_handler(0x3d0, 0x3df, read8_delegate_create(ibm_vga_device,vga_port_03d0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03d0_w, *this));
333         spaceio->install_readwrite_handler(0x3b0, 0x3bf, read8_delegate(FUNC(ibm_vga_device::vga_port_03b0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03b0_w), this));
334         spaceio->install_readwrite_handler(0x3c0, 0x3cf, read8_delegate(FUNC(ibm_vga_device::vga_port_03c0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03c0_w), this));
335         spaceio->install_readwrite_handler(0x3d0, 0x3df, read8_delegate(FUNC(ibm_vga_device::vga_port_03d0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03d0_w), this));
336336         break;
337337
338338      case 16:
339         spaceio->install_readwrite_handler(0x3b0, 0x3bf, read8_delegate_create(ibm_vga_device,vga_port_03b0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03b0_w, *this), 0xffff);
340         spaceio->install_readwrite_handler(0x3c0, 0x3cf, read8_delegate_create(ibm_vga_device,vga_port_03c0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03c0_w, *this), 0xffff);
341         spaceio->install_readwrite_handler(0x3d0, 0x3df, read8_delegate_create(ibm_vga_device,vga_port_03d0_r, *this), write8_delegate_create(ibm_vga_device,vga_port_03d0_w, *this), 0xffff);
339         spaceio->install_readwrite_handler(0x3b0, 0x3bf, read8_delegate(FUNC(ibm_vga_device::vga_port_03b0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03b0_w), this), 0xffff);
340         spaceio->install_readwrite_handler(0x3c0, 0x3cf, read8_delegate(FUNC(ibm_vga_device::vga_port_03c0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03c0_w), this), 0xffff);
341         spaceio->install_readwrite_handler(0x3d0, 0x3df, read8_delegate(FUNC(ibm_vga_device::vga_port_03d0_r), this), write8_delegate(FUNC(ibm_vga_device::vga_port_03d0_w), this), 0xffff);
342342         break;
343343
344344      case 32:
src/mess/includes/hp48.h
r11224r11225
2525   /* static part */
2626   UINT32 off_mask;             /* offset bit-mask, indicates the real size */
2727   read8_space_func read;
28   const char *read_name;
2829   write8_space_func write;
30   const char *write_name;
2931   void* data;                  /* non-NULL for banks */
3032   int isnop;
3133
src/mess/includes/nes.h
r11224r11225
109109
110110   /* misc */
111111   write8_space_func   m_mmc_write_low;
112   const char        *m_mmc_write_low_name;
112113   write8_space_func   m_mmc_write_mid;
114   const char        *m_mmc_write_mid_name;
113115   write8_space_func   m_mmc_write;
116   const char        *m_mmc_write_name;
114117   read8_space_func    m_mmc_read_low;
118   const char        *m_mmc_read_low_name;
115119   read8_space_func    m_mmc_read_mid;
120   const char        *m_mmc_read_mid_name;
116121   read8_space_func    m_mmc_read;
122   const char        *m_mmc_read_name;
117123   emu_timer           *m_irq_timer;
118124
119125   nes_prg_callback    m_mmc3_prg_cb;   // these are used to simplify a lot emulation of some MMC3 pirate clones
src/mess/includes/genpc.h
r11224r11225
6868        // device-level overrides
6969        virtual void device_start();
7070        virtual void device_reset();
71      void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, write8_device_func whandler);
72      void install_device_write(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_device_func whandler);
71      void install_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name);
72      void install_device_write(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, write8_device_func whandler, const char *whandler_name);
7373private:
7474        // internal state
7575        const ibm5160_mb_device_config &m_config;
src/mess/includes/apple2.h
r11224r11225
7979{
8080   UINT32 read_mem;
8181   read8_space_func read_handler;
82   const char *read_handler_name;
8283   UINT32 write_mem;
8384   write8_space_func write_handler;
85   const char *write_handler_name;
8486};
8587
8688typedef struct _apple2_memmap_entry apple2_memmap_entry;
src/mess/drivers/vip.c
r11224r11225
625625      break;
626626
627627   case VIDEO_CDP1862:
628      io->install_write_handler(0x05, 0x05, write8_delegate_create(vip_state, bkg_w, *this));
629      program->install_write_handler(0xc000, 0xdfff, write8_delegate_create(vip_state, colorram_w, *this));
628      io->install_write_handler(0x05, 0x05, write8_delegate(FUNC(vip_state::bkg_w), this));
629      program->install_write_handler(0xc000, 0xdfff, write8_delegate(FUNC(vip_state::colorram_w), this));
630630      break;
631631   }
632632
src/mess/drivers/elf.c
r11224r11225
253253
254254   /* setup memory banking */
255255   program->install_read_bank(0x0000, 0x00ff, "bank1");
256   program->install_write_handler(0x0000, 0x00ff, write8_delegate_create(elf2_state, memory_w, *this));
256   program->install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this));
257257   memory_configure_bank(m_machine, "bank1", 0, 1, ram_get_ptr(m_ram), 0);
258258   memory_set_bank(m_machine, "bank1", 0);
259259
src/mess/drivers/mc1000.c
r11224r11225
511511
512512DIRECT_UPDATE_HANDLER( mc1000_direct_update_handler )
513513{
514   mc1000_state *state = machine->driver_data<mc1000_state>();
514   mc1000_state *state = machine.driver_data<mc1000_state>();
515515
516516   if (state->m_rom0000)
517517   {
518518      if (address >= 0xc000)
519519      {
520         memory_set_bank(*machine, "bank1", 0);
520         memory_set_bank(machine, "bank1", 0);
521521         state->m_rom0000 = 0;
522522      }
523523   }
r11224r11225
527527
528528static DRIVER_INIT( mc1000 )
529529{
530   machine.device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(mc1000_direct_update_handler, machine));
530   machine.device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(mc1000_direct_update_handler), &machine));
531531}
532532
533533/* System Drivers */
src/mess/drivers/tm990189.c
r11224r11225
105105static MACHINE_START( tm990_189 )
106106{
107107   tm990189_state *state = machine.driver_data<tm990189_state>();
108   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC(NULL));
108   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC_NULL);
109109}
110110static const TMS9928a_interface tms9918_interface =
111111{
r11224r11225
120120   tm990189_state *state = machine.driver_data<tm990189_state>();
121121   TMS9928A_configure(&tms9918_interface);
122122
123   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC(NULL));
123   state->m_displayena_timer = machine.scheduler().timer_alloc(FUNC_NULL);
124124
125   state->m_joy1x_timer = machine.scheduler().timer_alloc(FUNC(NULL));
126   state->m_joy1y_timer = machine.scheduler().timer_alloc(FUNC(NULL));
127   state->m_joy2x_timer = machine.scheduler().timer_alloc(FUNC(NULL));
128   state->m_joy2y_timer = machine.scheduler().timer_alloc(FUNC(NULL));
125   state->m_joy1x_timer = machine.scheduler().timer_alloc(FUNC_NULL);
126   state->m_joy1y_timer = machine.scheduler().timer_alloc(FUNC_NULL);
127   state->m_joy2x_timer = machine.scheduler().timer_alloc(FUNC_NULL);
128   state->m_joy2y_timer = machine.scheduler().timer_alloc(FUNC_NULL);
129129}
130130
131131static MACHINE_RESET( tm990_189_v )
src/mess/drivers/scorpion.c
r11224r11225
231231
232232DIRECT_UPDATE_HANDLER( scorpion_direct )
233233{
234   spectrum_state *state = machine->driver_data<spectrum_state>();
235   device_t *beta = machine->device(BETA_DISK_TAG);
236   UINT16 pc = cpu_get_reg(machine->device("maincpu"), STATE_GENPCBASE);
237   address_space *space = machine->device("maincpu")->memory().space(AS_PROGRAM);
238
234   spectrum_state *state = machine.driver_data<spectrum_state>();
235   device_t *beta = machine.device(BETA_DISK_TAG);
236   UINT16 pc = cpu_get_reg(machine.device("maincpu"), STATE_GENPCBASE);
237   
239238   state->m_ram_disabled_by_beta = 0;
240239   if (betadisk_is_active(beta))
241240   {
r11224r11225
244243         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
245244         betadisk_disable(beta);
246245         state->m_ram_disabled_by_beta = 1;
247         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
246         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
248247      }
249248   }
250249   else if (((pc & 0xff00) == 0x3d00) && (state->m_ROMSelection==1))
r11224r11225
255254   if((address>=0x0000) && (address<=0x3fff))
256255   {
257256      state->m_ram_disabled_by_beta = 1;
258      direct.explicit_configure(0x0000, 0x3fff, 0x3fff, space->machine().region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
259      memory_set_bankptr(*machine, "bank1", space->machine().region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
257      direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
258      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
260259      return ~0;
261260   }
262261   return address;
r11224r11225
329328
330329   betadisk_disable(beta);
331330   betadisk_clear_status(beta);
332   space->set_direct_update_handler(direct_update_delegate_create_static(scorpion_direct, machine));
331   space->set_direct_update_handler(direct_update_delegate(FUNC(scorpion_direct), &machine));
333332
334333   memset(messram,0,256*1024);
335334
src/mess/drivers/spectrum.c
r11224r11225
326326{
327327    /* Hack for correct handling 0xffff interrupt vector */
328328    if (address == 0x0001)
329        if (cpu_get_reg(machine->device("maincpu"), STATE_GENPCBASE)==0xffff)
329        if (cpu_get_reg(machine.device("maincpu"), STATE_GENPCBASE)==0xffff)
330330        {
331            cpu_set_reg(machine->device("maincpu"), Z80_PC, 0xfff4);
331            cpu_set_reg(machine.device("maincpu"), Z80_PC, 0xfff4);
332332            return 0xfff4;
333333        }
334334    return address;
r11224r11225
638638   spectrum_state *state = machine.driver_data<spectrum_state>();
639639   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
640640
641   space->set_direct_update_handler(direct_update_delegate_create_static(spectrum_direct, machine));
641   space->set_direct_update_handler(direct_update_delegate(FUNC(spectrum_direct), &machine));
642642
643643   state->m_port_7ffd_data = -1;
644644   state->m_port_1ffd_data = -1;
src/mess/drivers/mpf1.c
r11224r11225
463463
464464DIRECT_UPDATE_HANDLER( mpf1_direct_update_handler )
465465{
466   mpf1_state *state = machine->driver_data<mpf1_state>();
466   mpf1_state *state = machine.driver_data<mpf1_state>();
467467
468468   if (!state->m_break)
469469   {
r11224r11225
482482{
483483   mpf1_state *state = machine.driver_data<mpf1_state>();
484484
485   state->m_maincpu->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(mpf1_direct_update_handler, machine));
485   state->m_maincpu->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(mpf1_direct_update_handler), &machine));
486486}
487487
488488COMP( 1979, mpf1,  0,    0, mpf1, mpf1,  mpf1, "Multitech", "Micro Professor 1", 0)
src/mess/drivers/sg1000.c
r11224r11225
805805   default:
806806      if (IS_CARTRIDGE_TV_DRAW(ptr))
807807      {
808         program->install_write_handler(0x6000, 0x6000, 0, 0, write8_delegate_create(sg1000_state, tvdraw_axis_w, *this), 0);
809         program->install_read_handler(0x8000, 0x8000, 0, 0, read8_delegate_create(sg1000_state, tvdraw_status_r, *this), 0);
810         program->install_read_handler(0xa000, 0xa000, 0, 0, read8_delegate_create(sg1000_state, tvdraw_data_r, *this), 0);
808         program->install_write_handler(0x6000, 0x6000, 0, 0, write8_delegate(FUNC(sg1000_state::tvdraw_axis_w), this), 0);
809         program->install_read_handler(0x8000, 0x8000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_status_r), this), 0);
810         program->install_read_handler(0xa000, 0xa000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_data_r), this), 0);
811811         program->nop_write(0xa000, 0xa000);
812812      }
813813      else if (IS_CARTRIDGE_THE_CASTLE(ptr))
src/mess/drivers/a2600.c
r11224r11225
818818{
819819   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 )
820820   {
821      modeF6_switch_w( machine->device("maincpu")->memory().space(AS_PROGRAM), ( address & 0x1FFF ) - 0x1FF6, 0 );
821      modeF6_switch_w( machine.device("maincpu")->memory().space(AS_PROGRAM), ( address & 0x1FFF ) - 0x1FF6, 0 );
822822   }
823823   return address;
824824}
825825
826826DIRECT_UPDATE_HANDLER( modeSS_opbase )
827827{
828   a2600_state *state = machine->driver_data<a2600_state>();
828   a2600_state *state = machine.driver_data<a2600_state>();
829829   if ( address & 0x1000 )
830830   {
831831      if ( address & 0x800 )
r11224r11225
10111011
10121012DIRECT_UPDATE_HANDLER(modeDPC_opbase_handler)
10131013{
1014   a2600_state *state = machine->driver_data<a2600_state>();
1014   a2600_state *state = machine.driver_data<a2600_state>();
10151015   UINT8   new_bit;
10161016   new_bit = ( state->m_dpc.shift_reg & 0x80 ) ^ ( ( state->m_dpc.shift_reg & 0x20 ) << 2 );
10171017   new_bit = new_bit ^ ( ( ( state->m_dpc.shift_reg & 0x10 ) << 3 ) ^ ( ( state->m_dpc.shift_reg & 0x08 ) << 4 ) );
r11224r11225
11621162
11631163DIRECT_UPDATE_HANDLER(modeFE_opbase_handler)
11641164{
1165   a2600_state *state = machine->driver_data<a2600_state>();
1165   a2600_state *state = machine.driver_data<a2600_state>();
11661166   if ( ! state->m_FETimer )
11671167   {
11681168      /* Still cheating a bit here by looking bit 13 of the address..., but the high byte of the
11691169           cpu should be the last byte that was on the data bus and so should determine the bank
11701170           we should switch in. */
1171      state->m_bank_base[1] = machine->region("user1")->base() + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1172      memory_set_bankptr(*machine, "bank1", state->m_bank_base[1] );
1171      state->m_bank_base[1] = machine.region("user1")->base() + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1172      memory_set_bankptr(machine, "bank1", state->m_bank_base[1] );
11731173      /* and restore old opbase handler */
1174      machine->device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(FE_old_opbase_handler);
1174      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(FE_old_opbase_handler);
11751175   }
11761176   else
11771177   {
r11224r11225
11891189       should be the last byte that was on the data bus
11901190    */
11911191   state->m_FETimer = 1;
1192   FE_old_opbase_handler = space->set_direct_update_handler(direct_update_delegate_create_static(modeFE_opbase_handler, machine));
1192   FE_old_opbase_handler = space->set_direct_update_handler(direct_update_delegate(FUNC(modeFE_opbase_handler), &machine));
11931193}
11941194
11951195static READ8_HANDLER(modeFE_switch_r)
r11224r11225
18961896   case modeF6:
18971897      space->install_legacy_write_handler(0x1ff6, 0x1ff9, FUNC(modeF6_switch_w));
18981898      space->install_legacy_read_handler(0x1ff6, 0x1ff9, FUNC(modeF6_switch_r));
1899      space->set_direct_update_handler(direct_update_delegate_create_static(modeF6_opbase, machine));
1899      space->set_direct_update_handler(direct_update_delegate(FUNC(modeF6_opbase), &machine));
19001900      break;
19011901
19021902   case modeF4:
r11224r11225
19511951      memory_set_bankptr(machine, "bank2", state->m_bank_base[2] );
19521952      state->m_modeSS_write_enabled = 0;
19531953      state->m_modeSS_byte_started = 0;
1954      space->set_direct_update_handler(direct_update_delegate_create_static(modeSS_opbase, machine));
1954      space->set_direct_update_handler(direct_update_delegate(FUNC(modeSS_opbase), &machine));
19551955      /* The Supercharger has no motor control so just enable it */
19561956      cassette_change_state( machine.device("cassette"), CASSETTE_MOTOR_ENABLED, CASSETTE_MOTOR_DISABLED );
19571957      break;
r11224r11225
19661966      space->install_legacy_write_handler(0x1040, 0x107f, FUNC(modeDPC_w));
19671967      space->install_legacy_write_handler(0x1ff8, 0x1ff9, FUNC(modeF8_switch_w));
19681968      space->install_legacy_read_handler(0x1ff8, 0x1ff9, FUNC(modeF8_switch_r));
1969      space->set_direct_update_handler(direct_update_delegate_create_static(modeDPC_opbase_handler, machine));
1969      space->set_direct_update_handler(direct_update_delegate(FUNC(modeDPC_opbase_handler), &machine));
19701970      {
19711971         int   data_fetcher;
19721972         for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ )
src/mess/drivers/ql.c
r11224r11225
975975      case DISK_TYPE_SANDY :
976976         logerror("Configuring SandySuperDisk\n");
977977         program->install_rom(0x0c0000, 0x0c3fff, &m_machine.region(M68008_TAG)->base()[SANDY_ROM_BASE]);
978         program->install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate_create(ql_state, disk_io_r, *this));
979         program->install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate_create(ql_state, disk_io_w, *this));
978         program->install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
979         program->install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
980980         m_disk_io_base=SANDY_IO_BASE;
981981         break;
982982      case DISK_TYPE_TRUMP :
983983         logerror("Configuring TrumpCard\n");
984         program->install_read_handler(CART_ROM_BASE, CART_ROM_END, 0, 0, read8_delegate_create(ql_state, cart_rom_r, *this));
985         program->install_read_handler(TRUMP_ROM_BASE, TRUMP_ROM_END, 0, 0, read8_delegate_create(ql_state, trump_card_rom_r, *this));
986         program->install_read_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, read8_delegate_create(ql_state, disk_io_r, *this));
987         program->install_write_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, write8_delegate_create(ql_state, disk_io_w, *this));
984         program->install_read_handler(CART_ROM_BASE, CART_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::cart_rom_r), this));
985         program->install_read_handler(TRUMP_ROM_BASE, TRUMP_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::trump_card_rom_r), this));
986         program->install_read_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
987         program->install_write_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
988988         m_disk_io_base=TRUMP_IO_BASE;
989989         break;
990990   }
src/mess/drivers/abc80x.c
r11224r11225
414414
415415               program->install_read_bank(0x7000, 0x77ff, bank_name);
416416               program->unmap_write(0x7000, 0x77ff);
417               program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate_create(abc806_state, charram_r, *this), write8_delegate_create(abc806_state, charram_w, *this));
417               program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r),this), write8_delegate(FUNC(abc806_state::charram_w),this));
418418               memory_set_bank(m_machine, bank_name, 0);
419419               break;
420420
r11224r11225
449449         if (start_addr == 0x7000)
450450         {
451451            program->install_readwrite_bank(0x7000, 0x77ff, bank_name);
452            program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate_create(abc806_state, charram_r, *this), write8_delegate_create(abc806_state, charram_w, *this));
452            program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r), this), write8_delegate(FUNC(abc806_state::charram_w), this));
453453         }
454454         else
455455         {
r11224r11225
17861786
17871787DIRECT_UPDATE_HANDLER( abc800c_direct_update_handler )
17881788{
1789   abc800_state *state = machine->driver_data<abc800_state>();
1789   abc800_state *state = machine.driver_data<abc800_state>();
17901790
17911791   if (address >= 0x7c00 && address < 0x8000)
17921792   {
1793      direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, machine->region(Z80_TAG)->base() + 0x7c00);
1793      direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, machine.region(Z80_TAG)->base() + 0x7c00);
17941794
17951795      if (!state->m_fetch_charram)
17961796      {
r11224r11225
18131813static DRIVER_INIT( abc800c )
18141814{
18151815   address_space *program = machine.device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
1816   program->set_direct_update_handler(direct_update_delegate_create_static(abc800c_direct_update_handler, machine));
1816   program->set_direct_update_handler(direct_update_delegate(FUNC(abc800c_direct_update_handler), &machine));
18171817}
18181818
18191819
r11224r11225
18231823
18241824DIRECT_UPDATE_HANDLER( abc800m_direct_update_handler )
18251825{
1826   abc800_state *state = machine->driver_data<abc800_state>();
1826   abc800_state *state = machine.driver_data<abc800_state>();
18271827
18281828   if (address >= 0x7800 && address < 0x8000)
18291829   {
1830      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine->region(Z80_TAG)->base() + 0x7800);
1830      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine.region(Z80_TAG)->base() + 0x7800);
18311831
18321832      if (!state->m_fetch_charram)
18331833      {
r11224r11225
18501850static DRIVER_INIT( abc800m )
18511851{
18521852   address_space *program = machine.device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
1853   program->set_direct_update_handler(direct_update_delegate_create_static(abc800m_direct_update_handler, machine));
1853   program->set_direct_update_handler(direct_update_delegate(FUNC(abc800m_direct_update_handler), &machine));
18541854}
18551855
18561856
r11224r11225
18601860
18611861DIRECT_UPDATE_HANDLER( abc802_direct_update_handler )
18621862{
1863   abc802_state *state = machine->driver_data<abc802_state>();
1863   abc802_state *state = machine.driver_data<abc802_state>();
18641864
18651865   if (state->m_lrs)
18661866   {
18671867      if (address >= 0x7800 && address < 0x8000)
18681868      {
1869         direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine->region(Z80_TAG)->base() + 0x7800);
1869         direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine.region(Z80_TAG)->base() + 0x7800);
18701870         return ~0;
18711871      }
18721872   }
r11224r11225
18771877static DRIVER_INIT( abc802 )
18781878{
18791879   address_space *program = machine.device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
1880   program->set_direct_update_handler(direct_update_delegate_create_static(abc802_direct_update_handler, machine));
1880   program->set_direct_update_handler(direct_update_delegate(FUNC(abc802_direct_update_handler), &machine));
18811881}
18821882
18831883
r11224r11225
18871887
18881888DIRECT_UPDATE_HANDLER( abc806_direct_update_handler )
18891889{
1890   abc806_state *state = machine->driver_data<abc806_state>();
1890   abc806_state *state = machine.driver_data<abc806_state>();
18911891
18921892   if (address >= 0x7800 && address < 0x8000)
18931893   {
1894      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine->region(Z80_TAG)->base() + 0x7800);
1894      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine.region(Z80_TAG)->base() + 0x7800);
18951895
18961896      if (!state->m_fetch_charram)
18971897      {
r11224r11225
19141914static DRIVER_INIT( abc806 )
19151915{
19161916   address_space *program = machine.device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
1917   program->set_direct_update_handler(direct_update_delegate_create_static(abc806_direct_update_handler, machine));
1917   program->set_direct_update_handler(direct_update_delegate(FUNC(abc806_direct_update_handler), &machine));
19181918}
19191919
19201920
src/mess/drivers/psx.c
r11224r11225
420420
421421DIRECT_UPDATE_HANDLER( psx_setopbase )
422422{
423   psx1_state *state = machine->driver_data<psx1_state>();
423   psx1_state *state = machine.driver_data<psx1_state>();
424424   if( address == 0x80030000 )
425425   {
426      device_t *cpu = machine->device("maincpu");
426      device_t *cpu = machine.device("maincpu");
427427
428      machine->device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(psx_default, *machine));
428      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(psx_default), &machine));
429429
430430      if( load_psxexe( cpu, state->m_exe_buffer, state->m_exe_size ) ||
431431         load_cpe( cpu, state->m_exe_buffer, state->m_exe_size ) ||
r11224r11225
464464      return IMAGE_INIT_FAIL;
465465   }
466466   state->m_exe_size = quickload_size;
467   space->set_direct_update_handler(direct_update_delegate_create_static(psx_setopbase, image.device().machine()));
467   space->set_direct_update_handler(direct_update_delegate(FUNC(psx_setopbase), &image.device().machine()));
468468
469469   return IMAGE_INIT_PASS;
470470}
src/mess/drivers/tiki100.c
r11224r11225
5555      else
5656      {
5757         /* GFXRAM, GFXRAM, RAM */
58         program->install_readwrite_handler(0x0000, 0x7fff, read8_delegate_create(tiki100_state, gfxram_r, *this), write8_delegate_create(tiki100_state, gfxram_w, *this));
58         program->install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(tiki100_state::gfxram_r), this), write8_delegate(FUNC(tiki100_state::gfxram_w), this));
5959         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
6060
6161         memory_set_bank(m_machine, "bank1", BANK_VIDEO_RAM);
src/mess/drivers/atm.c
r11224r11225
2121
2222DIRECT_UPDATE_HANDLER( atm_direct )
2323{
24   spectrum_state *state = machine->driver_data<spectrum_state>();
25   device_t *beta = machine->device(BETA_DISK_TAG);
26   UINT16 pc = cpu_get_reg(machine->device("maincpu"), STATE_GENPCBASE);
24   spectrum_state *state = machine.driver_data<spectrum_state>();
25   device_t *beta = machine.device(BETA_DISK_TAG);
26   UINT16 pc = cpu_get_reg(machine.device("maincpu"), STATE_GENPCBASE);
2727
2828   if (beta->started() && betadisk_is_active(beta))
2929   {
r11224r11225
3131      {
3232         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
3333         betadisk_disable(beta);
34         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
34         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
3535      }
3636   }
3737   else if (((pc & 0xff00) == 0x3d00) && (state->m_ROMSelection==1))
r11224r11225
4444   if((address>=0x0000) && (address<=0x3fff))
4545   {
4646      if (state->m_ROMSelection == 3) {
47         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine->region("maincpu")->base() + 0x018000);
48         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x018000);
47         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x018000);
48         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x018000);
4949      } else {
50         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
51         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
50         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
51         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
5252      }
5353      return ~0;
5454   }
r11224r11225
119119      betadisk_enable(beta);
120120      betadisk_clear_status(beta);
121121   }
122   space->set_direct_update_handler(direct_update_delegate_create_static(atm_direct, machine));
122   space->set_direct_update_handler(direct_update_delegate(FUNC(atm_direct), &machine));
123123
124124   memset(messram,0,128*1024);
125125
src/mess/drivers/vcs80.c
r11224r11225
241241
242242DIRECT_UPDATE_HANDLER( vcs80_direct_update_handler )
243243{
244   vcs80_state *state = machine->driver_data<vcs80_state>();
244   vcs80_state *state = machine.driver_data<vcs80_state>();
245245
246246   /* _A0 is connected to PIO PB7 */
247247   z80pio_pb_w(state->m_z80pio, 0, (!BIT(address, 0)) << 7);
r11224r11225
251251
252252static DRIVER_INIT( vcs80 )
253253{
254   machine.device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(vcs80_direct_update_handler, machine));
255   machine.device(Z80_TAG)->memory().space(AS_IO)->set_direct_update_handler(direct_update_delegate_create_static(vcs80_direct_update_handler, machine));
254   machine.device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(vcs80_direct_update_handler), &machine));
255   machine.device(Z80_TAG)->memory().space(AS_IO)->set_direct_update_handler(direct_update_delegate(FUNC(vcs80_direct_update_handler), &machine));
256256}
257257
258258/* System Drivers */
src/mess/drivers/pentagon.c
r11224r11225
1111
1212DIRECT_UPDATE_HANDLER( pentagon_direct )
1313{
14   spectrum_state *state = machine->driver_data<spectrum_state>();
15   device_t *beta = machine->device(BETA_DISK_TAG);
16   UINT16 pc = cpu_get_reg(machine->device("maincpu"), STATE_GENPCBASE);
14   spectrum_state *state = machine.driver_data<spectrum_state>();
15   device_t *beta = machine.device(BETA_DISK_TAG);
16   UINT16 pc = cpu_get_reg(machine.device("maincpu"), STATE_GENPCBASE);
1717
1818   if (beta->started() && betadisk_is_active(beta))
1919   {
r11224r11225
2121      {
2222         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
2323         betadisk_disable(beta);
24         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
24         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
2525      }
2626   } else if (((pc & 0xff00) == 0x3d00) && (state->m_ROMSelection==1))
2727   {
r11224r11225
3434   {
3535      if (state->m_ROMSelection == 3) {
3636         if (beta->started()) {
37            direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine->region("beta:beta")->base());
38            memory_set_bankptr(*machine, "bank1", machine->region("beta:beta")->base());
37            direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("beta:beta")->base());
38            memory_set_bankptr(machine, "bank1", machine.region("beta:beta")->base());
3939         }
4040      } else {
41         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
42         memory_set_bankptr(*machine, "bank1", machine->region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
41         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
42         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
4343      }
4444      return ~0;
4545   }
r11224r11225
114114      betadisk_enable(beta);
115115      betadisk_clear_status(beta);
116116   }
117   space->set_direct_update_handler(direct_update_delegate_create_static(pentagon_direct, machine));
117   space->set_direct_update_handler(direct_update_delegate(FUNC(pentagon_direct), &machine));
118118
119119   memset(messram,0,128*1024);
120120
src/mess/drivers/pcw16.c
r11224r11225
250250   return pcw16_flash1_bank_handler_r(space->machine(),3, offset);
251251}
252252
253static const read8_space_func pcw16_flash0_bank_handlers_r[4] =
253static const struct { read8_space_func func; const char *name; } pcw16_flash0_bank_handlers_r[4] =
254254{
255   pcw16_flash0_bank_handler0_r,
256   pcw16_flash0_bank_handler1_r,
257   pcw16_flash0_bank_handler2_r,
258   pcw16_flash0_bank_handler3_r,
255   { FUNC(pcw16_flash0_bank_handler0_r) },
256   { FUNC(pcw16_flash0_bank_handler1_r) },
257   { FUNC(pcw16_flash0_bank_handler2_r) },
258   { FUNC(pcw16_flash0_bank_handler3_r) }
259259};
260260
261static const read8_space_func pcw16_flash1_bank_handlers_r[4] =
261static const struct { read8_space_func func; const char *name; } pcw16_flash1_bank_handlers_r[4] =
262262{
263   pcw16_flash1_bank_handler0_r,
264   pcw16_flash1_bank_handler1_r,
265   pcw16_flash1_bank_handler2_r,
266   pcw16_flash1_bank_handler3_r,
263   { FUNC(pcw16_flash1_bank_handler0_r) },
264   { FUNC(pcw16_flash1_bank_handler1_r) },
265   { FUNC(pcw16_flash1_bank_handler2_r) },
266   { FUNC(pcw16_flash1_bank_handler3_r) }
267267};
268268
269269/* write flash0 */
r11224r11225
333333   pcw16_flash1_bank_handler_w(space->machine(),3, offset, data);
334334}
335335
336static const write8_space_func pcw16_flash0_bank_handlers_w[4] =
336static const struct { write8_space_func func; const char *name; } pcw16_flash0_bank_handlers_w[4] =
337337{
338   pcw16_flash0_bank_handler0_w,
339   pcw16_flash0_bank_handler1_w,
340   pcw16_flash0_bank_handler2_w,
341   pcw16_flash0_bank_handler3_w,
338   { FUNC(pcw16_flash0_bank_handler0_w) },
339   { FUNC(pcw16_flash0_bank_handler1_w) },
340   { FUNC(pcw16_flash0_bank_handler2_w) },
341   { FUNC(pcw16_flash0_bank_handler3_w) }
342342};
343343
344static const write8_space_func pcw16_flash1_bank_handlers_w[4] =
344static const struct { write8_space_func func; const char *name; } pcw16_flash1_bank_handlers_w[4] =
345345{
346   pcw16_flash1_bank_handler0_w,
347   pcw16_flash1_bank_handler1_w,
348   pcw16_flash1_bank_handler2_w,
349   pcw16_flash1_bank_handler3_w,
346   { FUNC(pcw16_flash1_bank_handler0_w) },
347   { FUNC(pcw16_flash1_bank_handler1_w) },
348   { FUNC(pcw16_flash1_bank_handler2_w) },
349   { FUNC(pcw16_flash1_bank_handler3_w) }
350350};
351351
352352typedef enum
r11224r11225
381381
382382   case PCW16_MEM_FLASH_1:
383383      /* sram */
384      space->install_legacy_read_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, FUNC(pcw16_flash0_bank_handlers_r[bank]));
385      space->install_legacy_write_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, FUNC(pcw16_flash0_bank_handlers_w[bank]));
384      space->install_legacy_read_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, pcw16_flash0_bank_handlers_r[bank].func, pcw16_flash0_bank_handlers_r[bank].name);
385      space->install_legacy_write_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, pcw16_flash0_bank_handlers_w[bank].func, pcw16_flash0_bank_handlers_w[bank].name);
386386      break;
387387
388388   case PCW16_MEM_FLASH_2:
389      space->install_legacy_read_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, FUNC(pcw16_flash1_bank_handlers_r[bank]));
390      space->install_legacy_write_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, FUNC(pcw16_flash1_bank_handlers_w[bank]));
389      space->install_legacy_read_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, pcw16_flash1_bank_handlers_r[bank].func, pcw16_flash1_bank_handlers_r[bank].name);
390      space->install_legacy_write_handler((bank * 0x4000), (bank * 0x4000) + 0x3fff, pcw16_flash1_bank_handlers_w[bank].func, pcw16_flash1_bank_handlers_w[bank].name);
391391      break;
392392
393393   case PCW16_MEM_NONE:
src/mess/drivers/x68k.c
r11224r11225
26092609   x68k_state *state = machine.driver_data<x68k_state>();
26102610   /*  Install RAM handlers  */
26112611   state->m_spriteram = (UINT16*)machine.region("user1")->base();
2612   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC((read16_space_func)x68k_emptyram_r));
2613   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC((write16_space_func)x68k_emptyram_w));
2612   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_emptyram_r));
2613   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_emptyram_w));
26142614   space->install_readwrite_bank(0x000000,ram_get_size(machine.device(RAM_TAG))-1,0xffffffff,0,"bank1");
26152615   memory_set_bankptr(machine, "bank1",ram_get_ptr(machine.device(RAM_TAG)));
26162616   space->install_legacy_read_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram_r));
r11224r11225
26402640   x68k_state *state = machine.driver_data<x68k_state>();
26412641   /*  Install RAM handlers  */
26422642   state->m_spriteram = (UINT16*)machine.region("user1")->base();
2643   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC((read32_space_func)x68k_rom0_r));
2644   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC((write32_space_func)x68k_rom0_w));
2643   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_r));
2644   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_w));
26452645   space->install_readwrite_bank(0x000000,ram_get_size(machine.device(RAM_TAG))-1,0xffffffff,0,"bank1");
26462646   // mirror? Human68k 3.02 explicitly adds 0x3000000 to some pointers
26472647   space->install_readwrite_bank(0x3000000,0x3000000+ram_get_size(machine.device(RAM_TAG))-1,0xffffffff,0,"bank5");
src/mess/drivers/bw2.c
r11224r11225
657657      memory_configure_bank(m_machine, "bank1", BANK_RAMCARD_RAM, 1, m_ramcard_ram, 0);
658658      memory_configure_bank(m_machine, "bank1", BANK_RAM6, 1, m_work_ram + 0x18000, 0);
659659
660      io->install_write_handler(0x30, 0x30, 0, 0x0f, write8_delegate_create(bw2_state, ramcard_bank_w, *this), 0);
660      io->install_write_handler(0x30, 0x30, 0, 0x0f, write8_delegate(FUNC(bw2_state::ramcard_bank_w), this), 0);
661661   }
662662   else
663663   {
src/mess/drivers/elwro800.c
r11224r11225
5656 *************************************/
5757DIRECT_UPDATE_HANDLER(elwro800_direct_handler)
5858{
59   elwro800_state *state = machine->driver_data<elwro800_state>();
59   elwro800_state *state = machine.driver_data<elwro800_state>();
6060   if (state->m_ram_at_0000 && address == 0x66)
6161   {
6262      direct.explicit_configure(0x66, 0x66, 0, &state->m_df_on_databus);
r11224r11225
521521   // this is a reset of ls175 in mmu
522522   elwro800jr_mmu_w(machine, 0);
523523
524   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(elwro800_direct_handler, machine));
524   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(elwro800_direct_handler), &machine));
525525}
526526
527527static const cassette_config elwro800jr_cassette_config =
src/mess/drivers/avigo.c
r11224r11225
7272/* bits 0-5 define bank index */
7373/* bits 0-5 define bank index */
7474
75static void avigo_setbank(running_machine &machine, int bank, void *address, read8_space_func rh, write8_space_func wh)
75static void avigo_setbank(running_machine &machine, int bank, void *address, read8_space_func rh, char const *rh_name, write8_space_func wh, const char *wh_name)
7676{
7777   avigo_state *state = machine.driver_data<avigo_state>();
7878   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
r11224r11225
8989   }
9090   if (rh)
9191   {
92      space->install_legacy_read_handler((bank * 0x4000),(bank * 0x4000) + 0x3FFF, FUNC(rh));
92      space->install_legacy_read_handler((bank * 0x4000),(bank * 0x4000) + 0x3FFF, rh, rh_name);
9393   } else {
9494//      space->nop_read((bank * 0x4000),(bank * 0x4000) + 0x3FFF);
9595   }
9696   if (wh)
9797   {
98      space->install_legacy_write_handler((bank * 0x4000),(bank * 0x4000) + 0x3FFF, FUNC(wh));
98      space->install_legacy_write_handler((bank * 0x4000),(bank * 0x4000) + 0x3FFF, wh, wh_name);
9999   } else {
100100//      space->nop_write((bank * 0x4000),(bank * 0x4000) + 0x3FFF);
101101   }
r11224r11225
310310
311311   addr = (unsigned char *)state->m_flashes[state->m_flash_at_0x4000]->space()->get_read_ptr(0);
312312   addr = addr + (state->m_rom_bank_l<<14);
313   avigo_setbank(machine, 1, addr, avigo_flash_0x4000_read_handler, avigo_flash_0x4000_write_handler);
313   avigo_setbank(machine, 1, addr, FUNC(avigo_flash_0x4000_read_handler), FUNC(avigo_flash_0x4000_write_handler));
314314
315315   switch (state->m_ram_bank_h)
316316   {
317317      /* %101 */
318318      /* screen */
319319      case 0x06:
320         avigo_setbank(machine, 2, NULL, avigo_vid_memory_r, avigo_vid_memory_w);
320         avigo_setbank(machine, 2, NULL, FUNC(avigo_vid_memory_r), FUNC(avigo_vid_memory_w));
321321         break;
322322
323323      /* %001 */
r11224r11225
338338
339339         addr = (unsigned char *)state->m_flashes[state->m_flash_at_0x8000]->space()->get_read_ptr(0);
340340         addr = addr + (state->m_ram_bank_l<<14);
341         avigo_setbank(machine, 2, addr, avigo_flash_0x8000_read_handler, NULL /* avigo_flash_0x8000_write_handler */);
341         avigo_setbank(machine, 2, addr, FUNC(avigo_flash_0x8000_read_handler), FUNC_NULL /* avigo_flash_0x8000_write_handler */);
342342         break;
343343
344344      case 0x07:
r11224r11225
346346
347347         addr = (unsigned char *)state->m_flashes[state->m_flash_at_0x8000]->space()->get_read_ptr(0);
348348         addr = addr + (state->m_ram_bank_l<<14);
349         avigo_setbank(machine, 2, addr, avigo_flash_0x8000_read_handler, NULL /* avigo_flash_0x8000_write_handler */);
349         avigo_setbank(machine, 2, addr, FUNC(avigo_flash_0x8000_read_handler), FUNC_NULL /* avigo_flash_0x8000_write_handler */);
350350         break;
351351   }
352352}
r11224r11225
422422   memset(ram_get_ptr(machine.device(RAM_TAG)), 0, 128*1024);
423423
424424   addr = (unsigned char *)state->m_flashes[0]->space()->get_read_ptr(0);
425   avigo_setbank(machine, 0, addr, avigo_flash_0x0000_read_handler, avigo_flash_0x0000_write_handler);
425   avigo_setbank(machine, 0, addr, FUNC(avigo_flash_0x0000_read_handler), FUNC(avigo_flash_0x0000_write_handler));
426426
427   avigo_setbank(machine, 3, ram_get_ptr(machine.device(RAM_TAG)), NULL, NULL);
427   avigo_setbank(machine, 3, ram_get_ptr(machine.device(RAM_TAG)), FUNC_NULL, FUNC_NULL);
428428
429429   /* 0x08000 is specially banked! */
430430   avigo_refresh_memory(machine);
src/mess/drivers/ti89.c
r11224r11225
451451
452452      if (m_initial_pc > 0x400000)
453453      {
454         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate_create(ti68k_state, flash_r, *this),write16_delegate_create(ti68k_state, flash_w, *this));
454         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this),write16_delegate(FUNC(ti68k_state::flash_w), this));
455455      }
456456        else
457457      {
458         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate_create(ti68k_state, flash_r, *this), write16_delegate_create(ti68k_state, flash_w, *this));
458         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this), write16_delegate(FUNC(ti68k_state::flash_w), this));
459459      }
460460   }
461461
src/mess/drivers/cosmicos.c
r11224r11225
625625
626626DIRECT_UPDATE_HANDLER( cosmicos_direct_update_handler )
627627{
628   cosmicos_state *state = machine->driver_data<cosmicos_state>();
628   cosmicos_state *state = machine.driver_data<cosmicos_state>();
629629
630630   if (state->m_boot)
631631   {
632632      /* force A6 and A7 high */
633      direct.explicit_configure(0x0000, 0xffff, 0x3f3f, machine->region(CDP1802_TAG)->base() + 0xc0);
633      direct.explicit_configure(0x0000, 0xffff, 0x3f3f, machine.region(CDP1802_TAG)->base() + 0xc0);
634634      return ~0;
635635   }
636636
r11224r11225
641641{
642642   address_space *program = machine.device(CDP1802_TAG)->memory().space(AS_PROGRAM);
643643
644   program->set_direct_update_handler(direct_update_delegate_create_static(cosmicos_direct_update_handler, machine));
644   program->set_direct_update_handler(direct_update_delegate(FUNC(cosmicos_direct_update_handler), &machine));
645645}
646646
647647/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY             FULLNAME    FLAGS */
src/mess/drivers/gba.c
r11224r11225
32243224   and some games verify that as a protection check (notably Metroid Fusion) */
32253225DIRECT_UPDATE_HANDLER( gba_direct )
32263226{
3227   gba_state *state = machine->driver_data<gba_state>();
3227   gba_state *state = machine.driver_data<gba_state>();
32283228   if (address > 0x4000)
32293229   {
32303230      state->m_bios_protected = 1;
r11224r11225
32393239
32403240static DRIVER_INIT(gbadv)
32413241{
3242   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(gba_direct, machine));
3242   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(gba_direct), &machine));
32433243}
32443244
32453245/*    YEAR  NAME PARENT COMPAT MACHINE INPUT   INIT   COMPANY     FULLNAME */
src/mess/drivers/vixen.c
r11224r11225
864864
865865DIRECT_UPDATE_HANDLER( vixen_direct_update_handler )
866866{
867   vixen_state *state = machine->driver_data<vixen_state>();
867   vixen_state *state = machine.driver_data<vixen_state>();
868868
869869   if (address >= 0xf000)
870870   {
r11224r11225
875875         program->install_read_bank(0x0000, 0xefff, "bank1");
876876         program->install_write_bank(0x0000, 0xefff, "bank2");
877877
878         memory_set_bank(*machine, "bank1", 0);
879         memory_set_bank(*machine, "bank2", 0);
878         memory_set_bank(machine, "bank1", 0);
879         memory_set_bank(machine, "bank2", 0);
880880
881881         state->m_reset = 0;
882882      }
883883
884      direct.explicit_configure(0xf000, 0xffff, 0xfff, machine->region(Z8400A_TAG)->base());
884      direct.explicit_configure(0xf000, 0xffff, 0xfff, machine.region(Z8400A_TAG)->base());
885885
886886      return ~0;
887887   }
r11224r11225
892892static DRIVER_INIT( vixen )
893893{
894894   address_space *program = machine.device<cpu_device>(Z8400A_TAG)->space(AS_PROGRAM);
895   program->set_direct_update_handler(direct_update_delegate_create_static(vixen_direct_update_handler, machine));
895   program->set_direct_update_handler(direct_update_delegate(FUNC(vixen_direct_update_handler), &machine));
896896}
897897
898898

Previous 15994 Revisions Next


© 1998-2018 The MESS Team