Previous 199869 Revisions Next

r20765 Wednesday 6th February, 2013 at 09:40:17 UTC by Miodrag Milanović
Modernization of drivers part 3 (no whatsnew)
[src/mame/drivers]chinagat.c darius.c darkmist.c ddragon.c dec0.c deco_mlc.c dkong.c dragrace.c drgnmst.c
[src/mame/includes]darius.h darkmist.h darkseal.h dassault.h dcheese.h dcon.h dday.h ddragon.h ddragon3.h ddribble.h deadang.h dec0.h dec8.h deco32.h deco_mlc.h decocass.h deniam.h djmain.h dkong.h docastle.h dogfgt.h dooyong.h dragrace.h drgnmst.h dynduke.h
[src/mame/machine]dec0.c decocass.c
[src/mame/video]darius.c darkmist.c darkseal.c dassault.c dcheese.c dcon.c dday.c ddragon.c ddragon3.c ddribble.c deadang.c dec0.c dec8.c deco32.c deco_mlc.c deniam.c djmain.c dkong.c docastle.c dogfgt.c dooyong.c drgnmst.c dynduke.c

trunk/src/mame/drivers/chinagat.c
r20764r20765
9898
9999    Since MAME's video timing is 0-based, we need to convert this.
100100*/
101/* based on ddragon.c driver */
102INLINE int scanline_to_vcount( int scanline )
103{
104   int vcount = scanline + 8;
105   if (vcount < 0x100)
106      return vcount;
107   else
108      return (vcount - 0x18) | 0x100;
109}
110101
111102TIMER_DEVICE_CALLBACK_MEMBER(ddragon_state::chinagat_scanline)
112103{
trunk/src/mame/drivers/drgnmst.c
r20764r20765
463463ROM_END
464464
465465
466static UINT8 drgnmst_asciitohex( UINT8 data )
466UINT8 drgnmst_state::drgnmst_asciitohex( UINT8 data )
467467{
468468   /* Convert ASCII data to HEX */
469469
trunk/src/mame/drivers/ddragon.c
r20764r20765
107107    Since MAME's video timing is 0-based, we need to convert this.
108108*/
109109
110INLINE int scanline_to_vcount( int scanline )
110int ddragon_state::scanline_to_vcount( int scanline )
111111{
112112   int vcount = scanline + 8;
113113   if (vcount < 0x100)
trunk/src/mame/drivers/dkong.c
r20764r20765
400400 *
401401 *************************************/
402402
403static void dkong_init_device_driver_data( running_machine &machine )
403void dkong_state::dkong_init_device_driver_data(  )
404404{
405   dkong_state *state = machine.driver_data<dkong_state>();
406405
407   state->m_dev_n2a03a = machine.device("n2a03a");
408   state->m_dev_n2a03b = machine.device("n2a03b");
409   state->m_dev_6h = machine.device("ls259.6h");
410   state->m_dev_vp2 = machine.device("virtual_p2");
406   m_dev_n2a03a = machine().device("n2a03a");
407   m_dev_n2a03b = machine().device("n2a03b");
408   m_dev_6h = machine().device("ls259.6h");
409   m_dev_vp2 = machine().device("virtual_p2");
411410}
412411
413412MACHINE_START_MEMBER(dkong_state,dkong2b)
414413{
415   dkong_init_device_driver_data(machine());
414   dkong_init_device_driver_data();
416415   m_hardware_type = HARDWARE_TKG04;
417416
418417   save_item(NAME(m_decrypt_counter));
r20764r20765
468467
469468MACHINE_START_MEMBER(dkong_state,dkong3)
470469{
471   dkong_init_device_driver_data(machine());
470   dkong_init_device_driver_data();
472471   m_hardware_type = HARDWARE_TKG04;
473472}
474473
r20764r20765
16061605   eeprom->set_clock_line(data & 0x02 ? ASSERT_LINE : CLEAR_LINE);
16071606}
16081607
1609static void braze_decrypt_rom(running_machine &machine, UINT8 *dest)
1608void dkong_state::braze_decrypt_rom(UINT8 *dest)
16101609{
16111610   UINT8 oldbyte,newbyte;
16121611   UINT8 *ROM;
16131612   UINT32 mem;
16141613   UINT32 newmem;
16151614
1616   ROM = machine.root_device().memregion("braze")->base();
1615   ROM = machine().root_device().memregion("braze")->base();
16171616
16181617   for (mem=0;mem<0x10000;mem++)
16191618   {
r20764r20765
30263025 *
30273026 *************************************/
30283027
3029static void drakton_decrypt_rom(running_machine &machine, UINT8 mod, int offs, int *bs)
3028void dkong_state::drakton_decrypt_rom(UINT8 mod, int offs, int *bs)
30303029{
30313030   UINT8 oldbyte,newbyte;
30323031   UINT8 *ROM;
30333032   int mem;
30343033
3035   ROM = machine.root_device().memregion("maincpu")->base();
3034   ROM = machine().root_device().memregion("maincpu")->base();
30363035
30373036   for (mem=0;mem<0x4000;mem++)
30383037   {
r20764r20765
30893088       are actually used in the PAL.  Therefore, we'll take a little
30903089       memory overhead and decrypt the ROMs using each method in advance. */
30913090
3092   drakton_decrypt_rom(machine(), 0x02, 0x10000, bs[0]);
3093   drakton_decrypt_rom(machine(), 0x40, 0x14000, bs[1]);
3094   drakton_decrypt_rom(machine(), 0x8a, 0x18000, bs[2]);
3095   drakton_decrypt_rom(machine(), 0xc8, 0x1c000, bs[3]);
3091   drakton_decrypt_rom(0x02, 0x10000, bs[0]);
3092   drakton_decrypt_rom(0x40, 0x14000, bs[1]);
3093   drakton_decrypt_rom(0x8a, 0x18000, bs[2]);
3094   drakton_decrypt_rom(0xc8, 0x1c000, bs[3]);
30963095}
30973096
30983097
r20764r20765
31103109   /* While the PAL supports up to 16 decryption methods, only four
31113110       are actually used in the PAL.  Therefore, we'll take a little
31123111       memory overhead and decrypt the ROMs using each method in advance. */
3113   drakton_decrypt_rom(machine(), 0x03, 0x10000, bs[0]);
3114   drakton_decrypt_rom(machine(), 0x81, 0x14000, bs[1]);
3115   drakton_decrypt_rom(machine(), 0x0a, 0x18000, bs[2]);
3116   drakton_decrypt_rom(machine(), 0x88, 0x1c000, bs[3]);
3112   drakton_decrypt_rom(0x03, 0x10000, bs[0]);
3113   drakton_decrypt_rom(0x81, 0x14000, bs[1]);
3114   drakton_decrypt_rom(0x0a, 0x18000, bs[2]);
3115   drakton_decrypt_rom(0x88, 0x1c000, bs[3]);
31173116
31183117   /* custom handlers supporting Joystick or Steering Wheel */
31193118   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7c00, 0x7c00, read8_delegate(FUNC(dkong_state::strtheat_inputport_0_r),this));
r20764r20765
31363135   space.install_read_handler(0xc800, 0xc800, read8_delegate(FUNC(dkong_state::braze_eeprom_r),this));
31373136   space.install_write_handler(0xc800, 0xc800, write8_delegate(FUNC(dkong_state::braze_eeprom_w),this));
31383137
3139   braze_decrypt_rom(machine(), decrypted);
3138   braze_decrypt_rom(decrypted);
31403139
31413140   membank("bank1")->configure_entries(0, 2, &decrypted[0], 0x8000);
31423141   membank("bank1")->set_entry(0);
trunk/src/mame/drivers/dec0.c
r20764r20765
192192         break;
193193
194194      case 6: /* Intel 8751 microcontroller - Bad Dudes, Heavy Barrel, Birdy Try only */
195         dec0_i8751_write(machine(), data);
195         dec0_i8751_write(data);
196196         break;
197197
198198      case 8: /* Interrupt ack (VBL - IRQ 6) */
r20764r20765
207207         break;
208208
209209      case 0xe: /* Reset Intel 8751? - not sure, all the games write here at startup */
210         dec0_i8751_reset(machine());
210         dec0_i8751_reset();
211211         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
212212         break;
213213
r20764r20765
407407WRITE16_MEMBER(dec0_state::slyspy_state_w)
408408{
409409   m_slyspy_state=0;
410   slyspy_set_protection_map(machine(), m_slyspy_state);
410   slyspy_set_protection_map(m_slyspy_state);
411411}
412412
413413READ16_MEMBER(dec0_state::slyspy_state_r)
414414{
415415   m_slyspy_state++;
416416   m_slyspy_state=m_slyspy_state%4;
417   slyspy_set_protection_map(machine(), m_slyspy_state);
417   slyspy_set_protection_map(m_slyspy_state);
418418
419419   return 0; /* Value doesn't mater */
420420}
421421
422void slyspy_set_protection_map(running_machine& machine, int type)
422void dec0_state::slyspy_set_protection_map( int type)
423423{
424   dec0_state *state = machine.driver_data<dec0_state>();
425   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
424   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
426425
427   deco_bac06_device *tilegen1 = (deco_bac06_device*)state->m_tilegen1;
428   deco_bac06_device *tilegen2 = (deco_bac06_device*)state->m_tilegen2;
426   deco_bac06_device *tilegen1 = (deco_bac06_device*)m_tilegen1;
427   deco_bac06_device *tilegen2 = (deco_bac06_device*)m_tilegen2;
429428
430   space.install_write_handler( 0x240000, 0x24ffff, write16_delegate(FUNC(dec0_state::unmapped_w),state));
429   space.install_write_handler( 0x240000, 0x24ffff, write16_delegate(FUNC(dec0_state::unmapped_w),this));
431430
432   space.install_write_handler( 0x24a000, 0x24a001, write16_delegate(FUNC(dec0_state::slyspy_state_w),state));
433   space.install_read_handler( 0x244000, 0x244001, read16_delegate(FUNC(dec0_state::slyspy_state_r),state));
431   space.install_write_handler( 0x24a000, 0x24a001, write16_delegate(FUNC(dec0_state::slyspy_state_w),this));
432   space.install_read_handler( 0x244000, 0x244001, read16_delegate(FUNC(dec0_state::slyspy_state_r),this));
434433
435434   switch (type)
436435   {
r20764r20765
16761675MACHINE_RESET_MEMBER(dec0_state,slyspy)
16771676{
16781677   // set initial memory map
1679   slyspy_set_protection_map(machine(), 0);
1678   slyspy_set_protection_map(0);
16801679}
16811680
16821681static MACHINE_CONFIG_DERIVED( slyspy, dec0_base_sound_alt )
trunk/src/mame/drivers/dragrace.c
r20764r20765
3434}
3535
3636
37static void dragrace_update_misc_flags( address_space &space )
37void dragrace_state::dragrace_update_misc_flags( address_space &space )
3838{
39   dragrace_state *state = space.machine().driver_data<dragrace_state>();
4039   /* 0x0900 = set 3SPEED1         0x00000001
4140    * 0x0901 = set 4SPEED1         0x00000002
4241    * 0x0902 = set 5SPEED1         0x00000004
r20764r20765
6867    * 0x091f = set Player 2 Start Lamp 0x80000000
6968    * 0x0938 = clear 0x0918 - 0x091f
7069    */
71   set_led_status(space.machine(), 0, state->m_misc_flags & 0x00008000);
72   set_led_status(space.machine(), 1, state->m_misc_flags & 0x80000000);
70   set_led_status(machine(), 0, m_misc_flags & 0x00008000);
71   set_led_status(machine(), 1, m_misc_flags & 0x80000000);
7372
74   discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR1_DATA,  ~state->m_misc_flags & 0x0000001f);       // Speed1 data*
75   discrete_sound_w(state->m_discrete, space, DRAGRACE_EXPLODE1_EN, (state->m_misc_flags & 0x00000020) ? 1: 0);    // Explosion1 enable
76   discrete_sound_w(state->m_discrete, space, DRAGRACE_SCREECH1_EN, (state->m_misc_flags & 0x00000040) ? 1: 0);    // Screech1 enable
77   discrete_sound_w(state->m_discrete, space, DRAGRACE_KLEXPL1_EN, (state->m_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
78   discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR1_EN, (state->m_misc_flags & 0x00000800) ? 1: 0);  // Motor1 enable
73   discrete_sound_w(m_discrete, space, DRAGRACE_MOTOR1_DATA,  ~m_misc_flags & 0x0000001f);       // Speed1 data*
74   discrete_sound_w(m_discrete, space, DRAGRACE_EXPLODE1_EN, (m_misc_flags & 0x00000020) ? 1: 0);    // Explosion1 enable
75   discrete_sound_w(m_discrete, space, DRAGRACE_SCREECH1_EN, (m_misc_flags & 0x00000040) ? 1: 0);    // Screech1 enable
76   discrete_sound_w(m_discrete, space, DRAGRACE_KLEXPL1_EN, (m_misc_flags & 0x00000200) ? 1: 0); // KLEXPL1 enable
77   discrete_sound_w(m_discrete, space, DRAGRACE_MOTOR1_EN, (m_misc_flags & 0x00000800) ? 1: 0);  // Motor1 enable
7978
80   discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR2_DATA, (~state->m_misc_flags & 0x001f0000) >> 0x10);  // Speed2 data*
81   discrete_sound_w(state->m_discrete, space, DRAGRACE_EXPLODE2_EN, (state->m_misc_flags & 0x00200000) ? 1: 0);    // Explosion2 enable
82   discrete_sound_w(state->m_discrete, space, DRAGRACE_SCREECH2_EN, (state->m_misc_flags & 0x00400000) ? 1: 0);    // Screech2 enable
83   discrete_sound_w(state->m_discrete, space, DRAGRACE_KLEXPL2_EN, (state->m_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
84   discrete_sound_w(state->m_discrete, space, DRAGRACE_MOTOR2_EN, (state->m_misc_flags & 0x08000000) ? 1: 0);  // Motor2 enable
79   discrete_sound_w(m_discrete, space, DRAGRACE_MOTOR2_DATA, (~m_misc_flags & 0x001f0000) >> 0x10);  // Speed2 data*
80   discrete_sound_w(m_discrete, space, DRAGRACE_EXPLODE2_EN, (m_misc_flags & 0x00200000) ? 1: 0);    // Explosion2 enable
81   discrete_sound_w(m_discrete, space, DRAGRACE_SCREECH2_EN, (m_misc_flags & 0x00400000) ? 1: 0);    // Screech2 enable
82   discrete_sound_w(m_discrete, space, DRAGRACE_KLEXPL2_EN, (m_misc_flags & 0x02000000) ? 1: 0); // KLEXPL2 enable
83   discrete_sound_w(m_discrete, space, DRAGRACE_MOTOR2_EN, (m_misc_flags & 0x08000000) ? 1: 0);  // Motor2 enable
8584
86   discrete_sound_w(state->m_discrete, space, DRAGRACE_ATTRACT_EN, (state->m_misc_flags & 0x00001000) ? 1: 0); // Attract enable
87   discrete_sound_w(state->m_discrete, space, DRAGRACE_LOTONE_EN, (state->m_misc_flags & 0x00002000) ? 1: 0);  // LoTone enable
88   discrete_sound_w(state->m_discrete, space, DRAGRACE_HITONE_EN, (state->m_misc_flags & 0x20000000) ? 1: 0);  // HiTone enable
85   discrete_sound_w(m_discrete, space, DRAGRACE_ATTRACT_EN, (m_misc_flags & 0x00001000) ? 1: 0); // Attract enable
86   discrete_sound_w(m_discrete, space, DRAGRACE_LOTONE_EN, (m_misc_flags & 0x00002000) ? 1: 0);  // LoTone enable
87   discrete_sound_w(m_discrete, space, DRAGRACE_HITONE_EN, (m_misc_flags & 0x20000000) ? 1: 0);  // HiTone enable
8988}
9089
9190WRITE8_MEMBER(dragrace_state::dragrace_misc_w)
trunk/src/mame/drivers/darkmist.c
r20764r20765
311311ROM_END
312312
313313
314static void decrypt_gfx(running_machine &machine)
314void darkmist_state::decrypt_gfx()
315315{
316   UINT8 *buf = auto_alloc_array(machine, UINT8, 0x40000);
316   UINT8 *buf = auto_alloc_array(machine(), UINT8, 0x40000);
317317   UINT8 *rom;
318318   int size;
319319   int i;
320320
321   rom = machine.root_device().memregion("gfx1")->base();
322   size = machine.root_device().memregion("gfx1")->bytes();
321   rom = machine().root_device().memregion("gfx1")->base();
322   size = machine().root_device().memregion("gfx1")->bytes();
323323
324324   /* data lines */
325325   for (i = 0;i < size/2;i++)
r20764r20765
341341   }
342342
343343
344   rom = machine.root_device().memregion("gfx2")->base();
345   size = machine.root_device().memregion("gfx2")->bytes();
344   rom = machine().root_device().memregion("gfx2")->base();
345   size = machine().root_device().memregion("gfx2")->bytes();
346346
347347   /* data lines */
348348   for (i = 0;i < size/2;i++)
r20764r20765
364364   }
365365
366366
367   rom = machine.root_device().memregion("gfx3")->base();
368   size = machine.root_device().memregion("gfx3")->bytes();
367   rom = machine().root_device().memregion("gfx3")->base();
368   size = machine().root_device().memregion("gfx3")->bytes();
369369
370370   /* data lines */
371371   for (i = 0;i < size/2;i++)
r20764r20765
386386      rom[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
387387   }
388388
389   auto_free(machine, buf);
389   auto_free(machine(), buf);
390390}
391391
392static void decrypt_snd(running_machine &machine)
392void darkmist_state::decrypt_snd()
393393{
394394   int i;
395   UINT8 *ROM = machine.root_device().memregion("t5182")->base();
395   UINT8 *ROM = machine().root_device().memregion("t5182")->base();
396396
397397   for(i=0x8000;i<0x10000;i++)
398398      ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
r20764r20765
408408
409409   t5182_init(machine());
410410
411   decrypt_gfx(machine());
411   decrypt_gfx();
412412
413   decrypt_snd(machine());
413   decrypt_snd();
414414
415415   for(i=0;i<0x8000;i++)
416416   {
trunk/src/mame/drivers/deco_mlc.c
r20764r20765
689689
690690/***************************************************************************/
691691
692static void descramble_sound( running_machine &machine )
692void deco_mlc_state::descramble_sound(  )
693693{
694694   /* the same as simpl156 / heavy smash? */
695   UINT8 *rom = machine.root_device().memregion("ymz")->base();
696   int length = machine.root_device().memregion("ymz")->bytes();
697   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
695   UINT8 *rom = machine().root_device().memregion("ymz")->base();
696   int length = machine().root_device().memregion("ymz")->bytes();
697   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
698698
699699   UINT32 x;
700700
r20764r20765
714714
715715   memcpy(rom,buf1,length);
716716
717   auto_free (machine, buf1);
717   auto_free(machine(), buf1);
718718}
719719
720720READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r)
r20764r20765
738738
739739   m_mainCpuIsArm = 0;
740740   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01089a0, 0x01089a3, read32_delegate(FUNC(deco_mlc_state::avengrgs_speedup_r),this));
741   descramble_sound(machine());
741   descramble_sound();
742742}
743743
744744DRIVER_INIT_MEMBER(deco_mlc_state,mlc)
r20764r20765
749749   machine().device("maincpu")->set_clock_scale(2.0f);
750750   m_mainCpuIsArm = 1;
751751   deco156_decrypt(machine());
752   descramble_sound(machine());
752   descramble_sound();
753753}
754754
755755/***************************************************************************/
trunk/src/mame/drivers/darius.c
r20764r20765
139139#include "darius.lh"
140140
141141
142static void parse_control( running_machine &machine )   /* assumes Z80 sandwiched between 68Ks */
142void darius_state::parse_control(  )   /* assumes Z80 sandwiched between 68Ks */
143143{
144144   /* bit 0 enables cpu B */
145145   /* however this fails when recovering from a save state
146146      if cpu B is disabled !! */
147   darius_state *state = machine.driver_data<darius_state>();
148   state->m_cpub->execute().set_input_line(INPUT_LINE_RESET, (state->m_cpua_ctrl & 0x01) ? CLEAR_LINE : ASSERT_LINE);
147   m_cpub->execute().set_input_line(INPUT_LINE_RESET, (m_cpua_ctrl & 0x01) ? CLEAR_LINE : ASSERT_LINE);
149148}
150149
151150WRITE16_MEMBER(darius_state::cpua_ctrl_w)
r20764r20765
155154
156155   m_cpua_ctrl = data;
157156
158   parse_control(machine());
157   parse_control();
159158
160159   logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data);
161160}
r20764r20765
268267                        SOUND
269268*****************************************************/
270269
271static void reset_sound_region( running_machine &machine )
270void darius_state::reset_sound_region(  )
272271{
273   darius_state *state = machine.driver_data<darius_state>();
274   state->membank("bank1")->set_entry(state->m_banknum);
272   membank("bank1")->set_entry(m_banknum);
275273}
276274
277275WRITE8_MEMBER(darius_state::sound_bankswitch_w)
278276{
279277   m_banknum = data & 0x03;
280   reset_sound_region(machine());
278   reset_sound_region();
281279//  banknum = data;
282280//  reset_sound_region();
283281}
r20764r20765
300298               Sound mixer/pan control
301299*****************************************************/
302300
303static void update_fm0( running_machine &machine )
301void darius_state::update_fm0(  )
304302{
305   darius_state *state = machine.driver_data<darius_state>();
306   int left  = (        state->m_pan[0]  * state->m_vol[6]) >> 8;
307   int right = ((0xff - state->m_pan[0]) * state->m_vol[6]) >> 8;
303   int left  = (        m_pan[0]  * m_vol[6]) >> 8;
304   int right = ((0xff - m_pan[0]) * m_vol[6]) >> 8;
308305
309   if (state->m_filter0_3l != NULL)
310      state->m_filter0_3l->flt_volume_set_volume(left / 100.0);
311   if (state->m_filter0_3r != NULL)
312      state->m_filter0_3r->flt_volume_set_volume(right / 100.0); /* FM #0 */
306   if (m_filter0_3l != NULL)
307      m_filter0_3l->flt_volume_set_volume(left / 100.0);
308   if (m_filter0_3r != NULL)
309      m_filter0_3r->flt_volume_set_volume(right / 100.0); /* FM #0 */
313310}
314311
315static void update_fm1( running_machine &machine )
312void darius_state::update_fm1(  )
316313{
317   darius_state *state = machine.driver_data<darius_state>();
318   int left  = (        state->m_pan[1]  * state->m_vol[7]) >> 8;
319   int right = ((0xff - state->m_pan[1]) * state->m_vol[7]) >> 8;
314   int left  = (        m_pan[1]  * m_vol[7]) >> 8;
315   int right = ((0xff - m_pan[1]) * m_vol[7]) >> 8;
320316
321   if (state->m_filter1_3l != NULL)
322      state->m_filter1_3l->flt_volume_set_volume(left / 100.0);
323   if (state->m_filter1_3r != NULL)
324      state->m_filter1_3r->flt_volume_set_volume(right / 100.0); /* FM #1 */
317   if (m_filter1_3l != NULL)
318      m_filter1_3l->flt_volume_set_volume(left / 100.0);
319   if (m_filter1_3r != NULL)
320      m_filter1_3r->flt_volume_set_volume(right / 100.0); /* FM #1 */
325321}
326322
327static void update_psg0( running_machine &machine, int port )
323void darius_state::update_psg0( int port )
328324{
329   darius_state *state = machine.driver_data<darius_state>();
330325   filter_volume_device *lvol = NULL, *rvol = NULL;
331326   int left, right;
332327
333328   switch (port)
334329   {
335      case 0: lvol = state->m_filter0_0l; rvol = state->m_filter0_0r; break;
336      case 1: lvol = state->m_filter0_1l; rvol = state->m_filter0_1r; break;
337      case 2: lvol = state->m_filter0_2l; rvol = state->m_filter0_2r; break;
330      case 0: lvol = m_filter0_0l; rvol = m_filter0_0r; break;
331      case 1: lvol = m_filter0_1l; rvol = m_filter0_1r; break;
332      case 2: lvol = m_filter0_2l; rvol = m_filter0_2r; break;
338333      default: break;
339334   }
340335
341   left  = (        state->m_pan[2]  * state->m_vol[port]) >> 8;
342   right = ((0xff - state->m_pan[2]) * state->m_vol[port]) >> 8;
336   left  = (        m_pan[2]  * m_vol[port]) >> 8;
337   right = ((0xff - m_pan[2]) * m_vol[port]) >> 8;
343338
344339   if (lvol != NULL)
345340      lvol->flt_volume_set_volume(left / 100.0);
r20764r20765
347342      rvol->flt_volume_set_volume(right / 100.0);
348343}
349344
350static void update_psg1( running_machine &machine, int port )
345void darius_state::update_psg1( int port )
351346{
352   darius_state *state = machine.driver_data<darius_state>();
353347   filter_volume_device *lvol = NULL, *rvol = NULL;
354348   int left, right;
355349
356350   switch (port)
357351   {
358      case 0: lvol = state->m_filter1_0l; rvol = state->m_filter1_0r; break;
359      case 1: lvol = state->m_filter1_1l; rvol = state->m_filter1_1r; break;
360      case 2: lvol = state->m_filter1_2l; rvol = state->m_filter1_2r; break;
352      case 0: lvol = m_filter1_0l; rvol = m_filter1_0r; break;
353      case 1: lvol = m_filter1_1l; rvol = m_filter1_1r; break;
354      case 2: lvol = m_filter1_2l; rvol = m_filter1_2r; break;
361355      default: break;
362356   }
363357
364   left  = (        state->m_pan[3]  * state->m_vol[port + 3]) >> 8;
365   right = ((0xff - state->m_pan[3]) * state->m_vol[port + 3]) >> 8;
358   left  = (        m_pan[3]  * m_vol[port + 3]) >> 8;
359   right = ((0xff - m_pan[3]) * m_vol[port + 3]) >> 8;
366360
367361   if (lvol != NULL)
368362      lvol->flt_volume_set_volume(left / 100.0);
r20764r20765
370364      rvol->flt_volume_set_volume(right / 100.0);
371365}
372366
373static void update_da( running_machine &machine )
367void darius_state::update_da(  )
374368{
375   darius_state *state = machine.driver_data<darius_state>();
376   int left  = state->m_def_vol[(state->m_pan[4] >> 4) & 0x0f];
377   int right = state->m_def_vol[(state->m_pan[4] >> 0) & 0x0f];
369   int left  = m_def_vol[(m_pan[4] >> 4) & 0x0f];
370   int right = m_def_vol[(m_pan[4] >> 0) & 0x0f];
378371
379   if (state->m_msm5205_l != NULL)
380      state->m_msm5205_l->flt_volume_set_volume(left / 100.0);
381   if (state->m_msm5205_r != NULL)
382      state->m_msm5205_r->flt_volume_set_volume(right / 100.0);
372   if (m_msm5205_l != NULL)
373      m_msm5205_l->flt_volume_set_volume(left / 100.0);
374   if (m_msm5205_r != NULL)
375      m_msm5205_r->flt_volume_set_volume(right / 100.0);
383376}
384377
385378WRITE8_MEMBER(darius_state::darius_fm0_pan)
386379{
387380   m_pan[0] = data & 0xff;  /* data 0x00:right 0xff:left */
388   update_fm0(machine());
381   update_fm0();
389382}
390383
391384WRITE8_MEMBER(darius_state::darius_fm1_pan)
392385{
393386   m_pan[1] = data & 0xff;
394   update_fm1(machine());
387   update_fm1();
395388}
396389
397390WRITE8_MEMBER(darius_state::darius_psg0_pan)
398391{
399392   m_pan[2] = data & 0xff;
400   update_psg0(machine(), 0);
401   update_psg0(machine(), 1);
402   update_psg0(machine(), 2);
393   update_psg0(0);
394   update_psg0(1);
395   update_psg0(2);
403396}
404397
405398WRITE8_MEMBER(darius_state::darius_psg1_pan)
406399{
407400   m_pan[3] = data & 0xff;
408   update_psg1(machine(), 0);
409   update_psg1(machine(), 1);
410   update_psg1(machine(), 2);
401   update_psg1( 0);
402   update_psg1( 1);
403   update_psg1( 2);
411404}
412405
413406WRITE8_MEMBER(darius_state::darius_da_pan)
414407{
415408   m_pan[4] = data & 0xff;
416   update_da(machine());
409   update_da();
417410}
418411
419412/**** Mixer Control ****/
r20764r20765
426419
427420   m_vol[0] = m_def_vol[(data >> 4) & 0x0f];
428421   m_vol[6] = m_def_vol[(data >> 0) & 0x0f];
429   update_fm0(machine());
430   update_psg0(machine(), 0);
422   update_fm0();
423   update_psg0(0);
431424}
432425
433426WRITE8_MEMBER(darius_state::darius_write_portA1)
r20764r20765
437430
438431   m_vol[3] = m_def_vol[(data >> 4) & 0x0f];
439432   m_vol[7] = m_def_vol[(data >> 0) & 0x0f];
440   update_fm1(machine());
441   update_psg1(machine(), 0);
433   update_fm1();
434   update_psg1( 0);
442435}
443436
444437WRITE8_MEMBER(darius_state::darius_write_portB0)
r20764r20765
448441
449442   m_vol[1] = m_def_vol[(data >> 4) & 0x0f];
450443   m_vol[2] = m_def_vol[(data >> 0) & 0x0f];
451   update_psg0(machine(), 1);
452   update_psg0(machine(), 2);
444   update_psg0(1);
445   update_psg0(2);
453446}
454447
455448WRITE8_MEMBER(darius_state::darius_write_portB1)
r20764r20765
459452
460453   m_vol[4] = m_def_vol[(data >> 4) & 0x0f];
461454   m_vol[5] = m_def_vol[(data >> 0) & 0x0f];
462   update_psg1(machine(), 1);
463   update_psg1(machine(), 2);
455   update_psg1( 1);
456   update_psg1( 2);
464457}
465458
466459
r20764r20765
822815
823816void darius_state::darius_postload()
824817{
825   parse_control(machine());
826   reset_sound_region(machine());
818   parse_control();
819   reset_sound_region();
827820}
828821
829822void darius_state::machine_start()
trunk/src/mame/machine/decocass.c
r20764r20765
209209
210210
211211#ifdef MAME_DEBUG
212static void decocass_fno( running_machine &machine, offs_t offset, UINT8 data )
212void decocass_state::decocass_fno( offs_t offset, UINT8 data )
213213{
214   decocass_state *state = machine.driver_data<decocass_state>();
215214   /* 8041ENA/ and is this a FNO write (function number)? */
216   if (0 == (state->m_i8041_p2 & 0x01))
215   if (0 == (m_i8041_p2 & 0x01))
217216   {
218217      switch (data)
219218      {
trunk/src/mame/machine/dec0.c
r20764r20765
201201   }
202202}
203203
204static void baddudes_i8751_write(running_machine &machine, int data)
204void dec0_state::baddudes_i8751_write(int data)
205205{
206   dec0_state *state = machine.driver_data<dec0_state>();
207   state->m_i8751_return=0;
206   m_i8751_return=0;
208207
209208   switch (data&0xffff) {
210      case 0x714: state->m_i8751_return=0x700; break;
211      case 0x73b: state->m_i8751_return=0x701; break;
212      case 0x72c: state->m_i8751_return=0x702; break;
213      case 0x73f: state->m_i8751_return=0x703; break;
214      case 0x755: state->m_i8751_return=0x704; break;
215      case 0x722: state->m_i8751_return=0x705; break;
216      case 0x72b: state->m_i8751_return=0x706; break;
217      case 0x724: state->m_i8751_return=0x707; break;
218      case 0x728: state->m_i8751_return=0x708; break;
219      case 0x735: state->m_i8751_return=0x709; break;
220      case 0x71d: state->m_i8751_return=0x70a; break;
221      case 0x721: state->m_i8751_return=0x70b; break;
222      case 0x73e: state->m_i8751_return=0x70c; break;
223      case 0x761: state->m_i8751_return=0x70d; break;
224      case 0x753: state->m_i8751_return=0x70e; break;
225      case 0x75b: state->m_i8751_return=0x70f; break;
209      case 0x714: m_i8751_return=0x700; break;
210      case 0x73b: m_i8751_return=0x701; break;
211      case 0x72c: m_i8751_return=0x702; break;
212      case 0x73f: m_i8751_return=0x703; break;
213      case 0x755: m_i8751_return=0x704; break;
214      case 0x722: m_i8751_return=0x705; break;
215      case 0x72b: m_i8751_return=0x706; break;
216      case 0x724: m_i8751_return=0x707; break;
217      case 0x728: m_i8751_return=0x708; break;
218      case 0x735: m_i8751_return=0x709; break;
219      case 0x71d: m_i8751_return=0x70a; break;
220      case 0x721: m_i8751_return=0x70b; break;
221      case 0x73e: m_i8751_return=0x70c; break;
222      case 0x761: m_i8751_return=0x70d; break;
223      case 0x753: m_i8751_return=0x70e; break;
224      case 0x75b: m_i8751_return=0x70f; break;
226225   }
227226
228   if (!state->m_i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",machine.describe_context(),data);
229   machine.device("maincpu")->execute().set_input_line(5, HOLD_LINE);
227   if (!m_i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",machine().describe_context(),data);
228   machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
230229}
231230
232static void birdtry_i8751_write(running_machine &machine, int data)
231void dec0_state::birdtry_i8751_write(int data)
233232{
234   dec0_state *state = machine.driver_data<dec0_state>();
235233   static int  pwr,
236234            hgt;
237235
238   state->m_i8751_return=0;
236   m_i8751_return=0;
239237
240238   switch(data&0xffff) {
241239      /*"Sprite control"*/
242      case 0x22a: state->m_i8751_return = 0x200;    break;
240      case 0x22a: m_i8751_return = 0x200;    break;
243241
244242      /* Gives an O.B. otherwise (it must be > 0xb0 )*/
245      case 0x3c7: state->m_i8751_return = 0x7ff;    break;
243      case 0x3c7: m_i8751_return = 0x7ff;    break;
246244
247245      /*Enables shot checks*/
248      case 0x33c: state->m_i8751_return = 0x200;     break;
246      case 0x33c: m_i8751_return = 0x200;     break;
249247
250248      /*Used on the title screen only(???)*/
251      case 0x31e: state->m_i8751_return = 0x200;     break;
249      case 0x31e: m_i8751_return = 0x200;     break;
252250
253251/*  0x100-0x10d values are for club power meters(1W=0x100<<-->>PT=0x10d).    *
254252 *  Returned value to i8751 doesn't matter,but send the result to 0x481.     *
r20764r20765
267265      case 0x10b: pwr = 0x5c;             break; /*PW*/
268266      case 0x10c: pwr = 0x60;             break; /*SW*/
269267      case 0x10d: pwr = 0x80;             break; /*PT*/
270      case 0x481: state->m_i8751_return = pwr;     break; /*Power meter*/
268      case 0x481: m_i8751_return = pwr;     break; /*Power meter*/
271269
272270/*  0x200-0x20f values are for shot height(STRONG=0x200<<-->>WEAK=0x20f).    *
273271 *  Returned value to i8751 doesn't matter,but send the result to 0x534.     *
r20764r20765
288286      case 0x20d: hgt = 0x280;            break; /*|*/
289287      case 0x20e: hgt = 0x240;            break; /*|*/
290288      case 0x20f: hgt = 0x200;            break; /*L*/
291      case 0x534: state->m_i8751_return = hgt;    break; /*Shot height*/
289      case 0x534: m_i8751_return = hgt;    break; /*Shot height*/
292290
293291      /*At the ending screen(???)*/
294      //case 0x3b4: state->m_i8751_return = 0;       break;
292      //case 0x3b4: m_i8751_return = 0;       break;
295293
296294      /*These are activated after a shot (???)*/
297      case 0x6ca: state->m_i8751_return = 0xff;      break;
298      case 0x7ff: state->m_i8751_return = 0x200;     break;
299      default: logerror("%s: warning - write unknown command %02x to 8571\n",machine.describe_context(),data);
295      case 0x6ca: m_i8751_return = 0xff;      break;
296      case 0x7ff: m_i8751_return = 0x200;     break;
297      default: logerror("%s: warning - write unknown command %02x to 8571\n",machine().describe_context(),data);
300298   }
301   machine.device("maincpu")->execute().set_input_line(5, HOLD_LINE);
299   machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
302300}
303301
304void dec0_i8751_write(running_machine &machine, int data)
302void dec0_state::dec0_i8751_write(int data)
305303{
306   dec0_state *state = machine.driver_data<dec0_state>();
307   state->m_i8751_command=data;
304   m_i8751_command=data;
308305
309306   /* Writes to this address cause an IRQ to the i8751 microcontroller */
310   if (state->m_GAME == 1) machine.device("mcu")->execute().set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
311   if (state->m_GAME == 2) baddudes_i8751_write(machine, data);
312   if (state->m_GAME == 3) birdtry_i8751_write(machine, data);
307   if (m_GAME == 1) machine().device("mcu")->execute().set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
308   if (m_GAME == 2) baddudes_i8751_write(data);
309   if (m_GAME == 3) birdtry_i8751_write(data);
313310
314   //logerror("%s: warning - write %02x to i8751\n",machine.describe_context(),data);
311   //logerror("%s: warning - write %02x to i8751\n",machine().describe_context(),data);
315312}
316313
317void dec0_i8751_reset(running_machine &machine)
314void dec0_state::dec0_i8751_reset()
318315{
319   dec0_state *state = machine.driver_data<dec0_state>();
320   state->m_i8751_return=state->m_i8751_command=0;
316   m_i8751_return=m_i8751_command=0;
321317}
322318
323319/******************************************************************************/
r20764r20765
348344
349345/******************************************************************************/
350346
351static void h6280_decrypt(running_machine &machine, const char *cputag)
347void dec0_state::h6280_decrypt(const char *cputag)
352348{
353349   int i;
354   UINT8 *RAM = machine.root_device().memregion(cputag)->base();
350   UINT8 *RAM = machine().root_device().memregion(cputag)->base();
355351
356352   /* Read each byte, decrypt it */
357353   for (i = 0x00000; i < 0x10000; i++)
r20764r20765
364360   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::hippodrm_68000_share_r),this), write16_delegate(FUNC(dec0_state::hippodrm_68000_share_w),this));
365361   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xffc800, 0xffcfff, write16_delegate(FUNC(dec0_state::sprite_mirror_w),this));
366362
367   h6280_decrypt(machine(), "sub");
363   h6280_decrypt("sub");
368364
369365   /* The protection cpu has additional memory mapped protection! */
370366   RAM[0x189] = 0x60; /* RTS prot area */
r20764r20765
377373{
378374   UINT8 *RAM = machine().root_device().memregion("audiocpu")->base();
379375
380   h6280_decrypt(machine(), "audiocpu");
376   h6280_decrypt("audiocpu");
381377
382378   /* Slyspy sound cpu has some protection */
383379   RAM[0xf2d] = 0xea;
trunk/src/mame/includes/dynduke.h
r20764r20765
4242   virtual void video_start();
4343   UINT32 screen_update_dynduke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   INTERRUPT_GEN_MEMBER(dynduke_interrupt);
45   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
46   void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
4547};
trunk/src/mame/includes/dassault.h
r20764r20765
6767   DECLARE_DRIVER_INIT(dassault);
6868   virtual void video_start();
6969   UINT32 screen_update_dassault(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
70   void mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, UINT16 pri, UINT16 primask, UINT16 penbase, UINT8 alpha);
7071};
trunk/src/mame/includes/darius.h
r20764r20765
9696   UINT32 screen_update_darius_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9797   UINT32 screen_update_darius_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9898   void darius_postload();
99   inline void actual_get_fg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum );
100   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs );
101   UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs);
102   void parse_control(  )   /* assumes Z80 sandwiched between 68Ks */;
103   void reset_sound_region(  );
104   void update_fm0(  );
105   void update_fm1(  );
106   void update_psg0( int port );
107   void update_psg1( int port );
108   void update_da(  );
99109};
trunk/src/mame/includes/deadang.h
r20764r20765
3535   UINT32 screen_update_deadang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3636   TIMER_DEVICE_CALLBACK_MEMBER(deadang_main_scanline);
3737   TIMER_DEVICE_CALLBACK_MEMBER(deadang_sub_scanline);
38   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
3839};
trunk/src/mame/includes/decocass.h
r20764r20765
250250   void draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprect,
251251               int missile_y_adjust, int missile_y_adjust_flip_screen,
252252               UINT8 *missile_ram, int interleave);
253   void decocass_fno( offs_t offset, UINT8 data );
253254};
trunk/src/mame/includes/dcon.h
r20764r20765
3939   virtual void video_start();
4040   UINT32 screen_update_dcon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4141   UINT32 screen_update_sdgndmps(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42   void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect);
4243};
trunk/src/mame/includes/dogfgt.h
r20764r20765
5353   virtual void video_start();
5454   virtual void palette_init();
5555   UINT32 screen_update_dogfgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
56   void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
5657};
trunk/src/mame/includes/darkmist.h
r20764r20765
2929   virtual void palette_init();
3030   UINT32 screen_update_darkmist(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3131   TIMER_DEVICE_CALLBACK_MEMBER(darkmist_scanline);
32   void set_pens();
33   void decrypt_gfx();
34   void decrypt_snd();
3235};
trunk/src/mame/includes/deco_mlc.h
r20764r20765
3939   UINT32 screen_update_mlc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4040   void screen_eof_mlc(screen_device &screen, bool state);
4141   TIMER_DEVICE_CALLBACK_MEMBER(interrupt_gen);
42   void blitRaster(bitmap_rgb32 &bitmap, int rasterMode);
43   void draw_sprites( bitmap_rgb32 &bitmap,const rectangle &cliprect);
44   void descramble_sound(  );
4245};
trunk/src/mame/includes/docastle.h
r20764r20765
4848   virtual void palette_init();
4949   DECLARE_VIDEO_START(dorunrun);
5050   UINT32 screen_update_docastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51   void video_start_common( UINT32 tile_transmask );
52   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
5153};
trunk/src/mame/includes/ddragon3.h
r20764r20765
5050   UINT32 screen_update_ddragon3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5151   UINT32 screen_update_ctribe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5252   TIMER_DEVICE_CALLBACK_MEMBER(ddragon3_scanline);
53   void draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect );
5354};
trunk/src/mame/includes/dragrace.h
r20764r20765
5656   virtual void palette_init();
5757   UINT32 screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5858   TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback);
59   void dragrace_update_misc_flags( address_space &space );
5960};
6061
6162/*----------- defined in audio/dragrace.c -----------*/
trunk/src/mame/includes/dec0.h
r20764r20765
8282   UINT32 screen_update_hippodrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8383   UINT32 screen_update_slyspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8484   UINT32 screen_update_midres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
85   void update_24bitcol(int offset);
86   void baddudes_i8751_write(int data);
87   void birdtry_i8751_write(int data);
88   void dec0_i8751_write(int data);
89   void dec0_i8751_reset();
90   void h6280_decrypt(const char *cputag);
91   void slyspy_set_protection_map( int type);
8592};
8693
8794
trunk/src/mame/includes/drgnmst.h
r20764r20765
6767   virtual void machine_reset();
6868   virtual void video_start();
6969   UINT32 screen_update_drgnmst(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
70   void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
71   UINT8 drgnmst_asciitohex( UINT8 data );
7072};
trunk/src/mame/includes/djmain.h
r20764r20765
5757   INTERRUPT_GEN_MEMBER(vb_interrupt);
5858   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
5959   void sndram_set_bank();
60   void draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect);
6061};
6162
6263/*----------- defined in video/djmain.c -----------*/
trunk/src/mame/includes/ddribble.h
r20764r20765
6262   UINT32 screen_update_ddribble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6363   INTERRUPT_GEN_MEMBER(ddribble_interrupt_0);
6464   INTERRUPT_GEN_MEMBER(ddribble_interrupt_1);
65   void set_pens(  );
66   void draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* source, int lenght, int gfxset, int flipscreen );
6567};
trunk/src/mame/includes/dkong.h
r20764r20765
225225   DECLARE_READ8_MEMBER(dkong_voice_status_r);
226226   DECLARE_READ8_MEMBER(dkong_tune_r);
227227   DECLARE_WRITE8_MEMBER(dkong_p1_w);
228   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 mask_bank, UINT32 shift_bits);
229   inline double CD4049(double x);
230   void radarscp_step(int line_cnt);
231   void radarscp_draw_background(dkong_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect);
232   void radarscp_scanline(int scanline);
233   void check_palette();
234   void dkong_init_device_driver_data(  );
235   void braze_decrypt_rom(UINT8 *dest);
236   void drakton_decrypt_rom(UINT8 mod, int offs, int *bs);
228237};
229238
230239/*----------- defined in audio/dkong.c -----------*/
trunk/src/mame/includes/darkseal.h
r20764r20765
3535   DECLARE_DRIVER_INIT(darkseal);
3636   virtual void video_start();
3737   UINT32 screen_update_darkseal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
38   void update_24bitcol(int offset);
3839};
trunk/src/mame/includes/dday.h
r20764r20765
5252   virtual void palette_init();
5353   UINT32 screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5454   TIMER_CALLBACK_MEMBER(countdown_timer_callback);
55   void start_countdown_timer();
5556};
trunk/src/mame/includes/deco32.h
r20764r20765
121121   INTERRUPT_GEN_MEMBER(deco32_vbl_interrupt);
122122   TIMER_DEVICE_CALLBACK_MEMBER(interrupt_gen);
123123   TIMER_DEVICE_CALLBACK_MEMBER(lockload_vbl_irq);
124   void updateAceRam();
125   void mixDualAlphaSprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx0, gfx_element *gfx1, int mixAlphaTilemap);
124126};
125127
126128class dragngun_state : public deco32_state
r20764r20765
149151   DECLARE_VIDEO_START(lockload);
150152   UINT32 screen_update_dragngun(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
151153   void screen_eof_dragngun(screen_device &screen, bool state);
154   void dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata);   
152155};
153156
154157/*----------- defined in video/deco32.c -----------*/
trunk/src/mame/includes/ddragon.h
r20764r20765
103103   UINT32 screen_update_ddragon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
104104   TIMER_DEVICE_CALLBACK_MEMBER(ddragon_scanline);
105105   TIMER_DEVICE_CALLBACK_MEMBER(chinagat_scanline);
106   void draw_sprites(  bitmap_ind16 &bitmap,const rectangle &cliprect );
107   int scanline_to_vcount( int scanline );
106108};
trunk/src/mame/includes/deniam.h
r20764r20765
6161   virtual void machine_reset();
6262   virtual void video_start();
6363   UINT32 screen_update_deniam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
64   void deniam_common_init(  );
65   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
66   void set_bg_page( int page, int value );
67   void set_fg_page( int page, int value );
6468};
trunk/src/mame/includes/dec8.h
r20764r20765
133133   INTERRUPT_GEN_MEMBER(gondo_interrupt);
134134   INTERRUPT_GEN_MEMBER(oscar_interrupt);
135135   TIMER_CALLBACK_MEMBER(dec8_i8751_timer_callback);
136   void srdarwin_draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
136137};
137138
138139/*----------- defined in video/dec8.c -----------*/
trunk/src/mame/includes/dcheese.h
r20764r20765
5454   void update_irq_state();
5555   IRQ_CALLBACK_MEMBER(irq_callback);
5656   void update_scanline_irq();
57   void do_clear(  );
58   void do_blit(  );
5759};
5860
5961/*----------- defined in drivers/dcheese.c -----------*/
trunk/src/mame/includes/dooyong.h
r20764r20765
8888   UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8989   UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9090   TIMER_DEVICE_CALLBACK_MEMBER(rshark_scanline);
91   inline void dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map);
92   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions);
93   void rshark_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
9194};
trunk/src/mame/video/dcheese.c
r20764r20765
136136 *
137137 *************************************/
138138
139static void do_clear( running_machine &machine )
139void dcheese_state::do_clear(  )
140140{
141   dcheese_state *state = machine.driver_data<dcheese_state>();
142141   int y;
143142
144143   /* clear the requested scanlines */
145   for (y = state->m_blitter_vidparam[0x2c/2]; y < state->m_blitter_vidparam[0x2a/2]; y++)
146      memset(&state->m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT), 0, DSTBITMAP_WIDTH * 2);
144   for (y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++)
145      memset(&m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT), 0, DSTBITMAP_WIDTH * 2);
147146
148147   /* signal an IRQ when done (timing is just a guess) */
149   machine.scheduler().timer_set(machine.primary_screen->scan_period(), timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),state), 1);
148   machine().scheduler().timer_set(machine().primary_screen->scan_period(), timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),this), 1);
150149}
151150
152151
153static void do_blit( running_machine &machine )
152void dcheese_state::do_blit(  )
154153{
155   dcheese_state *state = machine.driver_data<dcheese_state>();
156   INT32 srcminx = state->m_blitter_xparam[0] << 12;
157   INT32 srcmaxx = state->m_blitter_xparam[1] << 12;
158   INT32 srcminy = state->m_blitter_yparam[0] << 12;
159   INT32 srcmaxy = state->m_blitter_yparam[1] << 12;
160   INT32 srcx = ((state->m_blitter_xparam[2] & 0x0fff) | ((state->m_blitter_xparam[3] & 0x0fff) << 12)) << 7;
161   INT32 srcy = ((state->m_blitter_yparam[2] & 0x0fff) | ((state->m_blitter_yparam[3] & 0x0fff) << 12)) << 7;
162   INT32 dxdx = (INT32)(((state->m_blitter_xparam[4] & 0x0fff) | ((state->m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12;
163   INT32 dxdy = (INT32)(((state->m_blitter_xparam[6] & 0x0fff) | ((state->m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12;
164   INT32 dydx = (INT32)(((state->m_blitter_yparam[4] & 0x0fff) | ((state->m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12;
165   INT32 dydy = (INT32)(((state->m_blitter_yparam[6] & 0x0fff) | ((state->m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12;
166   UINT8 *src = state->memregion("gfx1")->base();
167   UINT32 pagemask = (state->memregion("gfx1")->bytes() - 1) / 0x40000;
168   int xstart = state->m_blitter_xparam[14];
169   int xend = state->m_blitter_xparam[15] + 1;
170   int ystart = state->m_blitter_yparam[14];
171   int yend = state->m_blitter_yparam[15];
172   int color = (state->m_blitter_color[0] << 8) & 0xff00;
173   int mask = (state->m_blitter_color[0] >> 8) & 0x00ff;
154   INT32 srcminx = m_blitter_xparam[0] << 12;
155   INT32 srcmaxx = m_blitter_xparam[1] << 12;
156   INT32 srcminy = m_blitter_yparam[0] << 12;
157   INT32 srcmaxy = m_blitter_yparam[1] << 12;
158   INT32 srcx = ((m_blitter_xparam[2] & 0x0fff) | ((m_blitter_xparam[3] & 0x0fff) << 12)) << 7;
159   INT32 srcy = ((m_blitter_yparam[2] & 0x0fff) | ((m_blitter_yparam[3] & 0x0fff) << 12)) << 7;
160   INT32 dxdx = (INT32)(((m_blitter_xparam[4] & 0x0fff) | ((m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12;
161   INT32 dxdy = (INT32)(((m_blitter_xparam[6] & 0x0fff) | ((m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12;
162   INT32 dydx = (INT32)(((m_blitter_yparam[4] & 0x0fff) | ((m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12;
163   INT32 dydy = (INT32)(((m_blitter_yparam[6] & 0x0fff) | ((m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12;
164   UINT8 *src = memregion("gfx1")->base();
165   UINT32 pagemask = (memregion("gfx1")->bytes() - 1) / 0x40000;
166   int xstart = m_blitter_xparam[14];
167   int xend = m_blitter_xparam[15] + 1;
168   int ystart = m_blitter_yparam[14];
169   int yend = m_blitter_yparam[15];
170   int color = (m_blitter_color[0] << 8) & 0xff00;
171   int mask = (m_blitter_color[0] >> 8) & 0x00ff;
174172   int opaque = (dxdx | dxdy | dydx | dydy) == 0;  /* bit of a hack for fredmem */
175173   int x, y;
176174
177175   /* loop over target rows */
178176   for (y = ystart; y <= yend; y++)
179177   {
180      UINT16 *dst = &state->m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT);
178      UINT16 *dst = &m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT);
181179
182180      /* loop over target columns */
183181      for (x = xstart; x <= xend; x++)
r20764r20765
201199   }
202200
203201   /* signal an IRQ when done (timing is just a guess) */
204   machine.scheduler().timer_set(machine.primary_screen->scan_period() / 2, timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),state), 2);
202   machine().scheduler().timer_set(machine().primary_screen->scan_period() / 2, timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),this), 2);
205203
206204   /* these extra parameters are written but they are always zero, so I don't know what they do */
207   if (state->m_blitter_xparam[8] != 0 || state->m_blitter_xparam[9] != 0 || state->m_blitter_xparam[10] != 0 || state->m_blitter_xparam[11] != 0 ||
208      state->m_blitter_yparam[8] != 0 || state->m_blitter_yparam[9] != 0 || state->m_blitter_yparam[10] != 0 || state->m_blitter_yparam[11] != 0)
205   if (m_blitter_xparam[8] != 0 || m_blitter_xparam[9] != 0 || m_blitter_xparam[10] != 0 || m_blitter_xparam[11] != 0 ||
206      m_blitter_yparam[8] != 0 || m_blitter_yparam[9] != 0 || m_blitter_yparam[10] != 0 || m_blitter_yparam[11] != 0)
209207   {
210      logerror("%s:blit! (%04X)\n", machine.describe_context(), state->m_blitter_color[0]);
208      logerror("%s:blit! (%04X)\n", machine().describe_context(), m_blitter_color[0]);
211209      logerror("   %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n",
212            state->m_blitter_xparam[0], state->m_blitter_xparam[1], state->m_blitter_xparam[2], state->m_blitter_xparam[3],
213            state->m_blitter_xparam[4], state->m_blitter_xparam[5], state->m_blitter_xparam[6], state->m_blitter_xparam[7],
214            state->m_blitter_xparam[8], state->m_blitter_xparam[9], state->m_blitter_xparam[10], state->m_blitter_xparam[11],
215            state->m_blitter_xparam[12], state->m_blitter_xparam[13], state->m_blitter_xparam[14], state->m_blitter_xparam[15]);
210            m_blitter_xparam[0], m_blitter_xparam[1], m_blitter_xparam[2], m_blitter_xparam[3],
211            m_blitter_xparam[4], m_blitter_xparam[5], m_blitter_xparam[6], m_blitter_xparam[7],
212            m_blitter_xparam[8], m_blitter_xparam[9], m_blitter_xparam[10], m_blitter_xparam[11],
213            m_blitter_xparam[12], m_blitter_xparam[13], m_blitter_xparam[14], m_blitter_xparam[15]);
216214      logerror("   %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n",
217            state->m_blitter_yparam[0], state->m_blitter_yparam[1], state->m_blitter_yparam[2], state->m_blitter_yparam[3],
218            state->m_blitter_yparam[4], state->m_blitter_yparam[5], state->m_blitter_yparam[6], state->m_blitter_yparam[7],
219            state->m_blitter_yparam[8], state->m_blitter_yparam[9], state->m_blitter_yparam[10], state->m_blitter_yparam[11],
220            state->m_blitter_yparam[12], state->m_blitter_yparam[13], state->m_blitter_yparam[14], state->m_blitter_yparam[15]);
215            m_blitter_yparam[0], m_blitter_yparam[1], m_blitter_yparam[2], m_blitter_yparam[3],
216            m_blitter_yparam[4], m_blitter_yparam[5], m_blitter_yparam[6], m_blitter_yparam[7],
217            m_blitter_yparam[8], m_blitter_yparam[9], m_blitter_yparam[10], m_blitter_yparam[11],
218            m_blitter_yparam[12], m_blitter_yparam[13], m_blitter_yparam[14], m_blitter_yparam[15]);
221219   }
222220}
223221
r20764r20765
277275         break;
278276
279277      case 0x38/2:        /* blit */
280         do_blit(machine());
278         do_blit();
281279         break;
282280
283281      case 0x3e/2:        /* clear */
284         do_clear(machine());
282         do_clear();
285283         break;
286284
287285      default:
trunk/src/mame/video/dooyong.c
r20764r20765
22#include "includes/dooyong.h"
33
44
5INLINE void dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map)
5inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map)
66{
77   UINT8 old = scroll[offset];
88   if (old != data)
r20764r20765
3030         /* 0x02 is initialised on startup by some games and written to continuously by others */
3131         /*{
3232             const char *name;
33             if (scroll == state->m_bgscroll8)        name = "bg";
34             else if (scroll == state->m_bg2scroll8)  name = "bg2";
35             else if (scroll == state->m_fgscroll8)   name = "fg";
36             else if (scroll == state->m_fg2scroll8)  name = "fg2";
33             if (scroll == m_bgscroll8)        name = "bg";
34             else if (scroll == m_bg2scroll8)  name = "bg2";
35             else if (scroll == m_fgscroll8)   name = "fg";
36             else if (scroll == m_fg2scroll8)  name = "fg2";
3737             else                            name = "unknown";
3838             printf("Unknown %s tilemap control: 0x%02x = 0x%02x\n", name, (unsigned)offset, (unsigned)data);
3939         }*/
r20764r20765
334334}
335335
336336
337static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions)
337void dooyong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions)
338338{
339339   /* Sprites take 32 bytes each in memory:
340340                    MSB   LSB
r20764r20765
359359      height only used by pollux, bluehawk and flytiger
360360      x flip and y flip only used by pollux and flytiger */
361361
362   dooyong_state *state = machine.driver_data<dooyong_state>();
363   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
362   UINT8 *buffered_spriteram = m_spriteram->buffer();
364363   int offs;
365364
366   for (offs = 0; offs < state->m_spriteram->bytes(); offs += 32)
365   for (offs = 0; offs < m_spriteram->bytes(); offs += 32)
367366   {
368367      int sx, sy, code, color, pri;
369368      int flipx = 0, flipy = 0, height = 0, y;
r20764r20765
404403         }
405404      }
406405
407      if (state->flip_screen())
406      if (flip_screen())
408407      {
409408         sx = 498 - sx;
410409         sy = 240 - (16 * height) - sy;
r20764r20765
414413
415414      for (y = 0; y <= height; y++)
416415      {
417         pdrawgfx_transpen(bitmap, cliprect, machine.gfx[1],
416         pdrawgfx_transpen(bitmap, cliprect, machine().gfx[1],
418417               code + y,
419418               color,
420419               flipx, flipy,
421420               sx, sy + (16 * (flipy ? (height - y) : y)),
422               machine.priority_bitmap,
421               machine().priority_bitmap,
423422               pri, 15);
424423      }
425424   }
426425}
427426
428static void rshark_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
427void dooyong_state::rshark_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
429428{
430   dooyong_state *state = machine.driver_data<dooyong_state>();
431   UINT16 *buffered_spriteram16 = state->m_spriteram16->buffer();
429   UINT16 *buffered_spriteram16 = m_spriteram16->buffer();
432430
433431   /* Sprites take 8 16-bit words each in memory:
434432                 MSB             LSB
r20764r20765
451449
452450   int offs;
453451
454   for (offs = (state->m_spriteram16->bytes() / 2) - 8; offs >= 0; offs -= 8)
452   for (offs = (m_spriteram16->bytes() / 2) - 8; offs >= 0; offs -= 8)
455453   {
456454      if (buffered_spriteram16[offs] & 0x0001)    /* enable */
457455      {
r20764r20765
469467         width = buffered_spriteram16[offs+1] & 0x000f;
470468         height = (buffered_spriteram16[offs+1] & 0x00f0) >> 4;
471469
472         if (state->flip_screen())
470         if (flip_screen())
473471         {
474472            sx = 498 - (16 * width) - sx;
475473            sy = 240 - (16 * height) - sy;
r20764r20765
483481            for (x = 0; x <= width; x++)
484482            {
485483               int _x = sx + (16 * (flipx ? (width - x) : x));
486               pdrawgfx_transpen(bitmap, cliprect, machine.gfx[0],
484               pdrawgfx_transpen(bitmap, cliprect, machine().gfx[0],
487485                     code,
488486                     color,
489487                     flipx, flipy,
490488                     _x, _y,
491                     machine.priority_bitmap,
489                     machine().priority_bitmap,
492490                     pri, 15);
493491               code++;
494492            }
r20764r20765
508506   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
509507
510508   if (!m_sprites_disabled)
511      draw_sprites(machine(), bitmap, cliprect, 0);
509      draw_sprites(bitmap, cliprect, 0);
512510   return 0;
513511}
514512
r20764r20765
521519   m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
522520   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
523521
524   draw_sprites(machine(), bitmap, cliprect, 1);
522   draw_sprites(bitmap, cliprect, 1);
525523   return 0;
526524}
527525
r20764r20765
534532   m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
535533   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
536534
537   draw_sprites(machine(), bitmap, cliprect, 2);
535   draw_sprites(bitmap, cliprect, 2);
538536   return 0;
539537}
540538
r20764r20765
555553   }
556554   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
557555
558   draw_sprites(machine(), bitmap, cliprect, 4);
556   draw_sprites(bitmap, cliprect, 4);
559557   return 0;
560558}
561559
r20764r20765
570568   m_fg2_tilemap->draw(bitmap, cliprect, 0, 4);
571569   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
572570
573   draw_sprites(machine(), bitmap, cliprect, 3);
571   draw_sprites(bitmap, cliprect, 3);
574572   return 0;
575573}
576574
r20764r20765
595593   m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
596594   m_fg2_tilemap->draw(bitmap, cliprect, 0, 2);
597595
598   rshark_draw_sprites(machine(), bitmap, cliprect);
596   rshark_draw_sprites(bitmap, cliprect);
599597   return 0;
600598}
601599
r20764r20765
606604
607605   m_bg_tilemap->draw(bitmap, cliprect, 0, 1);
608606
609   rshark_draw_sprites(machine(), bitmap, cliprect);
607   rshark_draw_sprites(bitmap, cliprect);
610608   return 0;
611609}
612610
trunk/src/mame/video/dynduke.c
r20764r20765
126126   }
127127}
128128
129static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
129void dynduke_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
130130{
131   dynduke_state *state = machine.driver_data<dynduke_state>();
132   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
131   UINT16 *buffered_spriteram16 = m_spriteram->buffer();
133132   int offs,fx,fy,x,y,color,sprite;
134133
135   if (!state->m_sprite_enable) return;
134   if (!m_sprite_enable) return;
136135
137136   for (offs = 0x800-4;offs >= 0;offs -= 4)
138137   {
r20764r20765
151150      sprite = buffered_spriteram16[offs+1];
152151      sprite &= 0x3fff;
153152
154      if (state->flip_screen()) {
153      if (flip_screen()) {
155154         x=240-x;
156155         y=240-y;
157156         if (fx) fx=0; else fx=1;
158157         if (fy) fy=0; else fy=1;
159158      }
160159
161      drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
160      drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
162161            sprite,
163162            color,fx,fy,x,y,15);
164163   }
165164}
166165
167static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
166void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
168167{
169   dynduke_state *state = machine.driver_data<dynduke_state>();
170168   /* The transparency / palette handling on the background layer is very strange */
171   bitmap_ind16 &bm = state->m_bg_layer->pixmap();
169   bitmap_ind16 &bm = m_bg_layer->pixmap();
172170   int scrolly, scrollx;
173171   int x,y;
174172
175173   /* if we're disabled, don't draw */
176   if (!state->m_back_enable)
174   if (!m_back_enable)
177175   {
178      bitmap.fill(get_black_pen(machine), cliprect);
176      bitmap.fill(get_black_pen(machine()), cliprect);
179177      return;
180178   }
181179
182   scrolly = ((state->m_scroll_ram[0x01]&0x30)<<4)+((state->m_scroll_ram[0x02]&0x7f)<<1)+((state->m_scroll_ram[0x02]&0x80)>>7);
183   scrollx = ((state->m_scroll_ram[0x09]&0x30)<<4)+((state->m_scroll_ram[0x0a]&0x7f)<<1)+((state->m_scroll_ram[0x0a]&0x80)>>7);
180   scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7);
181   scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7);
184182
185183   for (y=0;y<256;y++)
186184   {
r20764r20765
206204         if ((srcdat & 0x20) == pri)
207205         {
208206            if (srcdat & 0x10) srcdat += 0x400;
209            //if (srcdat & 0x10) srcdat += machine.rand()&0x1f;
207            //if (srcdat & 0x10) srcdat += machine().rand()&0x1f;
210208
211209            srcdat = (srcdat & 0x000f) | ((srcdat & 0xffc0) >> 2);
212210            dst[x] = srcdat;
r20764r20765
226224   m_tx_layer->enable(m_txt_enable);
227225
228226
229   draw_background(machine(), bitmap, cliprect,0x00);
230   draw_sprites(machine(),bitmap,cliprect,0); // Untested: does anything use it? Could be behind background
231   draw_sprites(machine(),bitmap,cliprect,1);
232   draw_background(machine(), bitmap, cliprect,0x20);
227   draw_background(bitmap, cliprect,0x00);
228   draw_sprites(bitmap,cliprect,0); // Untested: does anything use it? Could be behind background
229   draw_sprites(bitmap,cliprect,1);
230   draw_background(bitmap, cliprect,0x20);
233231
234   draw_sprites(machine(),bitmap,cliprect,2);
232   draw_sprites(bitmap,cliprect,2);
235233   m_fg_layer->draw(bitmap, cliprect, 0,0);
236   draw_sprites(machine(),bitmap,cliprect,3);
234   draw_sprites(bitmap,cliprect,3);
237235   m_tx_layer->draw(bitmap, cliprect, 0,0);
238236
239237   return 0;
trunk/src/mame/video/deadang.c
r20764r20765
8181   m_text_layer->set_transparent_pen(15);
8282}
8383
84static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
84void deadang_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
8585{
86   deadang_state *state = machine.driver_data<deadang_state>();
87   UINT16 *spriteram16 = state->m_spriteram;
86   UINT16 *spriteram16 = m_spriteram;
8887   int offs,fx,fy,x,y,color,sprite,pri;
8988
9089   for (offs = 0; offs<0x800/2; offs+=4)
r20764r20765
110109      color = (spriteram16[offs+1]>>12)&0xf;
111110      sprite = spriteram16[offs+1]&0xfff;
112111
113      if (state->flip_screen()) {
112      if (flip_screen()) {
114113         x=240-x;
115114         y=240-y;
116115         if (fx) fx=0; else fx=1;
117116         if (fy) fy=0; else fy=1;
118117      }
119118
120      pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
119      pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
121120            sprite,
122121            color,fx,fy,x,y,
123            machine.priority_bitmap,pri,15);
122            machine().priority_bitmap,pri,15);
124123   }
125124}
126125
r20764r20765
154153   m_pf3_layer->draw(bitmap, cliprect, 0,1);
155154   m_pf1_layer->draw(bitmap, cliprect, 0,2);
156155   m_pf2_layer->draw(bitmap, cliprect, 0,4);
157   if (!(m_scroll_ram[0x34]&0x10)) draw_sprites(machine(),bitmap,cliprect);
156   if (!(m_scroll_ram[0x34]&0x10)) draw_sprites(bitmap,cliprect);
158157   m_text_layer->draw(bitmap, cliprect, 0,0);
159158   return 0;
160159}
trunk/src/mame/video/dogfgt.c
r20764r20765
170170
171171***************************************************************************/
172172
173static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
173void dogfgt_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
174174{
175   dogfgt_state *state = machine.driver_data<dogfgt_state>();
176175   int offs;
177176
178   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
177   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
179178   {
180      if (state->m_spriteram[offs] & 0x01)
179      if (m_spriteram[offs] & 0x01)
181180      {
182181         int sx, sy, flipx, flipy;
183182
184         sx = state->m_spriteram[offs + 3];
185         sy = (240 - state->m_spriteram[offs + 2]) & 0xff;
186         flipx = state->m_spriteram[offs] & 0x04;
187         flipy = state->m_spriteram[offs] & 0x02;
188         if (state->flip_screen())
183         sx = m_spriteram[offs + 3];
184         sy = (240 - m_spriteram[offs + 2]) & 0xff;
185         flipx = m_spriteram[offs] & 0x04;
186         flipy = m_spriteram[offs] & 0x02;
187         if (flip_screen())
189188         {
190189            sx = 240 - sx;
191190            sy = 240 - sy;
r20764r20765
193192            flipy = !flipy;
194193         }
195194
196         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
197               state->m_spriteram[offs + 1] + ((state->m_spriteram[offs] & 0x30) << 4),
198               (state->m_spriteram[offs] & 0x08) >> 3,
195         drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
196               m_spriteram[offs + 1] + ((m_spriteram[offs] & 0x30) << 4),
197               (m_spriteram[offs] & 0x08) >> 3,
199198               flipx,flipy,
200199               sx,sy,0);
201200      }
r20764r20765
221220
222221   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
223222
224   draw_sprites(machine(), bitmap, cliprect);
223   draw_sprites(bitmap, cliprect);
225224
226225   copybitmap_trans(bitmap, m_pixbitmap, 0, 0, 0, 0, cliprect, PIXMAP_COLOR_BASE + 8 * m_pixcolor);
227226   return 0;
trunk/src/mame/video/dkong.c
r20764r20765
543543
544544***************************************************************************/
545545
546static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 mask_bank, UINT32 shift_bits)
546void dkong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 mask_bank, UINT32 shift_bits)
547547{
548   dkong_state *state = machine.driver_data<dkong_state>();
549548   int offs;
550549   int scanline_vf;    /* buffering scanline including flip */
551550   int scanline_vfc;   /* line buffering scanline including flip - this is the cached scanline_vf */
r20764r20765
595594   scanline_vfc = (cliprect.max_y - 1) & 0xFF;
596595   scanline = cliprect.max_y & 0xFF;
597596
598   if (state->m_flip)
597   if (m_flip)
599598   {
600599      scanline_vf ^= 0xFF;
601600      scanline_vfc ^= 0xFF;
r20764r20765
608607      add_x = 0xF7;
609608   }
610609
611   for (offs = state->m_sprite_bank<<9, num_sprt=0; (num_sprt < 16) && (offs < (state->m_sprite_bank<<9) + 0x200) /* sprite_ram_size */; offs += 4)
610   for (offs = m_sprite_bank<<9, num_sprt=0; (num_sprt < 16) && (offs < (m_sprite_bank<<9) + 0x200) /* sprite_ram_size */; offs += 4)
612611   {
613      int y = state->m_sprite_ram[offs];
612      int y = m_sprite_ram[offs];
614613      int do_draw = (((y + add_y + 1 + scanline_vf) & 0xF0) == 0xF0) ? 1 : 0;
615614
616615      if (do_draw)
r20764r20765
621620         /* has similar hardware, uses a memory mapped port to change */
622621         /* palette bank, so it's limited to 16 color codes) */
623622
624         int code = (state->m_sprite_ram[offs + 1] & 0x7f) + ((state->m_sprite_ram[offs + 2] & mask_bank) << shift_bits);
625         int color = (state->m_sprite_ram[offs + 2] & 0x0f) + 16 * state->m_palette_bank;
626         int flipx = state->m_sprite_ram[offs + 2] & 0x80;
627         int flipy = state->m_sprite_ram[offs + 1] & 0x80;
623         int code = (m_sprite_ram[offs + 1] & 0x7f) + ((m_sprite_ram[offs + 2] & mask_bank) << shift_bits);
624         int color = (m_sprite_ram[offs + 2] & 0x0f) + 16 * m_palette_bank;
625         int flipx = m_sprite_ram[offs + 2] & 0x80;
626         int flipy = m_sprite_ram[offs + 1] & 0x80;
628627
629628         /* On the real board, the x and y are read inverted after the first
630629          * buffer stage. This due to the fact that the 82S09 delivers complements
631630          * of stored data on read!
632631          */
633632
634         int x = (state->m_sprite_ram[offs + 3] + add_x + 1) & 0xFF;
635         if (state->m_flip)
633         int x = (m_sprite_ram[offs + 3] + add_x + 1) & 0xFF;
634         if (m_flip)
636635         {
637636            x = (x ^ 0xFF) - 15;
638637            flipx = !flipx;
639638         }
640639         y = scanline - ((y + add_y + 1 + scanline_vfc) & 0x0F);
641640
642         drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, x, y, 0);
641         drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, x, y, 0);
643642
644643         // wraparound
645         drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, state->m_flip ? x + 256 : x - 256, y, 0);
646         drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, x, y - 256, 0);
644         drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, m_flip ? x + 256 : x - 256, y, 0);
645         drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, x, y - 256, 0);
647646
648647         num_sprt++;
649648      }
r20764r20765
668667 * TODO: This should be part of the vblank routine
669668 */
670669
671INLINE double CD4049(running_machine &machine, double x)
670inline double dkong_state::CD4049(double x)
672671{
673   dkong_state *state = machine.driver_data<dkong_state>();
674672
675673   if (x>0)
676      return exp(-state->m_cd4049_a * pow(x,state->m_cd4049_b));
674      return exp(-m_cd4049_a * pow(x,m_cd4049_b));
677675   else
678676      return 1.0;
679677}
r20764r20765
690688#define dt      (1./60./(double) VTOTAL)
691689#define period2 (((INT64)(PIXEL_CLOCK) * ( 33L * 68L )) / (INT32)10000000L / 3)  /*  period/2 in pixel ... */
692690
693static void radarscp_step(running_machine &machine, int line_cnt)
691void dkong_state::radarscp_step(int line_cnt)
694692{
695   dkong_state *state = machine.driver_data<dkong_state>();
696693
697694   /* Condensator is illegible in schematics for TRS2 board.
698695    * TRS1 board states 3.3u.
r20764r20765
709706
710707   if ( line_cnt == 0)
711708   {
712      state->m_sig30Hz = (1-state->m_sig30Hz);
713      if (state->m_sig30Hz)
714         state->m_lfsr_5I = (machine.rand() > RAND_MAX/2);
709      m_sig30Hz = (1-m_sig30Hz);
710      if (m_sig30Hz)
711         m_lfsr_5I = (machine().rand() > RAND_MAX/2);
715712   }
716713
717714   /* sound2 mixes in a 30Hz noise signal.
r20764r20765
720717    */
721718
722719   /* Now mix with SND02 (sound 2) line - on 74ls259, bit2 */
723   address_space &space = machine.driver_data()->generic_space();
724   state->m_rflip_sig = latch8_bit2_r(state->m_dev_6h, space, 0) & state->m_lfsr_5I;
720   address_space &space = machine().driver_data()->generic_space();
721   m_rflip_sig = latch8_bit2_r(m_dev_6h, space, 0) & m_lfsr_5I;
725722
726723   /* blue background generation */
727724
r20764r20765
729726   if (line_cnt>511)
730727      line_cnt -= VTOTAL;
731728
732   sig = state->m_rflip_sig ^ ((line_cnt & 0x80)>>7);
729   sig = m_rflip_sig ^ ((line_cnt & 0x80)>>7);
733730
734   if (state->m_hardware_type == HARDWARE_TRS01)
735      state->m_rflip_sig = !state->m_rflip_sig;
731   if (m_hardware_type == HARDWARE_TRS01)
732      m_rflip_sig = !m_rflip_sig;
736733
737734   if  (sig) /*  128VF */
738      diff = (0.0 - state->m_cv1);
735      diff = (0.0 - m_cv1);
739736   else
740      diff = (4.8 - state->m_cv1);
737      diff = (4.8 - m_cv1);
741738   diff = diff - diff*exp(0.0 - (1.0/RC1 * dt) );
742   state->m_cv1 += diff;
739   m_cv1 += diff;
743740
744   diff = (state->m_cv1 - state->m_cv2 - state->m_vg1);
741   diff = (m_cv1 - m_cv2 - m_vg1);
745742   diff = diff - diff*exp(0.0 - (1.0/RC2 * dt) );
746   state->m_cv2 += diff;
743   m_cv2 += diff;
747744
748745   // FIXME: use the inverse function
749746   // Solve the amplifier by iteration
750747   for (int j=1; j<=11; j++)// 11% = 1/75 / (1/75+1/10)
751748   {
752749      double f = (double) j / 100.0f;
753      state->m_vg1 = (state->m_cv1 - state->m_cv2)*(1-f) + f * state->m_vg2;
754      state->m_vg2 = 5*CD4049(machine, state->m_vg1/5);
750      m_vg1 = (m_cv1 - m_cv2)*(1-f) + f * m_vg2;
751      m_vg2 = 5*CD4049(m_vg1/5);
755752   }
756753   // FIXME: use the inverse function
757754   // Solve the amplifier by iteration 50% = both resistors equal
758755   for (int j=10; j<=20; j++)
759756   {
760757      double f = (double) j / 40.0f;
761      vg3i = (1.0f-f) * state->m_vg2 + f * state->m_vg3;
762      state->m_vg3 = 5*CD4049(machine, vg3i/5);
758      vg3i = (1.0f-f) * m_vg2 + f * m_vg3;
759      m_vg3 = 5*CD4049(vg3i/5);
763760   }
764761
765762#define RC17 (33e-6 * 1e3 * (0*4.7+1.0/(1.0/10.0+1.0/20.0+0.0/0.3)))
766   diff = (state->m_vg3 - state->m_vc17);
763   diff = (m_vg3 - m_vc17);
767764   diff = diff - diff*exp(0.0 - (1.0/RC17 * dt) );
768   state->m_vc17 += diff;
765   m_vc17 += diff;
769766
770   double vo = (state->m_vg3 - state->m_vc17);
767   double vo = (m_vg3 - m_vc17);
771768   vo = vo + 20.0 / (20.0+10.0) * 5;
772769
773770   // Transistor is marked as OMIT in TRS-02 schems.
r20764r20765
778775   //vo = vo / (1.0 / 4.7 + 1.0 / 16.0 + 1.0 / 30.0 );
779776   //printf("%f %f\n", vg3, vc17);
780777
781   state->m_blue_level = (int)(vo/5.0*255);
782   //printf("%d\n", state->m_blue_level);
778   m_blue_level = (int)(vo/5.0*255);
779   //printf("%d\n", m_blue_level);
783780
784781   /*
785782    * Grid signal
786783    *
787784    * Mixed with ANS line (bit 5) from Port B of 8039
788785    */
789   if (state->m_grid_on && latch8_bit5_r(state->m_dev_vp2, space, 0))
786   if (m_grid_on && latch8_bit5_r(m_dev_vp2, space, 0))
790787   {
791      diff = (0.0 - state->m_cv3);
788      diff = (0.0 - m_cv3);
792789      diff = diff - diff*exp(0.0 - (1.0/RC32 * dt) );
793790   }
794791   else
795792   {
796      diff = (5.0 - state->m_cv3);
793      diff = (5.0 - m_cv3);
797794      diff = diff - diff*exp(0.0 - (1.0/RC31 * dt) );
798795   }
799   state->m_cv3 += diff;
796   m_cv3 += diff;
800797
801   diff = (state->m_vg2 - 0.8 * state->m_cv3 - state->m_cv4);
798   diff = (m_vg2 - 0.8 * m_cv3 - m_cv4);
802799   diff = diff - diff*exp(0.0 - (1.0/RC4 * dt) );
803   state->m_cv4 += diff;
800   m_cv4 += diff;
804801
805   if (CD4049(machine, CD4049(machine, (state->m_vg2 - state->m_cv4)/5.0))>2.4/5.0) /* TTL - Level */
806      state->m_grid_sig = 0;
802   if (CD4049(CD4049((m_vg2 - m_cv4)/5.0))>2.4/5.0) /* TTL - Level */
803      m_grid_sig = 0;
807804   else
808      state->m_grid_sig = 1;
805      m_grid_sig = 1;
809806
810807   /* stars */
811   state->m_pixelcnt += HTOTAL;
812   if (state->m_pixelcnt > period2 )
808   m_pixelcnt += HTOTAL;
809   if (m_pixelcnt > period2 )
813810   {
814      state->m_star_ff = !state->m_star_ff;
815      state->m_pixelcnt = state->m_pixelcnt - period2;
811      m_star_ff = !m_star_ff;
812      m_pixelcnt = m_pixelcnt - period2;
816813   }
817814
818815}
819816
820static void radarscp_draw_background(running_machine &machine, dkong_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
817void dkong_state::radarscp_draw_background(dkong_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
821818{
822819   const UINT8     *htable = NULL;
823820   int             x,y;
824821   UINT8           draw_ok;
825822   UINT16          *pixel;
826823
827   if (state->m_hardware_type == HARDWARE_TRS01)
828      htable = state->m_gfx4;
824   if (m_hardware_type == HARDWARE_TRS01)
825      htable = m_gfx4;
829826
830827   y = cliprect.min_y;
831828   while (y <= cliprect.max_y)
r20764r20765
835832      {
836833         pixel = &bitmap.pix16(y, x);
837834         draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02);
838         if (state->m_hardware_type == HARDWARE_TRS01) /*  Check again from schematics */
839            draw_ok = draw_ok  && !((htable[ (!state->m_rflip_sig<<7) | (x>>2)] >>2) & 0x01);
835         if (m_hardware_type == HARDWARE_TRS01) /*  Check again from schematics */
836            draw_ok = draw_ok  && !((htable[ (!m_rflip_sig<<7) | (x>>2)] >>2) & 0x01);
840837         if (draw_ok)
841            *pixel = *(&state->m_bg_bits.pix16(y, x));
838            *pixel = *(&m_bg_bits.pix16(y, x));
842839         x++;
843840      }
844841      y++;
845842   }
846843}
847844
848static void radarscp_scanline(running_machine &machine, int scanline)
845void dkong_state::radarscp_scanline(int scanline)
849846{
850   dkong_state *state = machine.driver_data<dkong_state>();
851   const UINT8 *table = state->m_gfx3;
852   int         table_len = state->m_gfx3_len;
847   const UINT8 *table = m_gfx3;
848   int         table_len = m_gfx3_len;
853849   int             x,y,offset;
854850   UINT16          *pixel;
855   const rectangle &visarea = machine.primary_screen->visible_area();
851   const rectangle &visarea = machine().primary_screen->visible_area();
856852
857853   y = scanline;
858   radarscp_step(machine, y);
854   radarscp_step(y);
859855   if (y <= visarea.min_y || y > visarea.max_y)
860      state->m_counter = 0;
861   offset = (state->m_flip ^ state->m_rflip_sig) ? 0x000 : 0x400;
856      m_counter = 0;
857   offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400;
862858   x = 0;
863   while (x < machine.primary_screen->width())
859   while (x < machine().primary_screen->width())
864860   {
865      pixel = &state->m_bg_bits.pix16(y, x);
866      if ((state->m_counter < table_len) && (x == 4 * (table[state->m_counter|offset] & 0x7f)))
861      pixel = &m_bg_bits.pix16(y, x);
862      if ((m_counter < table_len) && (x == 4 * (table[m_counter|offset] & 0x7f)))
867863      {
868         if ( state->m_star_ff && (table[state->m_counter|offset] & 0x80) )  /* star */
864         if ( m_star_ff && (table[m_counter|offset] & 0x80) )  /* star */
869865            *pixel = RADARSCP_STAR_COL;
870         else if (state->m_grid_sig && !(table[state->m_counter|offset] & 0x80))         /* radar */
871            *pixel = RADARSCP_GRID_COL_OFFSET+state->m_grid_col;
866         else if (m_grid_sig && !(table[m_counter|offset] & 0x80))         /* radar */
867            *pixel = RADARSCP_GRID_COL_OFFSET+m_grid_col;
872868         else
873            *pixel = RADARSCP_BCK_COL_OFFSET + state->m_blue_level;
874         state->m_counter++;
869            *pixel = RADARSCP_BCK_COL_OFFSET + m_blue_level;
870         m_counter++;
875871      }
876872      else
877         *pixel = RADARSCP_BCK_COL_OFFSET + state->m_blue_level;
873         *pixel = RADARSCP_BCK_COL_OFFSET + m_blue_level;
878874      x++;
879875   }
880   while ((state->m_counter < table_len) && ( x < 4 * (table[state->m_counter|offset] & 0x7f)))
881      state->m_counter++;
876   while ((m_counter < table_len) && ( x < 4 * (table[m_counter|offset] & 0x7f)))
877      m_counter++;
882878}
883879
884880TIMER_CALLBACK_MEMBER(dkong_state::scanline_callback)
r20764r20765
886882   int scanline = param;
887883
888884   if ((m_hardware_type == HARDWARE_TRS02) || (m_hardware_type == HARDWARE_TRS01))
889      radarscp_scanline(machine(), scanline);
885      radarscp_scanline(scanline);
890886
891887   /* update any video up to the current scanline */
892888   machine().primary_screen->update_now();
r20764r20765
896892   m_scanline_timer->adjust(machine().primary_screen->time_until_pos(scanline), scanline);
897893}
898894
899static void check_palette(running_machine &machine)
895void dkong_state::check_palette()
900896{
901   dkong_state *state = machine.driver_data<dkong_state>();
902897   ioport_port *port;
903898   int newset;
904899
905   port = state->ioport("VIDHW");
900   port = ioport("VIDHW");
906901   if (port != NULL)
907902   {
908903      newset = port->read();
909      if (newset != state->m_vidhw)
904      if (newset != m_vidhw)
910905      {
911         state->m_vidhw = newset;
906         m_vidhw = newset;
912907         switch (newset)
913908         {
914909            case DKONG_RADARSCP_CONVERSION:
915               state->PALETTE_INIT_CALL_MEMBER(radarscp);
910               PALETTE_INIT_CALL_MEMBER(radarscp);
916911               break;
917912            case DKONG_BOARD:
918               state->PALETTE_INIT_CALL_MEMBER(dkong2b);
913               PALETTE_INIT_CALL_MEMBER(dkong2b);
919914               break;
920915         }
921916      }
r20764r20765
985980   {
986981      case HARDWARE_TKG02:
987982      case HARDWARE_TKG04:
988         check_palette(machine());
983         check_palette();
989984         m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
990         draw_sprites(machine(), bitmap, cliprect, 0x40, 1);
985         draw_sprites(bitmap, cliprect, 0x40, 1);
991986         break;
992987      case HARDWARE_TRS01:
993988      case HARDWARE_TRS02:
994989         m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
995         draw_sprites(machine(), bitmap, cliprect, 0x40, 1);
996         radarscp_draw_background(machine(), this, bitmap, cliprect);
990         draw_sprites(bitmap, cliprect, 0x40, 1);
991         radarscp_draw_background(this, bitmap, cliprect);
997992         break;
998993      default:
999994         fatalerror("Invalid hardware type in dkong_video_update\n");
r20764r20765
10271022   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
10281023
10291024   /* it uses sprite_ram[offs + 2] & 0x10 for sprite bank */
1030   draw_sprites(machine(), bitmap, cliprect, 0x10, 3);
1025   draw_sprites(bitmap, cliprect, 0x10, 3);
10311026   return 0;
10321027}
trunk/src/mame/video/dday.c
r20764r20765
3131      m_timer_value = 99;
3232}
3333
34static void start_countdown_timer(running_machine &machine)
34void dday_state::start_countdown_timer()
3535{
36   dday_state *state = machine.driver_data<dday_state>();
3736
38   state->m_timer_value = 0;
37   m_timer_value = 0;
3938
40   machine.scheduler().timer_pulse(attotime::from_seconds(1), timer_expired_delegate(FUNC(dday_state::countdown_timer_callback),state));
39   machine().scheduler().timer_pulse(attotime::from_seconds(1), timer_expired_delegate(FUNC(dday_state::countdown_timer_callback),this));
4140}
4241
4342
r20764r20765
219218   m_fg_tilemap->set_transparent_pen(0);
220219   m_text_tilemap->set_transparent_pen(0);
221220
222   start_countdown_timer(machine());
221   start_countdown_timer();
223222}
224223
225224WRITE8_MEMBER(dday_state::dday_bgvideoram_w)
trunk/src/mame/video/dassault.c
r20764r20765
2626   m_sprgen2->alloc_sprite_bitmap();
2727}
2828
29static void mixdassaultlayer(running_machine &machine, bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, UINT16 pri, UINT16 primask, UINT16 penbase, UINT8 alpha)
29void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, UINT16 pri, UINT16 primask, UINT16 penbase, UINT8 alpha)
3030{
3131   int y, x;
32   const pen_t *paldata = machine.pens;
32   const pen_t *paldata = machine().pens;
3333
3434   UINT16* srcline;
3535   UINT32* dstline;
r20764r20765
9797   /* The middle playfields can be swapped priority-wise */
9898   if ((priority & 3) == 0)
9999   {
100      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
100      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
101101      deco16ic_tilemap_2_draw(m_deco_tilegen1, bitmap, cliprect, 0, 2); // 2
102      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
102      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
103103      deco16ic_tilemap_1_draw(m_deco_tilegen2, bitmap, cliprect, 0, 16); // 16
104      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
105      mixdassaultlayer(machine(), bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 64?
106      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
104      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
105      mixdassaultlayer(bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 64?
106      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
107107
108108   }
109109   else if ((priority & 3) == 1)
110110   {
111      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
111      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
112112      deco16ic_tilemap_1_draw(m_deco_tilegen2, bitmap, cliprect, 0, 2); // 2
113      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
114      mixdassaultlayer(machine(), bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 16?
115      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
113      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
114      mixdassaultlayer(bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 16?
115      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
116116      deco16ic_tilemap_2_draw(m_deco_tilegen1, bitmap, cliprect, 0, 64); // 64
117      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
117      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
118118   }
119119   else if ((priority & 3) == 3)
120120   {
121      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
121      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0600, 0x0600,  0x400, 0xff); // 1
122122      deco16ic_tilemap_1_draw(m_deco_tilegen2, bitmap, cliprect, 0, 2); // 2
123      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
123      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0400, 0x0600,  0x400, 0xff); // 8
124124      deco16ic_tilemap_2_draw(m_deco_tilegen1, bitmap, cliprect, 0, 16); // 16
125      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
126      mixdassaultlayer(machine(), bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 64?
127      mixdassaultlayer(machine(), bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
125      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0200, 0x0600,  0x400, 0xff); // 32
126      mixdassaultlayer(bitmap, sprite_bitmap2, cliprect,  0x0000, 0x0000,  0x800, 0x80); // 64?
127      mixdassaultlayer(bitmap, sprite_bitmap1, cliprect,  0x0000, 0x0600,  0x400, 0xff); // 128
128128   }
129129   else
130130   {
trunk/src/mame/video/djmain.c
r20764r20765
1212
1313
1414
15static void draw_sprites(running_machine& machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
15void djmain_state::draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect)
1616{
17   djmain_state *state = machine.driver_data<djmain_state>();
18   device_t *k055555 = machine.device("k055555");
17   device_t *k055555 = machine().device("k055555");
1918   int offs, pri_code;
2019   int sortedlist[NUM_SPRITES];
2120
22   machine.gfx[0]->set_colorbase(k055555_read_register(k055555, K55_PALBASE_SUB2) * 0x400);
21   machine().gfx[0]->set_colorbase(k055555_read_register(k055555, K55_PALBASE_SUB2) * 0x400);
2322
2423   for (offs = 0; offs < NUM_SPRITES; offs++)
2524      sortedlist[offs] = -1;
r20764r20765
2726   /* prebuild a sorted table */
2827   for (offs = 0; offs < NUM_SPRITES * 4; offs += 4)
2928   {
30      if (state->m_obj_ram[offs] & 0x00008000)
29      if (m_obj_ram[offs] & 0x00008000)
3130      {
32         if (state->m_obj_ram[offs] & 0x80000000)
31         if (m_obj_ram[offs] & 0x80000000)
3332            continue;
3433
35         pri_code = state->m_obj_ram[offs] & (NUM_SPRITES - 1);
34         pri_code = m_obj_ram[offs] & (NUM_SPRITES - 1);
3635         sortedlist[pri_code] = offs;
3736      }
3837   }
r20764r20765
5352      offs = sortedlist[pri_code];
5453      if (offs == -1) continue;
5554
56      code = state->m_obj_ram[offs] >> 16;
57      flipx = (state->m_obj_ram[offs] >> 10) & 1;
58      flipy = (state->m_obj_ram[offs] >> 11) & 1;
59      size = sizetab[(state->m_obj_ram[offs] >> 8) & 3];
55      code = m_obj_ram[offs] >> 16;
56      flipx = (m_obj_ram[offs] >> 10) & 1;
57      flipy = (m_obj_ram[offs] >> 11) & 1;
58      size = sizetab[(m_obj_ram[offs] >> 8) & 3];
6059
61      ox = (INT16)(state->m_obj_ram[offs + 1] & 0xffff);
62      oy = (INT16)(state->m_obj_ram[offs + 1] >> 16);
60      ox = (INT16)(m_obj_ram[offs + 1] & 0xffff);
61      oy = (INT16)(m_obj_ram[offs + 1] >> 16);
6362
64      xscale = state->m_obj_ram[offs + 2] >> 16;
65      yscale = state->m_obj_ram[offs + 2] & 0xffff;
63      xscale = m_obj_ram[offs + 2] >> 16;
64      yscale = m_obj_ram[offs + 2] & 0xffff;
6665
6766      if (!xscale || !yscale)
6867         continue;
r20764r20765
7271      ox -= (size * xscale) >> 13;
7372      oy -= (size * yscale) >> 13;
7473
75      color = (state->m_obj_ram[offs + 3] >> 16) & 15;
74      color = (m_obj_ram[offs + 3] >> 16) & 15;
7675
7776      for (x = 0; x < size; x++)
7877         for (y = 0; y < size; y++)
r20764r20765
9897
9998               drawgfxzoom_transpen(bitmap,
10099                        cliprect,
101                        machine.gfx[0],
100                        machine().gfx[0],
102101                        c,
103102                        color,
104103                        flipx,
r20764r20765
116115
117116               drawgfx_transpen(bitmap,
118117                     cliprect,
119                     machine.gfx[0],
118                     machine().gfx[0],
120119                     c,
121120                     color,
122121                     flipx,
r20764r20765
178177      if (layer == NUM_LAYERS)
179178      {
180179         if (enables & K55_INP_SUB2)
181            draw_sprites(machine(), bitmap, cliprect);
180            draw_sprites(bitmap, cliprect);
182181      }
183182      else
184183      {
trunk/src/mame/video/dec8.c
r20764r20765
209209/******************************************************************************/
210210
211211
212static void srdarwin_draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
212void dec8_state::srdarwin_draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
213213{
214   dec8_state *state = machine.driver_data<dec8_state>();
215   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
214   UINT8 *buffered_spriteram = m_spriteram->buffer();
216215   int offs;
217216
218217   /* Sprites */
r20764r20765
235234      fx = buffered_spriteram[offs + 1] & 0x04;
236235      multi = buffered_spriteram[offs + 1] & 0x10;
237236
238      if (state->flip_screen())
237      if (flip_screen())
239238      {
240239         sy = 240 - sy;
241240         sx = 240 - sx;
r20764r20765
244243      }
245244      else sy2 = sy + 16;
246245
247      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
246      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
248247               code,
249248            color,
250            fx,state->flip_screen(),
249            fx,flip_screen(),
251250            sx,sy,0);
252251      if (multi)
253         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
252         drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
254253            code+1,
255254            color,
256            fx,state->flip_screen(),
255            fx,flip_screen(),
257256            sx,sy2,0);
258257   }
259258}
r20764r20765
458457   m_bg_tilemap->set_scrollx(0, (m_scroll2[0] << 8) + m_scroll2[1]);
459458
460459   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
461   srdarwin_draw_sprites(machine(), bitmap, cliprect, 0);
460   srdarwin_draw_sprites(bitmap, cliprect, 0);
462461   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
463   srdarwin_draw_sprites(machine(), bitmap, cliprect, 1);
462   srdarwin_draw_sprites(bitmap, cliprect, 1);
464463   m_fix_tilemap->draw(bitmap, cliprect, 0, 0);
465464   return 0;
466465}
trunk/src/mame/video/drgnmst.c
r20764r20765
5454   m_md_tilemap->mark_tile_dirty(offset / 2);
5555}
5656
57static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
57void drgnmst_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
5858{
59   drgnmst_state *state = machine.driver_data<drgnmst_state>();
60   gfx_element *gfx = machine.gfx[0];
61   UINT16 *source = state->m_spriteram;
59   gfx_element *gfx = machine().gfx[0];
60   UINT16 *source = m_spriteram;
6261   UINT16 *finish = source + 0x800 / 2;
6362
6463   while (source < finish)
r20764r20765
186185
187186   }
188187
189   draw_sprites(machine(),bitmap,cliprect);
188   draw_sprites(bitmap,cliprect);
190189
191190//  popmessage ("x %04x x %04x x %04x x %04x x %04x", m_vidregs2[0], m_vidregs[12], m_vidregs[13], m_vidregs[14], m_vidregs[15]);
192191//  popmessage ("x %04x x %04x y %04x y %04x z %04x z %04x",m_vidregs[0],m_vidregs[1],m_vidregs[2],m_vidregs[3],m_vidregs[4],m_vidregs[5]);
trunk/src/mame/video/darkmist.c
r20764r20765
100100}
101101
102102
103static void set_pens(running_machine &machine)
103void darkmist_state::set_pens()
104104{
105   darkmist_state *state = machine.driver_data<darkmist_state>();
106105   int i;
107106
108107   for (i = 0; i < 0x100; i++)
109108   {
110      int r = pal4bit(state->m_generic_paletteram_8[i | 0x200] >> 0);
111      int g = pal4bit(state->m_generic_paletteram_8[i | 0x000] >> 4);
112      int b = pal4bit(state->m_generic_paletteram_8[i | 0x000] >> 0);
109      int r = pal4bit(m_generic_paletteram_8[i | 0x200] >> 0);
110      int g = pal4bit(m_generic_paletteram_8[i | 0x000] >> 4);
111      int b = pal4bit(m_generic_paletteram_8[i | 0x000] >> 0);
113112
114      colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
113      colortable_palette_set_color(machine().colortable, i, MAKE_RGB(r, g, b));
115114   }
116115
117   colortable_palette_set_color(machine.colortable, 0x100, RGB_BLACK);
116   colortable_palette_set_color(machine().colortable, 0x100, RGB_BLACK);
118117}
119118
120119
r20764r20765
133132
134133#define DM_GETSCROLL(n) (((m_scroll[(n)]<<1)&0xff) + ((m_scroll[(n)]&0x80)?1:0) +( ((m_scroll[(n)-1]<<4) | (m_scroll[(n)-1]<<12) )&0xff00))
135134
136   set_pens(machine());
135   set_pens();
137136
138137   m_bgtilemap->set_scrollx(0, DM_GETSCROLL(0x2));
139138   m_bgtilemap->set_scrolly(0, DM_GETSCROLL(0x6));
trunk/src/mame/video/deco_mlc.c
r20764r20765
3131}
3232
3333#ifdef UNUSED_FUNCTION
34static void blitRaster(running_machine &machine, bitmap_rgb32 &bitmap, int rasterMode)
34void deco_mlc_state::blitRaster(bitmap_rgb32 &bitmap, int rasterMode)
3535{
36   deco_mlc_state *state = machine.driver_data<deco_mlc_state>();
3736   int x,y;
3837   for (y=0; y<256; y++) //todo
3938   {
4039      UINT32* src=&temp_bitmap->pix32(y&0x1ff);
4140      UINT32* dst=&bitmap.pix32(y);
42      UINT32 xptr=(state->m_mlc_raster_table[0][y]<<13);
41      UINT32 xptr=(m_mlc_raster_table[0][y]<<13);
4342
44      if (machine.input().code_pressed(KEYCODE_X))
43      if (machine().input().code_pressed(KEYCODE_X))
4544         xptr=0;
4645
4746      for (x=0; x<320; x++)
r20764r20765
4948         if (src[x])
5049            dst[x]=src[(xptr>>16)&0x1ff];
5150
52         //if (machine.input().code_pressed(KEYCODE_X))
51         //if (machine().input().code_pressed(KEYCODE_X))
5352         //  xptr+=0x10000;
5453         //else if(rasterHackTest[0][y]<0)
55            xptr+=0x10000 - ((state->m_mlc_raster_table[2][y]&0x3ff)<<5);
54            xptr+=0x10000 - ((m_mlc_raster_table[2][y]&0x3ff)<<5);
5655         //else
57         //  xptr+=0x10000 + (state->m_mlc_raster_table[0][y]<<5);
56         //  xptr+=0x10000 + (m_mlc_raster_table[0][y]<<5);
5857      }
5958   }
6059}
r20764r20765
209208   }
210209}
211210
212static void draw_sprites(running_machine& machine, bitmap_rgb32 &bitmap,const rectangle &cliprect)
211void deco_mlc_state::draw_sprites( bitmap_rgb32 &bitmap,const rectangle &cliprect)
213212{
214   deco_mlc_state *state = machine.driver_data<deco_mlc_state>();
215213   UINT32 *index_ptr=0;
216214   int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1;
217215   int xoffs,yoffs;
218   UINT8 *rom = state->memregion("gfx2")->base() + 0x20000, *index_ptr8;
219   UINT8 *rawrom = state->memregion("gfx2")->base();
216   UINT8 *rom = memregion("gfx2")->base() + 0x20000, *index_ptr8;
217   UINT8 *rawrom = memregion("gfx2")->base();
220218   int blockIsTilemapIndex=0;
221219   int sprite2=0,indx2=0,use8bppMode=0;
222220   int yscale,xscale;
r20764r20765
230228//  int rasterDirty=0;
231229   int clipper=0;
232230   rectangle user_clip;
233   UINT32* mlc_spriteram=state->m_mlc_buffered_spriteram; // spriteram32
231   UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32
234232
235233   for (offs = (0x3000/4)-8; offs>=0; offs-=8)
236234   {
237235      if ((mlc_spriteram[offs+0]&0x8000)==0)
238236         continue;
239      if ((mlc_spriteram[offs+1]&0x2000) && (machine.primary_screen->frame_number() & 1))
237      if ((mlc_spriteram[offs+1]&0x2000) && (machine().primary_screen->frame_number() & 1))
240238         continue;
241239
242240      /*
r20764r20765
297295      however there are space for 8 clipping windows, where is the high bit? (Or is it ~0x400?) */
298296      clipper=((clipper&2)>>1)|((clipper&1)<<1); // Swap low two bits
299297
300      user_clip.min_y=state->m_mlc_clip_ram[(clipper*4)+0];
301      user_clip.max_y=state->m_mlc_clip_ram[(clipper*4)+1];
302      user_clip.min_x=state->m_mlc_clip_ram[(clipper*4)+2];
303      user_clip.max_x=state->m_mlc_clip_ram[(clipper*4)+3];
298      user_clip.min_y=m_mlc_clip_ram[(clipper*4)+0];
299      user_clip.max_y=m_mlc_clip_ram[(clipper*4)+1];
300      user_clip.min_x=m_mlc_clip_ram[(clipper*4)+2];
301      user_clip.max_x=m_mlc_clip_ram[(clipper*4)+3];
304302
305303      user_clip &= cliprect;
306304
307305      /* Any colours out of range (for the bpp value) trigger 'shadow' mode */
308      if (color & (state->m_colour_mask+1))
306      if (color & (m_colour_mask+1))
309307         alpha=0x80;
310308      else
311309         alpha=0xff;
312      color&=state->m_colour_mask;
310      color&=m_colour_mask;
313311
314312      /* If this bit is set, combine this block with the next one */
315313      if (mlc_spriteram[offs+1]&0x1000) {
r20764r20765
356354
357355      } else {
358356         indx&=0x1fff;
359         index_ptr=state->m_mlc_vram + indx*4;
357         index_ptr=m_mlc_vram + indx*4;
360358         h=(index_ptr[0]>>8)&0xf;
361359         w=(index_ptr[1]>>8)&0xf;
362360
r20764r20765
364362         if (!w) w=16;
365363
366364         if (use8bppMode) {
367            UINT32* index_ptr2=state->m_mlc_vram + ((indx2*4)&0x7fff);
365            UINT32* index_ptr2=m_mlc_vram + ((indx2*4)&0x7fff);
368366            sprite2=((index_ptr2[2]&0x3)<<16) | (index_ptr2[3]&0xffff);
369367         }
370368
r20764r20765
444442               }
445443               else
446444               {
447                  const UINT32* ptr=state->m_mlc_vram + ((sprite)&0x7fff);
445                  const UINT32* ptr=m_mlc_vram + ((sprite)&0x7fff);
448446                  tile=(*ptr)&0xffff;
449447
450448                  if (tileFormat)
r20764r20765
466464//                  rasterDirty=1;
467465
468466            mlc_drawgfxzoom(
469                        /*rasterMode ? temp_bitmap : */bitmap,user_clip,machine.gfx[0],
467                        /*rasterMode ? temp_bitmap : */bitmap,user_clip,machine().gfx[0],
470468                        tile,tile2,
471469                        color + colorOffset,fx,fy,xbase,ybase,
472470                        0,
r20764r20765
511509{
512510//  temp_bitmap->fill(0, cliprect);
513511   bitmap.fill(machine().pens[0], cliprect); /* Pen 0 fill colour confirmed from Skull Fang level 2 */
514   draw_sprites(machine(),bitmap,cliprect);
512   draw_sprites(bitmap,cliprect);
515513   return 0;
516514}
trunk/src/mame/video/docastle.c
r20764r20765
109109   SET_TILE_INFO_MEMBER(0, code, color, 0);
110110}
111111
112static void video_start_common( running_machine &machine, UINT32 tile_transmask )
112void docastle_state::video_start_common( UINT32 tile_transmask )
113113{
114   docastle_state *state = machine.driver_data<docastle_state>();
115   state->m_do_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(docastle_state::get_tile_info),state), TILEMAP_SCAN_ROWS,  8, 8, 32, 32);
116   state->m_do_tilemap->set_transmask(0, tile_transmask, 0x0000);
114   m_do_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(docastle_state::get_tile_info),this), TILEMAP_SCAN_ROWS,  8, 8, 32, 32);
115   m_do_tilemap->set_transmask(0, tile_transmask, 0x0000);
117116}
118117
119118void docastle_state::video_start()
120119{
121   video_start_common(machine(), 0x00ff);
120   video_start_common(0x00ff);
122121}
123122
124123VIDEO_START_MEMBER(docastle_state,dorunrun)
125124{
126   video_start_common(machine(), 0xff00);
125   video_start_common(0xff00);
127126}
128127
129static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
128void docastle_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
130129{
131   docastle_state *state = machine.driver_data<docastle_state>();
132130   int offs;
133131
134   machine.priority_bitmap.fill(1);
132   machine().priority_bitmap.fill(1);
135133
136   for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
134   for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
137135   {
138136      int sx, sy, flipx, flipy, code, color;
139137
140      if (machine.gfx[1]->elements() > 256)
138      if (machine().gfx[1]->elements() > 256)
141139      {
142140         /* spriteram
143141
r20764r20765
156154
157155          */
158156
159         code = state->m_spriteram[offs + 3];
160         color = state->m_spriteram[offs + 2] & 0x0f;
161         sx = ((state->m_spriteram[offs + 1] + 8) & 0xff) - 8;
162         sy = state->m_spriteram[offs];
163         flipx = state->m_spriteram[offs + 2] & 0x40;
157         code = m_spriteram[offs + 3];
158         color = m_spriteram[offs + 2] & 0x0f;
159         sx = ((m_spriteram[offs + 1] + 8) & 0xff) - 8;
160         sy = m_spriteram[offs];
161         flipx = m_spriteram[offs + 2] & 0x40;
164162         flipy = 0;
165         if (state->m_spriteram[offs + 2] & 0x10) code += 0x100;
166         if (state->m_spriteram[offs + 2] & 0x80) code += 0x200;
163         if (m_spriteram[offs + 2] & 0x10) code += 0x100;
164         if (m_spriteram[offs + 2] & 0x80) code += 0x200;
167165      }
168166      else
169167      {
r20764r20765
182180
183181          */
184182
185         code = state->m_spriteram[offs + 3];
186         color = state->m_spriteram[offs + 2] & 0x1f;
187         sx = ((state->m_spriteram[offs + 1] + 8) & 0xff) - 8;
188         sy = state->m_spriteram[offs];
189         flipx = state->m_spriteram[offs + 2] & 0x40;
190         flipy = state->m_spriteram[offs + 2] & 0x80;
183         code = m_spriteram[offs + 3];
184         color = m_spriteram[offs + 2] & 0x1f;
185         sx = ((m_spriteram[offs + 1] + 8) & 0xff) - 8;
186         sy = m_spriteram[offs];
187         flipx = m_spriteram[offs + 2] & 0x40;
188         flipy = m_spriteram[offs + 2] & 0x80;
191189      }
192190
193      if (state->flip_screen())
191      if (flip_screen())
194192      {
195193         sx = 240 - sx;
196194         sy = 240 - sy;
r20764r20765
199197      }
200198
201199      /* first draw the sprite, visible */
202      pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
200      pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
203201            code,
204202            color,
205203            flipx,flipy,
206204            sx,sy,
207            machine.priority_bitmap,
205            machine().priority_bitmap,
208206            0x00,0x80ff);
209207
210208      /* then draw the mask, behind the background but obscuring following sprites */
211      pdrawgfx_transmask(bitmap,cliprect,machine.gfx[1],
209      pdrawgfx_transmask(bitmap,cliprect,machine().gfx[1],
212210            code,
213211            color,
214212            flipx,flipy,
215213            sx,sy,
216            machine.priority_bitmap,
214            machine().priority_bitmap,
217215            0x02,0x7fff);
218216   }
219217}
r20764r20765
221219UINT32 docastle_state::screen_update_docastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
222220{
223221   m_do_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
224   draw_sprites(machine(), bitmap, cliprect);
222   draw_sprites(bitmap, cliprect);
225223   m_do_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
226224   return 0;
227225}
trunk/src/mame/video/ddragon3.c
r20764r20765
106106 *   6,7| unused
107107 */
108108
109static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
109void ddragon3_state::draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect )
110110{
111   ddragon3_state *state = machine.driver_data<ddragon3_state>();
112   UINT16 *source = state->m_spriteram;
111   UINT16 *source = m_spriteram;
113112   UINT16 *finish = source + 0x800;
114113
115114   while (source < finish)
r20764r20765
132131         if (attr & 0x02) sy = 239 + (0x100 - sy); else sy = 240 - sy;
133132         if (sx > 0x17f) sx = 0 - (0x200 - sx);
134133
135         if (state->flip_screen())
134         if (flip_screen())
136135         {
137136            sx = 304 - sx;
138137            sy = 224 - sy;
r20764r20765
143142         for (i = 0; i <= height; i++)
144143         {
145144            drawgfx_transpen(bitmap, cliprect,
146               machine.gfx[1], code + i, color, flipx, flipy,
147               sx, sy + (state->flip_screen() ? (i * 16) : (-i * 16)), 0);
145               machine().gfx[1], code + i, color, flipx, flipy,
146               sx, sy + (flip_screen() ? (i * 16) : (-i * 16)), 0);
148147         }
149148      }
150149
r20764r20765
163162   {
164163      m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
165164      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
166      draw_sprites(machine(), bitmap, cliprect);
165      draw_sprites(bitmap, cliprect);
167166   }
168167   else if ((m_vreg & 0x60) == 0x60)
169168   {
170169      m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
171170      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
172      draw_sprites(machine(), bitmap, cliprect);
171      draw_sprites(bitmap, cliprect);
173172   }
174173   else
175174   {
176175      m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
177      draw_sprites(machine(), bitmap, cliprect);
176      draw_sprites(bitmap, cliprect);
178177      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
179178   }
180179   return 0;
r20764r20765
190189   if(m_vreg & 8)
191190   {
192191      m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
193      draw_sprites(machine(), bitmap, cliprect);
192      draw_sprites(bitmap, cliprect);
194193      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
195194   }
196195   else
197196   {
198197      m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
199198      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
200      draw_sprites(machine(), bitmap, cliprect);
199      draw_sprites(bitmap, cliprect);
201200   }
202201   return 0;
203202}
trunk/src/mame/video/deco32.c
r20764r20765
6060   COMBINE_DATA(&m_ace_ram[offset]);
6161}
6262
63static void updateAceRam(running_machine& machine)
63void deco32_state::updateAceRam()
6464{
65   deco32_state *state = machine.driver_data<deco32_state>();
6665   int r,g,b,i;
67   UINT8 fadeptr=state->m_ace_ram[0x20];
68   UINT8 fadeptg=state->m_ace_ram[0x21];
69   UINT8 fadeptb=state->m_ace_ram[0x22];
70   UINT8 fadepsr=state->m_ace_ram[0x23];
71   UINT8 fadepsg=state->m_ace_ram[0x24];
72   UINT8 fadepsb=state->m_ace_ram[0x25];
73//  UINT8 mode=state->m_ace_ram[0x26];
66   UINT8 fadeptr=m_ace_ram[0x20];
67   UINT8 fadeptg=m_ace_ram[0x21];
68   UINT8 fadeptb=m_ace_ram[0x22];
69   UINT8 fadepsr=m_ace_ram[0x23];
70   UINT8 fadepsg=m_ace_ram[0x24];
71   UINT8 fadepsb=m_ace_ram[0x25];
72//  UINT8 mode=m_ace_ram[0x26];
7473
75   state->m_ace_ram_dirty=0;
74   m_ace_ram_dirty=0;
7675
7776   for (i=0; i<2048; i++)
7877   {
7978      /* Lerp palette entry to 'fadept' according to 'fadeps' */
80      b = (state->m_generic_paletteram_32[i] >>16) & 0xff;
81      g = (state->m_generic_paletteram_32[i] >> 8) & 0xff;
82      r = (state->m_generic_paletteram_32[i] >> 0) & 0xff;
79      b = (m_generic_paletteram_32[i] >>16) & 0xff;
80      g = (m_generic_paletteram_32[i] >> 8) & 0xff;
81      r = (m_generic_paletteram_32[i] >> 0) & 0xff;
8382
8483      if (i>255) /* Screenshots seem to suggest ACE fades do not affect playfield 1 palette (0-255) */
8584      {
r20764r20765
8988         r = (UINT8)((float)r + (((float)fadeptr - (float)r) * (float)fadepsr/255.0f));
9089      }
9190
92      palette_set_color(machine,i,MAKE_RGB(r,g,b));
91      palette_set_color(machine(),i,MAKE_RGB(r,g,b));
9392   }
9493}
9594
r20764r20765
331330   }
332331}
333332
334static void dragngun_draw_sprites(running_machine& machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata)
333void dragngun_state::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT32 *spritedata)
335334{
336   dragngun_state *state = machine.driver_data<dragngun_state>();
337335   const UINT32 *layout_ram;
338336   const UINT32 *lookup_ram;
339337   int offs;
r20764r20765
384382   */
385383
386384   /* Sprite global disable bit */
387   if (state->m_dragngun_sprite_ctrl&0x40000000)
385   if (m_dragngun_sprite_ctrl&0x40000000)
388386      return;
389387
390388   for (offs = 0;offs < 0x800;offs += 8)
r20764r20765
399397         continue;
400398
401399      if (spritedata[offs+0]&0x400)
402         layout_ram = state->m_dragngun_sprite_layout_1_ram + ((spritedata[offs+0]&0x1ff)*4); //CHECK!
400         layout_ram = m_dragngun_sprite_layout_1_ram + ((spritedata[offs+0]&0x1ff)*4); //CHECK!
403401      else
404         layout_ram = state->m_dragngun_sprite_layout_0_ram + ((spritedata[offs+0]&0x1ff)*4); //1ff in drag gun code??
402         layout_ram = m_dragngun_sprite_layout_0_ram + ((spritedata[offs+0]&0x1ff)*4); //1ff in drag gun code??
405403      h = (layout_ram[1]>>0)&0xf;
406404      w = (layout_ram[1]>>4)&0xf;
407405      if (!h || !w)
r20764r20765
428426
429427//      if (spritedata[offs+0]&0x400)
430428      if (layout_ram[0]&0x2000)
431         lookup_ram = state->m_dragngun_sprite_lookup_1_ram + (layout_ram[0]&0x1fff);
429         lookup_ram = m_dragngun_sprite_lookup_1_ram + (layout_ram[0]&0x1fff);
432430      else
433         lookup_ram = state->m_dragngun_sprite_lookup_0_ram + (layout_ram[0]&0x1fff);
431         lookup_ram = m_dragngun_sprite_lookup_0_ram + (layout_ram[0]&0x1fff);
434432
435433      zoomx=scalex * 0x10000 / (w*16);
436434      zoomy=scaley * 0x10000 / (h*16);
r20764r20765
454452            /* High bits of the sprite reference into the sprite control bits for banking */
455453            switch (sprite&0x3000) {
456454            default:
457            case 0x0000: sprite=(sprite&0xfff) | ((state->m_dragngun_sprite_ctrl&0x000f)<<12); break;
458            case 0x1000: sprite=(sprite&0xfff) | ((state->m_dragngun_sprite_ctrl&0x00f0)<< 8); break;
459            case 0x2000: sprite=(sprite&0xfff) | ((state->m_dragngun_sprite_ctrl&0x0f00)<< 4); break;
460            case 0x3000: sprite=(sprite&0xfff) | ((state->m_dragngun_sprite_ctrl&0xf000)<< 0); break;
455            case 0x0000: sprite=(sprite&0xfff) | ((m_dragngun_sprite_ctrl&0x000f)<<12); break;
456            case 0x1000: sprite=(sprite&0xfff) | ((m_dragngun_sprite_ctrl&0x00f0)<< 8); break;
457            case 0x2000: sprite=(sprite&0xfff) | ((m_dragngun_sprite_ctrl&0x0f00)<< 4); break;
458            case 0x3000: sprite=(sprite&0xfff) | ((m_dragngun_sprite_ctrl&0xf000)<< 0); break;
461459            }
462460
463461            /* Because of the unusual interleaved rom layout, we have to mangle the bank bits
r20764r20765
479477
480478            if (zoomx!=0x10000 || zoomy!=0x10000)
481479               dragngun_drawgfxzoom(
482                  bitmap,cliprect,machine.gfx[bank],
480                  bitmap,cliprect,machine().gfx[bank],
483481                  sprite,
484482                  colour,
485483                  fx,fy,
r20764r20765
487485                  15,zoomx,zoomy,NULL,0,
488486                  ((xpos+(zoomx<<4))>>16) - (xpos>>16), ((ypos+(zoomy<<4))>>16) - (ypos>>16), alpha );
489487            else
490               drawgfx_alpha(bitmap,cliprect,machine.gfx[bank],
488               drawgfx_alpha(bitmap,cliprect,machine().gfx[bank],
491489                  sprite,
492490                  colour,
493491                  fx,fy,
r20764r20765
634632   {
635633      rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247);
636634
637      dragngun_draw_sprites(machine(),bitmap,clip,m_spriteram->buffer());
635      dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer());
638636      deco16ic_tilemap_1_draw(m_deco_tilegen1, bitmap, clip, 0, 0);
639637
640638   }
r20764r20765
686684    blending support - it can't be done in-place on the final framebuffer
687685    without a lot of support bitmaps.
688686*/
689static void mixDualAlphaSprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx0, gfx_element *gfx1, int mixAlphaTilemap)
687void deco32_state::mixDualAlphaSprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx0, gfx_element *gfx1, int mixAlphaTilemap)
690688{
691   deco32_state *state = gfx0->machine().driver_data<deco32_state>();
692   running_machine &machine = gfx0->machine();
693   const pen_t *pens = machine.pens;
689   const pen_t *pens = machine().pens;
694690   const pen_t *pal0 = &pens[gfx0->colorbase()];
695691   const pen_t *pal1 = &pens[gfx1->colorbase()];
696   const pen_t *pal2 = &pens[machine.gfx[(state->m_pri&1) ? 1 : 2]->colorbase()];
692   const pen_t *pal2 = &pens[machine().gfx[(m_pri&1) ? 1 : 2]->colorbase()];
697693   int x,y;
698   bitmap_ind16& sprite0_mix_bitmap = machine.device<decospr_device>("spritegen1")->get_sprite_temp_bitmap();
699   bitmap_ind16& sprite1_mix_bitmap = machine.device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
694   bitmap_ind16& sprite0_mix_bitmap = machine().device<decospr_device>("spritegen1")->get_sprite_temp_bitmap();
695   bitmap_ind16& sprite1_mix_bitmap = machine().device<decospr_device>("spritegen2")->get_sprite_temp_bitmap();
700696
701697
702698   /* Mix sprites into main bitmap, based on priority & alpha */
703699   for (y=8; y<248; y++) {
704      UINT8* tilemapPri=&machine.priority_bitmap.pix8(y);
700      UINT8* tilemapPri=&machine().priority_bitmap.pix8(y);
705701      UINT16* sprite0=&sprite0_mix_bitmap.pix16(y);
706702      UINT16* sprite1=&sprite1_mix_bitmap.pix16(y);
707703      UINT32* destLine=&bitmap.pix32(y);
708      UINT16* alphaTilemap=&state->m_tilemap_alpha_bitmap->pix16(y);
704      UINT16* alphaTilemap=&m_tilemap_alpha_bitmap->pix16(y);
709705
710706      for (x=0; x<320; x++) {
711707         UINT16 priColAlphaPal0=sprite0[x];
r20764r20765
759755               */
760756
761757               /* Alpha values are tied to ACE ram... */
762               //int alpha=((state->m_ace_ram[0x0 + (((priColAlphaPal1&0xf0)>>4)/2)]) * 8)-1;
758               //int alpha=((m_ace_ram[0x0 + (((priColAlphaPal1&0xf0)>>4)/2)]) * 8)-1;
763759               //if (alpha<0)
764760               //  alpha=0;
765761
r20764r20765
768764
769765               if (pri1==0 && (((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2))))
770766               {
771                  if ((state->m_pri&1)==0 || ((state->m_pri&1)==1 && tilemapPri[x]<4) || ((state->m_pri&1)==1 && mixAlphaTilemap))
767                  if ((m_pri&1)==0 || ((m_pri&1)==1 && tilemapPri[x]<4) || ((m_pri&1)==1 && mixAlphaTilemap))
772768                     destLine[x]=alpha_blend_r32(destLine[x], pal1[(priColAlphaPal1&0xff) + (gfx1->granularity() * col1)], 0x80);
773769               }
774770               else if (pri1==1 && ((priColAlphaPal0&0xff)==0 || ((pri0&0x3)!=0 && (pri0&0x3)!=1 && (pri0&0x3)!=2)))
r20764r20765
807803                  && ((priColAlphaPal1&0xff)==0 || (pri1&0x3)==2 || (pri1&0x3)==3 || alpha1))
808804               {
809805                  /* Alpha values are tied to ACE ram */
810                  int alpha=((state->m_ace_ram[0x17 + (((p&0xf0)>>4)/2)]) * 8)-1;
806                  int alpha=((m_ace_ram[0x17 + (((p&0xf0)>>4)/2)]) * 8)-1;
811807                  if (alpha<0)
812808                     alpha=0;
813809
r20764r20765
833829      alphaTilemap=1;
834830
835831   if (m_ace_ram_dirty)
836      updateAceRam(machine());
832      updateAceRam();
837833
838834   machine().priority_bitmap.fill(0, cliprect);
839835
trunk/src/mame/video/ddribble.c
r20764r20765
3030}
3131
3232
33static void set_pens( running_machine &machine )
33void ddribble_state::set_pens(  )
3434{
35   ddribble_state *state = machine.driver_data<ddribble_state>();
3635   int i;
3736
3837   for (i = 0x00; i < 0x80; i += 2)
3938   {
40      UINT16 data = state->m_paletteram[i | 1] | (state->m_paletteram[i] << 8);
39      UINT16 data = m_paletteram[i | 1] | (m_paletteram[i] << 8);
4140
4241      rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
43      colortable_palette_set_color(machine.colortable, i >> 1, color);
42      colortable_palette_set_color(machine().colortable, i >> 1, color);
4443   }
4544}
4645
r20764r20765
169168
170169***************************************************************************/
171170
172static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* source, int lenght, int gfxset, int flipscreen )
171void ddribble_state::draw_sprites(  bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8* source, int lenght, int gfxset, int flipscreen )
173172{
174   gfx_element *gfx = machine.gfx[gfxset];
173   gfx_element *gfx = machine().gfx[gfxset];
175174   const UINT8 *finish = source + lenght;
176175
177176   while (source < finish)
r20764r20765
245244
246245UINT32 ddribble_state::screen_update_ddribble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
247246{
248   set_pens(machine());
247   set_pens();
249248
250249   m_fg_tilemap->set_flip((m_vregs[0][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
251250   m_bg_tilemap->set_flip((m_vregs[1][4] & 0x08) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
r20764r20765
257256   m_bg_tilemap->set_scrolly(0, m_vregs[1][0]);
258257
259258   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
260   draw_sprites(machine(), bitmap, cliprect, m_spriteram_1, 0x07d, 2, m_vregs[0][4] & 0x08);
261   draw_sprites(machine(), bitmap, cliprect, m_spriteram_2, 0x140, 3, m_vregs[1][4] & 0x08);
259   draw_sprites(bitmap, cliprect, m_spriteram_1, 0x07d, 2, m_vregs[0][4] & 0x08);
260   draw_sprites(bitmap, cliprect, m_spriteram_2, 0x140, 3, m_vregs[1][4] & 0x08);
262261   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
263262   return 0;
264263}
trunk/src/mame/video/dcon.c
r20764r20765
139139   m_gfx_bank_select = 0;
140140}
141141
142static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
142void dcon_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect)
143143{
144   dcon_state *state = machine.driver_data<dcon_state>();
145   UINT16 *spriteram16 = state->m_spriteram;
144   UINT16 *spriteram16 = m_spriteram;
146145   int offs,fx,fy,x,y,color,sprite;
147146   int dx,dy,ax,ay,inc,pri_mask = 0;
148147
r20764r20765
185184         for (ay=0; ay<dy; ay++) {
186185            if (!fx && !fy)
187186            {
188               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
187               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
189188                  sprite + inc,
190189                  color,fx,fy,x+ax*16,y+ay*16,
191                  machine.priority_bitmap,pri_mask,15);
190                  machine().priority_bitmap,pri_mask,15);
192191
193192               // wrap around y
194               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
193               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
195194                  sprite + inc,
196195                  color,fx,fy,x+ax*16,y+ay*16 + 512,
197                  machine.priority_bitmap,pri_mask,15);
196                  machine().priority_bitmap,pri_mask,15);
198197
199198               // wrap around y
200               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
199               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
201200                  sprite + inc,
202201                  color,fx,fy,x+ax*16,y+ay*16 - 512,
203                  machine.priority_bitmap,pri_mask,15);
202                  machine().priority_bitmap,pri_mask,15);
204203            }
205204            else if (fx && !fy)
206205            {
207               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
206               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
208207                  sprite + inc,
209208                  color,fx,fy,x+(dx-1-ax)*16,y+ay*16,
210                  machine.priority_bitmap,pri_mask,15);
209                  machine().priority_bitmap,pri_mask,15);
211210
212211               // wrap around y
213               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
212               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
214213                  sprite + inc,
215214                  color,fx,fy,x+(dx-1-ax)*16,y+ay*16 + 512,
216                  machine.priority_bitmap,pri_mask,15);
215                  machine().priority_bitmap,pri_mask,15);
217216
218217               // wrap around y
219               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
218               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
220219                  sprite + inc,
221220                  color,fx,fy,x+(dx-1-ax)*16,y+ay*16 - 512,
222                  machine.priority_bitmap,pri_mask,15);
221                  machine().priority_bitmap,pri_mask,15);
223222            }
224223            else if (!fx && fy)
225224            {
226               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
225               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
227226                  sprite + inc,
228227                  color,fx,fy,x+ax*16,y+(dy-1-ay)*16,
229                  machine.priority_bitmap,pri_mask,15);
228                  machine().priority_bitmap,pri_mask,15);
230229
231230               // wrap around y
232               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
231               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
233232                  sprite + inc,
234233                  color,fx,fy,x+ax*16,y+(dy-1-ay)*16 + 512,
235                  machine.priority_bitmap,pri_mask,15);
234                  machine().priority_bitmap,pri_mask,15);
236235
237236               // wrap around y
238               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
237               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
239238                  sprite + inc,
240239                  color,fx,fy,x+ax*16,y+(dy-1-ay)*16 - 512,
241                  machine.priority_bitmap,pri_mask,15);
240                  machine().priority_bitmap,pri_mask,15);
242241            }
243242            else
244243            {
245               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
244               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
246245                  sprite + inc,
247246                  color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16,
248                  machine.priority_bitmap,pri_mask,15);
247                  machine().priority_bitmap,pri_mask,15);
249248
250249               // wrap around y
251               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
250               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
252251                  sprite + inc,
253252                  color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16 + 512,
254                  machine.priority_bitmap,pri_mask,15);
253                  machine().priority_bitmap,pri_mask,15);
255254
256255               // wrap around y
257               pdrawgfx_transpen(bitmap,cliprect,machine.gfx[4],
256               pdrawgfx_transpen(bitmap,cliprect,machine().gfx[4],
258257                  sprite + inc,
259258                  color,fx,fy,x+(dx-1-ax)*16,y+(dy-1-ay)*16 - 512,
260                  machine.priority_bitmap,pri_mask,15);
259                  machine().priority_bitmap,pri_mask,15);
261260            }
262261
263262            inc++;
r20764r20765
286285   m_foreground_layer->draw(bitmap, cliprect, 0,2);
287286   m_text_layer->draw(bitmap, cliprect, 0,4);
288287
289   draw_sprites(machine(),bitmap,cliprect);
288   draw_sprites(bitmap,cliprect);
290289   return 0;
291290}
292291
r20764r20765
320319   m_foreground_layer->draw(bitmap, cliprect, 0,2);
321320   m_text_layer->draw(bitmap, cliprect, 0,4);
322321
323   draw_sprites(machine(),bitmap,cliprect);
322   draw_sprites(bitmap,cliprect);
324323   return 0;
325324}
trunk/src/mame/video/deniam.c
r20764r20765
22#include "includes/deniam.h"
33
44
5static void deniam_common_init( running_machine &machine )
5void deniam_state::deniam_common_init(  )
66{
7   deniam_state *state = machine.driver_data<deniam_state>();
87   int i;
98
10   state->m_bg_scrollx_reg = 0x00a4/2;
11   state->m_bg_scrolly_reg = 0x00a8/2;
12   state->m_bg_page_reg    = 0x00ac/2;
13   state->m_fg_scrollx_reg = 0x00a2/2;
14   state->m_fg_scrolly_reg = 0x00a6/2;
15   state->m_fg_page_reg    = 0x00aa/2;
9   m_bg_scrollx_reg = 0x00a4/2;
10   m_bg_scrolly_reg = 0x00a8/2;
11   m_bg_page_reg    = 0x00ac/2;
12   m_fg_scrollx_reg = 0x00a2/2;
13   m_fg_scrolly_reg = 0x00a6/2;
14   m_fg_page_reg    = 0x00aa/2;
1615
17   state->m_display_enable = 0;
18   state->m_coinctrl = 0;
16   m_display_enable = 0;
17   m_coinctrl = 0;
1918
2019   for (i = 0; i < 4; i++)
2120   {
22      state->m_bg_page[i] = 0;
23      state->m_fg_page[i] = 0;
21      m_bg_page[i] = 0;
22      m_fg_page[i] = 0;
2423   }
2524}
2625
2726DRIVER_INIT_MEMBER(deniam_state,logicpro)
2827{
29   deniam_common_init(machine());
28   deniam_common_init();
3029
3130   m_bg_scrollx_offs = 0x00d;
3231   m_bg_scrolly_offs = 0x000;
r20764r20765
3635
3736DRIVER_INIT_MEMBER(deniam_state,karianx)
3837{
39   deniam_common_init(machine());
38   deniam_common_init();
4039
4140   m_bg_scrollx_offs = 0x10d;
4241   m_bg_scrolly_offs = 0x080;
r20764r20765
201200 *   c  | ---------------- | zoomy like in System 16?
202201 *   e  | ---------------- |
203202 */
204static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
203void deniam_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
205204{
206   deniam_state *state = machine.driver_data<deniam_state>();
207205   int offs;
208   UINT8 *gfx = state->memregion("gfx2")->base();
206   UINT8 *gfx = memregion("gfx2")->base();
209207
210   for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
208   for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
211209   {
212210      int sx, starty, endy, x, y, start, color, width, flipx, primask;
213211      UINT8 *rom = gfx;
214212
215      sx = (state->m_spriteram[offs + 1] & 0x01ff) + 16 * 8 - 1;
213      sx = (m_spriteram[offs + 1] & 0x01ff) + 16 * 8 - 1;
216214      if (sx >= 512) sx -= 512;
217      starty = state->m_spriteram[offs + 0] & 0xff;
218      endy = state->m_spriteram[offs + 0] >> 8;
215      starty = m_spriteram[offs + 0] & 0xff;
216      endy = m_spriteram[offs + 0] >> 8;
219217
220      width = state->m_spriteram[offs + 2] & 0x007f;
221      flipx = state->m_spriteram[offs + 2] & 0x0100;
218      width = m_spriteram[offs + 2] & 0x007f;
219      flipx = m_spriteram[offs + 2] & 0x0100;
222220      if (flipx) sx++;
223221
224      color = 0x40 + (state->m_spriteram[offs + 4] & 0x3f);
222      color = 0x40 + (m_spriteram[offs + 4] & 0x3f);
225223
226224      primask = 8;
227      switch (state->m_spriteram[offs + 4] & 0xc0)
225      switch (m_spriteram[offs + 4] & 0xc0)
228226      {
229227         case 0x00: primask |= 4 | 2 | 1; break; /* below everything */
230228         case 0x40: primask |= 4 | 2;     break; /* below fg and tx */
r20764r20765
233231      }
234232
235233
236      start = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 4] & 0x1f00) << 8);
234      start = m_spriteram[offs + 3] + ((m_spriteram[offs + 4] & 0x1f00) << 8);
237235      rom += 2 * start;
238236
239237      for (y = starty + 1; y <= endy; y++)
r20764r20765
258256                  {
259257                     if (cliprect.contains(sx + x, y))
260258                     {
261                        if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
259                        if ((machine().priority_bitmap.pix8(y, sx + x) & primask) == 0)
262260                           bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f);
263                        machine.priority_bitmap.pix8(y, sx + x) = 8;
261                        machine().priority_bitmap.pix8(y, sx + x) = 8;
264262                     }
265263                  }
266264                  x++;
r20764r20765
277275                  {
278276                     if (cliprect.contains(sx + x, y))
279277                     {
280                        if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
278                        if ((machine().priority_bitmap.pix8(y, sx + x) & primask) == 0)
281279                           bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4);
282                        machine.priority_bitmap.pix8(y, sx + x) = 8;
280                        machine().priority_bitmap.pix8(y, sx + x) = 8;
283281                     }
284282                  }
285283                  x++;
r20764r20765
300298                  {
301299                     if (cliprect.contains(sx + x, y))
302300                     {
303                        if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
301                        if ((machine().priority_bitmap.pix8(y, sx + x) & primask) == 0)
304302                           bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4);
305                        machine.priority_bitmap.pix8(y, sx + x) = 8;
303                        machine().priority_bitmap.pix8(y, sx + x) = 8;
306304                     }
307305                  }
308306                  x++;
r20764r20765
319317                  {
320318                     if (cliprect.contains(sx + x, y))
321319                     {
322                        if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
320                        if ((machine().priority_bitmap.pix8(y, sx + x) & primask) == 0)
323321                           bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f);
324                        machine.priority_bitmap.pix8(y, sx + x) = 8;
322                        machine().priority_bitmap.pix8(y, sx + x) = 8;
325323                     }
326324                  }
327325                  x++;
r20764r20765
334332   }
335333}
336334
337static void set_bg_page( running_machine &machine, int page, int value )
335void deniam_state::set_bg_page( int page, int value )
338336{
339   deniam_state *state = machine.driver_data<deniam_state>();
340337   int tile_index;
341338
342   if (state->m_bg_page[page] != value)
339   if (m_bg_page[page] != value)
343340   {
344      state->m_bg_page[page] = value;
341      m_bg_page[page] = value;
345342      for (tile_index = page * 0x800; tile_index < (page + 1) * 0x800; tile_index++)
346         state->m_bg_tilemap->mark_tile_dirty(tile_index);
343         m_bg_tilemap->mark_tile_dirty(tile_index);
347344   }
348345}
349346
350static void set_fg_page( running_machine &machine, int page, int value )
347void deniam_state::set_fg_page( int page, int value )
351348{
352   deniam_state *state = machine.driver_data<deniam_state>();
353349   int tile_index;
354350
355   if (state->m_fg_page[page] != value)
351   if (m_fg_page[page] != value)
356352   {
357      state->m_fg_page[page] = value;
353      m_fg_page[page] = value;
358354      for (tile_index = page * 0x800; tile_index < (page + 1) * 0x800; tile_index++)
359         state->m_fg_tilemap->mark_tile_dirty(tile_index);
355         m_fg_tilemap->mark_tile_dirty(tile_index);
360356   }
361357}
362358
r20764r20765
371367   bg_scrollx = m_textram[m_bg_scrollx_reg] - m_bg_scrollx_offs;
372368   bg_scrolly = (m_textram[m_bg_scrolly_reg] & 0xff) - m_bg_scrolly_offs;
373369   page = m_textram[m_bg_page_reg];
374   set_bg_page(machine(), 3, (page >>12) & 0x0f);
375   set_bg_page(machine(), 2, (page >> 8) & 0x0f);
376   set_bg_page(machine(), 1, (page >> 4) & 0x0f);
377   set_bg_page(machine(), 0, (page >> 0) & 0x0f);
370   set_bg_page(3, (page >>12) & 0x0f);
371   set_bg_page(2, (page >> 8) & 0x0f);
372   set_bg_page(1, (page >> 4) & 0x0f);
373   set_bg_page(0, (page >> 0) & 0x0f);
378374
379375   fg_scrollx = m_textram[m_fg_scrollx_reg] - m_fg_scrollx_offs;
380376   fg_scrolly = (m_textram[m_fg_scrolly_reg] & 0xff) - m_fg_scrolly_offs;
381377   page = m_textram[m_fg_page_reg];
382   set_fg_page(machine(), 3, (page >>12) & 0x0f);
383   set_fg_page(machine(), 2, (page >> 8) & 0x0f);
384   set_fg_page(machine(), 1, (page >> 4) & 0x0f);
385   set_fg_page(machine(), 0, (page >> 0) & 0x0f);
378   set_fg_page(3, (page >>12) & 0x0f);
379   set_fg_page(2, (page >> 8) & 0x0f);
380   set_fg_page(1, (page >> 4) & 0x0f);
381   set_fg_page(0, (page >> 0) & 0x0f);
386382
387383   m_bg_tilemap->set_scrollx(0, bg_scrollx & 0x1ff);
388384   m_bg_tilemap->set_scrolly(0, bg_scrolly & 0x0ff);
r20764r20765
395391   m_fg_tilemap->draw(bitmap, cliprect, 0, 2);
396392   m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
397393
398   draw_sprites(machine(), bitmap, cliprect);
394   draw_sprites(bitmap, cliprect);
399395   return 0;
400396}
trunk/src/mame/video/darkseal.c
r20764r20765
2626
2727/******************************************************************************/
2828
29static void update_24bitcol(running_machine &machine, int offset)
29void darkseal_state::update_24bitcol(int offset)
3030{
31   darkseal_state *state = machine.driver_data<darkseal_state>();
3231   int r,g,b;
3332
34   r = (state->m_generic_paletteram_16[offset] >> 0) & 0xff;
35   g = (state->m_generic_paletteram_16[offset] >> 8) & 0xff;
36   b = (state->m_generic_paletteram2_16[offset] >> 0) & 0xff;
33   r = (m_generic_paletteram_16[offset] >> 0) & 0xff;
34   g = (m_generic_paletteram_16[offset] >> 8) & 0xff;
35   b = (m_generic_paletteram2_16[offset] >> 0) & 0xff;
3736
38   palette_set_color(machine,offset,MAKE_RGB(r,g,b));
37   palette_set_color(machine(),offset,MAKE_RGB(r,g,b));
3938}
4039
4140WRITE16_MEMBER(darkseal_state::darkseal_palette_24bit_rg_w)
4241{
4342   COMBINE_DATA(&m_generic_paletteram_16[offset]);
44   update_24bitcol(machine(), offset);
43   update_24bitcol(offset);
4544}
4645
4746WRITE16_MEMBER(darkseal_state::darkseal_palette_24bit_b_w)
4847{
4948   COMBINE_DATA(&m_generic_paletteram2_16[offset]);
50   update_24bitcol(machine(), offset);
49   update_24bitcol(offset);
5150}
5251
5352/******************************************************************************/
trunk/src/mame/video/darius.c
r20764r20765
44
55/***************************************************************************/
66
7INLINE void actual_get_fg_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
7inline void darius_state::actual_get_fg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
88{
99   UINT16 code = (ram[tile_index + 0x2000] & 0x7ff);
1010   UINT16 attr = ram[tile_index];
1111
12   SET_TILE_INFO(
12   SET_TILE_INFO_MEMBER(
1313         gfxnum,
1414         code,
1515         ((attr & 0xff) << 2),
r20764r20765
1818
1919TILE_GET_INFO_MEMBER(darius_state::get_fg_tile_info)
2020{
21   actual_get_fg_tile_info(machine(), tileinfo, tile_index, m_fg_ram, 2);
21   actual_get_fg_tile_info(tileinfo, tile_index, m_fg_ram, 2);
2222}
2323
2424/***************************************************************************/
r20764r20765
4141
4242/***************************************************************************/
4343
44static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs )
44void darius_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs )
4545{
46   darius_state *state = machine.driver_data<darius_state>();
47   UINT16 *spriteram = state->m_spriteram;
46   UINT16 *spriteram = m_spriteram;
4847   int offs, curx, cury;
4948   UINT16 code, data, sx, sy;
5049   UINT8 flipx, flipy, color, priority;
5150
52   for (offs = state->m_spriteram.bytes() / 2 - 4; offs >= 0; offs -= 4)
51   for (offs = m_spriteram.bytes() / 2 - 4; offs >= 0; offs -= 4)
5352   {
5453      code = spriteram[offs + 2] & 0x1fff;
5554
r20764r20765
7776         if (curx > 900) curx -= 1024;
7877         if (cury > 400) cury -= 512;
7978
80         drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
79         drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
8180               code, color,
8281               flipx, flipy,
8382               curx, cury, 0);
r20764r20765
8786
8887
8988
90static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs)
89UINT32 darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs)
9190{
92   darius_state *state = screen.machine().driver_data<darius_state>();
91   pc080sn_tilemap_update(m_pc080sn);
9392
94   pc080sn_tilemap_update(state->m_pc080sn);
95
9693   // draw bottom layer(always active)
97   pc080sn_tilemap_draw_offset(state->m_pc080sn, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0, -xoffs, 0);
94   pc080sn_tilemap_draw_offset(m_pc080sn, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0, -xoffs, 0);
9895
9996   /* Sprites can be under/over the layer below text layer */
100   draw_sprites(screen.machine(), bitmap, cliprect, 0, xoffs, -8); // draw sprites with priority 0 which are under the mid layer
97   draw_sprites(bitmap, cliprect, 0, xoffs, -8); // draw sprites with priority 0 which are under the mid layer
10198
10299   // draw middle layer
103   pc080sn_tilemap_draw_offset(state->m_pc080sn, bitmap, cliprect, 1, 0, 0, -xoffs, 0);
100   pc080sn_tilemap_draw_offset(m_pc080sn, bitmap, cliprect, 1, 0, 0, -xoffs, 0);
104101
105   draw_sprites(screen.machine(), bitmap, cliprect, 1, xoffs, -8); // draw sprites with priority 1 which are over the mid layer
102   draw_sprites(bitmap, cliprect, 1, xoffs, -8); // draw sprites with priority 1 which are over the mid layer
106103
107104   /* top(text) layer is in fixed position */
108   state->m_fg_tilemap->set_scrollx(0, 0 + xoffs);
109   state->m_fg_tilemap->set_scrolly(0, -8);
110   state->m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
105   m_fg_tilemap->set_scrollx(0, 0 + xoffs);
106   m_fg_tilemap->set_scrolly(0, -8);
107   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
111108   return 0;
112109}
113110
trunk/src/mame/video/dec0.c
r20764r20765
1717
1818/******************************************************************************/
1919
20static void update_24bitcol(running_machine &machine, int offset)
20void dec0_state::update_24bitcol(int offset)
2121{
22   dec0_state *state = machine.driver_data<dec0_state>();
2322   int r,g,b;
2423
25   r = (state->m_generic_paletteram_16[offset] >> 0) & 0xff;
26   g = (state->m_generic_paletteram_16[offset] >> 8) & 0xff;
27   b = (state->m_generic_paletteram2_16[offset] >> 0) & 0xff;
24   r = (m_generic_paletteram_16[offset] >> 0) & 0xff;
25   g = (m_generic_paletteram_16[offset] >> 8) & 0xff;
26   b = (m_generic_paletteram2_16[offset] >> 0) & 0xff;
2827
29   palette_set_color(machine,offset,MAKE_RGB(r,g,b));
28   palette_set_color(machine(),offset,MAKE_RGB(r,g,b));
3029}
3130
3231WRITE16_MEMBER(dec0_state::dec0_paletteram_rg_w)
3332{
3433   COMBINE_DATA(&m_generic_paletteram_16[offset]);
35   update_24bitcol(machine(), offset);
34   update_24bitcol(offset);
3635}
3736
3837WRITE16_MEMBER(dec0_state::dec0_paletteram_b_w)
3938{
4039   COMBINE_DATA(&m_generic_paletteram2_16[offset]);
41   update_24bitcol(machine(), offset);
40   update_24bitcol(offset);
4241}
4342
4443/******************************************************************************/
trunk/src/mame/video/ddragon.c
r20764r20765
145145               cliprect,gfx, \
146146               (which + order),color,flipx,flipy,sx,sy,0);
147147
148static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
148void ddragon_state::draw_sprites(  bitmap_ind16 &bitmap,const rectangle &cliprect )
149149{
150   ddragon_state *state = machine.driver_data<ddragon_state>();
151   gfx_element *gfx = machine.gfx[1];
150   gfx_element *gfx = machine().gfx[1];
152151
153152   UINT8 *src;
154153   int i;
155154
156   if (state->m_technos_video_hw == 1)     /* China Gate Sprite RAM */
157      src = (UINT8 *) (state->m_spriteram);
155   if (m_technos_video_hw == 1)     /* China Gate Sprite RAM */
156      src = (UINT8 *) (m_spriteram);
158157   else
159      src = (UINT8 *) (&(state->m_spriteram[0x800]));
158      src = (UINT8 *) (&(m_spriteram[0x800]));
160159
161160   for (i = 0; i < (64 * 5); i += 5)
162161   {
r20764r20765
173172         int which;
174173         int color;
175174
176         if (state->m_technos_video_hw == 2)     /* Double Dragon 2 */
175         if (m_technos_video_hw == 2)     /* Double Dragon 2 */
177176         {
178177            color = (src[i + 2] >> 5);
179178            which = src[i + 3] + ((src[i + 2] & 0x1f) << 8);
180179         }
181180         else
182181         {
183            if (state->m_technos_video_hw == 1)     /* China Gate */
182            if (m_technos_video_hw == 1)     /* China Gate */
184183            {
185184               if ((sx < -7) && (sx > -16)) sx += 256; /* fix sprite clip */
186185               if ((sy < -7) && (sy > -16)) sy += 256; /* fix sprite clip */
r20764r20765
189188            which = src[i + 3] + ((src[i + 2] & 0x0f) << 8);
190189         }
191190
192         if (state->flip_screen())
191         if (flip_screen())
193192         {
194193            sx = 240 - sx;
195194            sy = 256 - sy;
r20764r20765
240239   m_bg_tilemap->set_scrolly(0, scrolly);
241240
242241   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
243   draw_sprites(machine(), bitmap, cliprect);
242   draw_sprites(bitmap, cliprect);
244243   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
245244   return 0;
246245}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team