Previous 199869 Revisions Next

r20825 Friday 8th February, 2013 at 11:39:01 UTC by Miodrag Milanović
Modernization of drivers part 6 (no whatsnew)
[src/mame/drivers]gaiden.c galaga.c galaxian.c galpani2.c gijoe.c gladiatr.c glass.c goldstar.c gottlieb.c gridlee.c gstriker.c gsword.c
[src/mame/includes]gaelco.h gaelco2.h gaelco3d.h gaiden.h galaga.h galastrm.h galaxian.h galaxold.h galivan.h galpani2.h galpanic.h galspnbl.h gameplan.h gaplus.h gberet.h gcpinbal.h gijoe.h ginganin.h gladiatr.h glass.h gng.h goal92.h goindol.h goldstar.h gotcha.h gottlieb.h gotya.h grchamp.h gridlee.h groundfx.h gstriker.h gsword.h gunbustr.h gunsmoke.h gyruss.h
[src/mame/machine]gaelco2.c galaxold.c
[src/mame/video]bosco.c digdug.c fastfred.c gaelco.c gaelco2.c gaelco3d.c gaiden.c galaga.c galastrm.c galaxian.c galaxold.c galivan.c galpanic.c galspnbl.c gameplan.c gaplus.c gberet.c gcpinbal.c ginganin.c gladiatr.c glass.c gng.c goal92.c goindol.c gotcha.c gottlieb.c gotya.c grchamp.c groundfx.c gstriker.c gsword.c gunbustr.c gunsmoke.c gyruss.c xevious.c

trunk/src/mame/drivers/gstriker.c
r20824r20825
10181018   }
10191019}
10201020
1021static void mcu_init( running_machine &machine )
1021void gstriker_state::mcu_init( )
10221022{
1023   gstriker_state *state = machine.driver_data<gstriker_state>();
1024   state->m_dmmy_8f_ret = 0xFFFF;
1025   state->m_pending_command = 0;
1026   state->m_mcu_data = 0;
1023   m_dmmy_8f_ret = 0xFFFF;
1024   m_pending_command = 0;
1025   m_mcu_data = 0;
10271026
1028   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state));
1029   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state));
1027   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),this));
1028   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),this));
10301029
1031   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state));
1032   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state));
1030   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),this));
1031   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),this));
10331032}
10341033
10351034DRIVER_INIT_MEMBER(gstriker_state,twrldc94)
10361035{
10371036   m_gametype = 1;
1038   mcu_init( machine() );
1037   mcu_init();
10391038}
10401039
10411040DRIVER_INIT_MEMBER(gstriker_state,twrldc94a)
10421041{
10431042   m_gametype = 2;
1044   mcu_init( machine() );
1043   mcu_init();
10451044}
10461045
10471046DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc)
10481047{
10491048   m_gametype = 3;
1050   mcu_init( machine() );
1049   mcu_init();
10511050
10521051   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle
10531052   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this));
trunk/src/mame/drivers/gottlieb.c
r20824r20825
483483 *
484484 *************************************/
485485
486INLINE void audio_end_state(gottlieb_state *state)
486inline void gottlieb_state::audio_end_state()
487487{
488488   /* this occurs either when the "break in transmission" condition is hit (no zero crossings
489489      for 400usec) or when the entire audio buffer is full */
490   state->m_laserdisc_status |= 0x08;
491   state->m_laserdisc_audio_bit_count = 0;
492   state->m_laserdisc_audio_address = 0;
493   if (state->m_laserdisc_audio_address != 0)
494      printf("Got %d bytes\n", state->m_laserdisc_audio_address);
490   m_laserdisc_status |= 0x08;
491   m_laserdisc_audio_bit_count = 0;
492   m_laserdisc_audio_address = 0;
493   if (m_laserdisc_audio_address != 0)
494      printf("Got %d bytes\n", m_laserdisc_audio_address);
495495}
496496
497497
498static void audio_process_clock(gottlieb_state *state, int logit)
498void gottlieb_state::audio_process_clock(int logit)
499499{
500500   /* clock the bit through the shift register */
501   state->m_laserdisc_audio_bits >>= 1;
502   if (state->m_laserdisc_zero_seen)
503      state->m_laserdisc_audio_bits |= 0x80;
504   state->m_laserdisc_zero_seen = 0;
501   m_laserdisc_audio_bits >>= 1;
502   if (m_laserdisc_zero_seen)
503      m_laserdisc_audio_bits |= 0x80;
504   m_laserdisc_zero_seen = 0;
505505
506506   /* if the buffer ready flag is set, then we are looking for the magic $67 pattern */
507   if (state->m_laserdisc_status & 0x08)
507   if (m_laserdisc_status & 0x08)
508508   {
509      if (state->m_laserdisc_audio_bits == 0x67)
509      if (m_laserdisc_audio_bits == 0x67)
510510      {
511511         if (logit)
512512            logerror(" -- got 0x67");
513         state->m_laserdisc_status &= ~0x08;
514         state->m_laserdisc_audio_address = 0;
513         m_laserdisc_status &= ~0x08;
514         m_laserdisc_audio_address = 0;
515515      }
516516   }
517517
518518   /* otherwise, we keep clocking bytes into the audio buffer */
519519   else
520520   {
521      state->m_laserdisc_audio_bit_count++;
521      m_laserdisc_audio_bit_count++;
522522
523523      /* if we collect 8 bits, add to the buffer */
524      if (state->m_laserdisc_audio_bit_count == 8)
524      if (m_laserdisc_audio_bit_count == 8)
525525      {
526526         if (logit)
527            logerror(" -- got new byte %02X", state->m_laserdisc_audio_bits);
528         state->m_laserdisc_audio_bit_count = 0;
529         state->m_laserdisc_audio_buffer[state->m_laserdisc_audio_address++] = state->m_laserdisc_audio_bits;
527            logerror(" -- got new byte %02X", m_laserdisc_audio_bits);
528         m_laserdisc_audio_bit_count = 0;
529         m_laserdisc_audio_buffer[m_laserdisc_audio_address++] = m_laserdisc_audio_bits;
530530
531531         /* if we collect a full buffer, signal */
532         if (state->m_laserdisc_audio_address >= AUDIORAM_SIZE)
533            audio_end_state(state);
532         if (m_laserdisc_audio_address >= AUDIORAM_SIZE)
533            audio_end_state();
534534      }
535535   }
536536}
537537
538538
539static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, int logit)
539void gottlieb_state::audio_handle_zero_crossing(attotime zerotime, int logit)
540540{
541541   /* compute time from last clock */
542   attotime deltaclock = zerotime - state->m_laserdisc_last_clock;
542   attotime deltaclock = zerotime - m_laserdisc_last_clock;
543543   if (logit)
544544      logerror(" -- zero @ %s (delta=%s)", zerotime.as_string(6), deltaclock.as_string(6));
545545
r20824r20825
548548   {
549549      if (logit)
550550         logerror(" -- count as bit");
551      state->m_laserdisc_zero_seen++;
551      m_laserdisc_zero_seen++;
552552      return;
553553   }
554554
r20824r20825
556556   else if (deltaclock < attotime::from_usec(215))
557557   {
558558      if (logit)
559         logerror(" -- clock, bit=%d", state->m_laserdisc_zero_seen);
560      state->m_laserdisc_last_clock = zerotime;
559         logerror(" -- clock, bit=%d", m_laserdisc_zero_seen);
560      m_laserdisc_last_clock = zerotime;
561561   }
562562
563563   /* if we are outside of 215usec, we are technically a missing clock
r20824r20825
567567   {
568568      if (logit)
569569         logerror(" -- skewed clock, correcting");
570      state->m_laserdisc_last_clock += attotime::from_usec(200);
570      m_laserdisc_last_clock += attotime::from_usec(200);
571571   }
572572
573573   /* we'll count anything more than 275us as an actual missing clock */
r20824r20825
575575   {
576576      if (logit)
577577         logerror(" -- missing clock");
578      state->m_laserdisc_last_clock = zerotime;
578      m_laserdisc_last_clock = zerotime;
579579   }
580580
581581   /* we have a clock, process it */
582   audio_process_clock(state, logit);
582   audio_process_clock(logit);
583583}
584584
585585
r20824r20825
612612
613613      /* if we are past the "break in transmission" time, reset everything */
614614      if ((curtime - state->m_laserdisc_last_clock) > attotime::from_usec(400))
615         audio_end_state(state);
615         state->audio_end_state();
616616
617617      /* if this sample reinforces that the previous one ended a zero crossing, count it */
618618      if ((sample >= 256 && state->m_laserdisc_last_samples[1] >= 0 && state->m_laserdisc_last_samples[0] < 0) ||
r20824r20825
628628         zerotime = curtime + time_per_sample * fractime / 1000;
629629
630630         /* determine if this is a clock; if it is, process */
631         audio_handle_zero_crossing(state, zerotime, logit);
631         state->audio_handle_zero_crossing(zerotime, logit);
632632      }
633633      if (logit)
634634         logerror(" \n");
trunk/src/mame/drivers/galpani2.c
r20824r20825
118118   machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
119119}
120120
121static void galpani2_mcu_nmi1(running_machine &machine)
121void galpani2_state::galpani2_mcu_nmi1()
122122{
123   address_space &srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
124   address_space &dstspace = machine.device("sub")->memory().space(AS_PROGRAM);
123   address_space &srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
124   address_space &dstspace = machine().device("sub")->memory().space(AS_PROGRAM);
125125   UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size;
126126
127127   for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 )
r20824r20825
137137      if (mcu_command != 0)
138138      {
139139         logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n",
140         machine.describe_context(),
140         machine().describe_context(),
141141         mcu_list,
142142         srcspace.read_byte(0x100020),
143143         mcu_command,
r20824r20825
160160
161161         mcu_size    =   (srcspace.read_byte(mcu_address + 8)<<8) +
162162                     (srcspace.read_byte(mcu_address + 9)<<0) ;
163         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
163         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
164164
165165         for( ; mcu_size > 0 ; mcu_size-- )
166166         {
r20824r20825
185185         mcu_size    =   (srcspace.read_byte(mcu_address + 8)<<8) +
186186                     (srcspace.read_byte(mcu_address + 9)<<0) ;
187187
188         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
188         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
189189
190190         for( ; mcu_size > 0 ; mcu_size-- )
191191         {
r20824r20825
213213         srcspace.write_byte(mcu_address+0,0xff);
214214         srcspace.write_byte(mcu_address+1,0xff);
215215
216         logerror("%s : MCU ERROR, unknown command $%02X\n",machine.describe_context(),mcu_command);
216         logerror("%s : MCU ERROR, unknown command $%02X\n",machine().describe_context(),mcu_command);
217217      }
218218
219219      /* Erase command (so that it won't be processed again)? */
r20824r20825
221221   }
222222}
223223
224static void galpani2_mcu_nmi2(running_machine &machine)
224void galpani2_state::galpani2_mcu_nmi2()
225225{
226      galpani2_write_kaneko(machine.device("maincpu"));
227      //logerror("%s : MCU executes CHECKs synchro\n", machine.describe_context());
226      galpani2_write_kaneko(machine().device("maincpu"));
227      //logerror("%s : MCU executes CHECKs synchro\n", machine().describe_context());
228228}
229229
230230WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR
r20824r20825
233233//Triggered from 'maincpu' (00007D60),once, with no command, using alternate line, during init
234234//Triggered from 'maincpu' (000080BE),once, for unknown command, during init
235235//Triggered from 'maincpu' (0000741E),from here on...driven by int5, even if there's no command
236   if ( (data & 1) && !(m_old_mcu_nmi1 & 1) )  galpani2_mcu_nmi1(machine());
236   if ( (data & 1) && !(m_old_mcu_nmi1 & 1) )  galpani2_mcu_nmi1();
237237   //if ( (data & 0x10) && !(m_old_mcu_nmi1 & 0x10) )    galpani2_mcu_nmi1(machine());
238238   //alternate line, same function?
239239   m_old_mcu_nmi1 = data;
r20824r20825
241241
242242WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi2_w)//driven by CPU2's int5 ISR
243243{
244   if ( (data & 1) && !(m_old_mcu_nmi2 & 1) )  galpani2_mcu_nmi2(machine());
244   if ( (data & 1) && !(m_old_mcu_nmi2 & 1) )  galpani2_mcu_nmi2();
245245   m_old_mcu_nmi2 = data;
246246}
247247
trunk/src/mame/drivers/gridlee.c
r20824r20825
8787/* constants */
8888#define FIRQ_SCANLINE 92
8989
90
91/* local prototypes */
92static void poly17_init(running_machine &machine);
93
9490/*************************************
9591 *
9692 *  Interrupt handling
r20824r20825
142138   m_maincpu = machine().device<cpu_device>("maincpu");
143139
144140   /* create the polynomial tables */
145   poly17_init(machine());
141   poly17_init();
146142
147143   state_save_register_global_array(machine(), m_last_analog_input);
148144   state_save_register_global_array(machine(), m_last_analog_output);
r20824r20825
221217#define POLY17_SHR  10
222218#define POLY17_ADD  0x18000
223219
224static void poly17_init(running_machine &machine)
220void gridlee_state::poly17_init()
225221{
226   gridlee_state *state = machine.driver_data<gridlee_state>();
227222   UINT32 i, x = 0;
228223   UINT8 *p, *r;
229224
230225   /* allocate memory */
231   p = state->m_poly17 = auto_alloc_array(machine, UINT8, 2 * (POLY17_SIZE + 1));
232   r = state->m_rand17 = state->m_poly17 + POLY17_SIZE + 1;
226   p = m_poly17 = auto_alloc_array(machine(), UINT8, 2 * (POLY17_SIZE + 1));
227   r = m_rand17 = m_poly17 + POLY17_SIZE + 1;
233228
234229   /* generate the polynomial */
235230   for (i = 0; i < POLY17_SIZE; i++)
trunk/src/mame/drivers/goldstar.c
r20824r20825
1090610906
1090710907// this block swapping is the same for chry10, chrygld and cb3
1090810908//  the underlying bitswaps / xors are different however
10909static void do_blockswaps(running_machine &machine, UINT8* ROM)
10909void goldstar_state::do_blockswaps(UINT8* ROM)
1091010910{
1091110911   int A;
1091210912   UINT8 *buffer;
r20824r20825
1092510925      0xa000, 0xa800, 0xb000, 0xb800,
1092610926   };
1092710927
10928   buffer = auto_alloc_array(machine, UINT8, 0x10000);
10928   buffer = auto_alloc_array(machine(), UINT8, 0x10000);
1092910929   memcpy(buffer,ROM,0x10000);
1093010930
1093110931   // swap some 0x800 blocks around..
r20824r20825
1093410934      memcpy(ROM+A*0x800,buffer+cherry_swaptables[A],0x800);
1093510935   }
1093610936
10937   auto_free(machine, buffer);
10937   auto_free(machine(), buffer);
1093810938}
1093910939
10940static void dump_to_file(running_machine& machine, UINT8* ROM)
10940void goldstar_state::dump_to_file( UINT8* ROM)
1094110941{
1094210942   #if 0
1094310943   {
1094410944      FILE *fp;
1094510945      char filename[256];
10946      sprintf(filename,"decrypted_%s", machine.system().name);
10946      sprintf(filename,"decrypted_%s", machine().system().name);
1094710947      fp=fopen(filename, "w+b");
1094810948      if (fp)
1094910949      {
r20824r20825
1095410954   #endif
1095510955}
1095610956
10957static UINT8 decrypt(UINT8 cipherText, UINT16 address)
10957UINT8 goldstar_state::decrypt(UINT8 cipherText, UINT16 address)
1095810958{
1095910959   int idx;
1096010960   UINT8 output;
r20824r20825
1097110971   return output ^ sbox[idx];
1097210972}
1097310973
10974static UINT8 chry10_decrypt(UINT8 cipherText)
10974UINT8 goldstar_state::chry10_decrypt(UINT8 cipherText)
1097510975{
1097610976   return cipherText ^ (BIT(cipherText, 4) << 3) ^ (BIT(cipherText, 1) << 5) ^ (BIT(cipherText, 6) << 7);
1097710977}
r20824r20825
1098910989      ROM[i] = chry10_decrypt(ROM[i]);
1099010990   }
1099110991
10992   do_blockswaps(machine(), ROM);
10992   do_blockswaps(ROM);
1099310993
1099410994   /* The game has a PIC for protection.
1099510995      If the code enter to this sub, just
r20824r20825
1099710997   */
1099810998   ROM[0xA5DC] = 0xc9;
1099910999
11000   dump_to_file(machine(), ROM);
11000   dump_to_file(ROM);
1100111001}
1100211002
1100311003DRIVER_INIT_MEMBER(goldstar_state,cb3)
r20824r20825
1101311013      ROM[i] = decrypt(ROM[i], i);
1101411014   }
1101511015
11016   do_blockswaps(machine(), ROM);
11017   dump_to_file(machine(), ROM);
11016   do_blockswaps(ROM);
11017   dump_to_file(ROM);
1101811018}
1101911019
1102011020
r20824r20825
1102211022{
1102311023   int A;
1102411024   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11025   do_blockswaps(machine(), ROM);
11025   do_blockswaps(ROM);
1102611026
1102711027   // a data bitswap
1102811028   for (A = 0;A < 0x10000;A++)
r20824r20825
1103211032      ROM[A] = dat;
1103311033   }
1103411034
11035   dump_to_file(machine(), ROM);
11035   dump_to_file(ROM);
1103611036}
1103711037
1103811038DRIVER_INIT_MEMBER(goldstar_state,cm)
trunk/src/mame/drivers/galaxian.c
r20824r20825
827827}
828828
829829
830static void monsterz_set_latch(running_machine &machine)
830void galaxian_state::monsterz_set_latch()
831831{
832832   // read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious)
833   galaxian_state *state = machine.driver_data<galaxian_state>();
834   UINT8 *rom = state->memregion("audiocpu")->base();
835   state->m_protection_result = rom[0x2000 | (state->m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
833   UINT8 *rom = memregion("audiocpu")->base();
834   m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
836835
837836   // and an irq on the main z80 afterwards
838   machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE );
837   machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE );
839838}
840839
841840
r20824r20825
844843   // d7 high: set latch + advance address high bits (and reset low bits?)
845844   if (data & 0x80)
846845   {
847      monsterz_set_latch(machine());
846      monsterz_set_latch();
848847      m_protection_state = (m_protection_state + 0x100) & 0xff00;
849848   }
850849}
r20824r20825
854853   // d3 high: set latch + advance address low bits
855854   if (data & 0x08)
856855   {
857      monsterz_set_latch(machine());
856      monsterz_set_latch();
858857      m_protection_state = ((m_protection_state + 1) & 0x00ff) | (m_protection_state & 0xff00);
859858   }
860859}
r20824r20825
25142513 *
25152514 *************************************/
25162515
2517static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest)
2516void galaxian_state::decode_mooncrst(int length, UINT8 *dest)
25182517{
2519   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
2518   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
25202519   int offs;
25212520
25222521   for (offs = 0; offs < length; offs++)
r20824r20825
25312530}
25322531
25332532
2534static void decode_checkman(running_machine &machine)
2533void galaxian_state::decode_checkman()
25352534{
25362535   /*
25372536                            Encryption Table
r20824r20825
25782577      { 0,2,0,2 },
25792578      { 1,4,1,4 }
25802579   };
2581   UINT8 *rombase = machine.root_device().memregion("maincpu")->base();
2582   UINT32 romlength = machine.root_device().memregion("maincpu")->bytes();
2580   UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
2581   UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
25832582   UINT32 offs;
25842583
25852584   for (offs = 0; offs < romlength; offs++)
r20824r20825
25932592}
25942593
25952594
2596static void decode_dingoe(running_machine &machine)
2595void galaxian_state::decode_dingoe()
25972596{
2598   UINT8 *rombase = machine.root_device().memregion("maincpu")->base();
2599   UINT32 romlength = machine.root_device().memregion("maincpu")->bytes();
2597   UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
2598   UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
26002599   UINT32 offs;
26012600
26022601   for (offs = 0; offs < romlength; offs++)
r20824r20825
26162615}
26172616
26182617
2619static void decode_frogger_sound(running_machine &machine)
2618void galaxian_state::decode_frogger_sound()
26202619{
2621   UINT8 *rombase = machine.root_device().memregion("audiocpu")->base();
2620   UINT8 *rombase = machine().root_device().memregion("audiocpu")->base();
26222621   UINT32 offs;
26232622
26242623   /* the first ROM of the sound CPU has data lines D0 and D1 swapped */
r20824r20825
26272626}
26282627
26292628
2630static void decode_frogger_gfx(running_machine &machine)
2629void galaxian_state::decode_frogger_gfx()
26312630{
2632   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
2631   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
26332632   UINT32 offs;
26342633
26352634   /* the 2nd gfx ROM has data lines D0 and D1 swapped */
r20824r20825
26382637}
26392638
26402639
2641static void decode_anteater_gfx(running_machine &machine)
2640void galaxian_state::decode_anteater_gfx()
26422641{
2643   UINT32 romlength = machine.root_device().memregion("gfx1")->bytes();
2644   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
2645   UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength);
2642   UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
2643   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
2644   UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
26462645   UINT32 offs;
26472646
26482647   memcpy(scratch, rombase, romlength);
r20824r20825
26542653      srcoffs |= (BIT(offs,0) ^ BIT(offs,6) ^ 1) << 10;
26552654      rombase[offs] = scratch[srcoffs];
26562655   }
2657   auto_free(machine, scratch);
2656   auto_free(machine(), scratch);
26582657}
26592658
26602659
2661static void decode_losttomb_gfx(running_machine &machine)
2660void galaxian_state::decode_losttomb_gfx()
26622661{
2663   UINT32 romlength = machine.root_device().memregion("gfx1")->bytes();
2664   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
2665   UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength);
2662   UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
2663   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
2664   UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
26662665   UINT32 offs;
26672666
26682667   memcpy(scratch, rombase, romlength);
r20824r20825
26742673      srcoffs |= ((BIT(offs,1) & BIT(offs,7)) | ((1 ^ BIT(offs,1)) & (BIT(offs,8)))) << 10;
26752674      rombase[offs] = scratch[srcoffs];
26762675   }
2677   auto_free(machine, scratch);
2676   auto_free(machine(), scratch);
26782677}
26792678
26802679
2681static void decode_superbon(running_machine &machine)
2680void galaxian_state::decode_superbon()
26822681{
26832682   offs_t i;
26842683   UINT8 *RAM;
26852684
26862685   /* Deryption worked out by hand by Chris Hardy. */
26872686
2688   RAM = machine.root_device().memregion("maincpu")->base();
2687   RAM = machine().root_device().memregion("maincpu")->base();
26892688
26902689   for (i = 0;i < 0x1000;i++)
26912690   {
r20824r20825
27152714 *
27162715 *************************************/
27172716
2718static void common_init(
2719   running_machine &machine,
2720   galaxian_draw_bullet_func draw_bullet,
2721   galaxian_draw_background_func draw_background,
2722   galaxian_extend_tile_info_func extend_tile_info,
2723   galaxian_extend_sprite_info_func extend_sprite_info)
2717void galaxian_state::common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background,
2718   galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info)
27242719{
2725   galaxian_state *state = machine.driver_data<galaxian_state>();
2726   state->m_irq_enabled = 0;
2727   state->m_irq_line = INPUT_LINE_NMI;
2728   state->m_numspritegens = 1;
2729   state->m_bullets_base = 0x60;
2730   state->m_frogger_adjust = FALSE;
2731   state->m_sfx_tilemap = FALSE;
2732   state->m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet;
2733   state->m_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background;
2734   state->m_extend_tile_info_ptr = extend_tile_info;
2735   state->m_extend_sprite_info_ptr = extend_sprite_info;
2720   m_irq_enabled = 0;
2721   m_irq_line = INPUT_LINE_NMI;
2722   m_numspritegens = 1;
2723   m_bullets_base = 0x60;
2724   m_frogger_adjust = FALSE;
2725   m_sfx_tilemap = FALSE;
2726   m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : &galaxian_state::galaxian_draw_bullet;
2727   m_draw_background_ptr = (draw_background != NULL) ? draw_background : &galaxian_state::galaxian_draw_background;
2728   m_extend_tile_info_ptr = extend_tile_info;
2729   m_extend_sprite_info_ptr = extend_sprite_info;
27362730}
27372731
27382732
2739static void unmap_galaxian_sound(running_machine &machine, offs_t base)
2733void galaxian_state::unmap_galaxian_sound(offs_t base)
27402734{
2741   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
2735   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27422736
27432737   space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8);
27442738   space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8);
r20824r20825
27552749
27562750DRIVER_INIT_MEMBER(galaxian_state,galaxian)
27572751{
2758   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
2752   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
27592753}
27602754
27612755
r20824r20825
27762770   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27772771
27782772   /* yellow bullets instead of white ones */
2779   common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL);
2773   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
27802774
27812775   /* coin lockout disabled */
27822776   space.unmap_write(0x6002, 0x6002, 0, 0x7f8);
r20824r20825
27882782   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27892783
27902784   /* video extensions */
2791   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info);
2785   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::gmgalax_extend_tile_info, &galaxian_state::gmgalax_extend_sprite_info);
27922786
27932787   /* ROM is banked */
27942788   space.install_read_bank(0x0000, 0x3fff, "bank1");
r20824r20825
28052799   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28062800
28072801   /* video extensions */
2808   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
2802   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info);
28092803
28102804   /* coin lockout replaced by graphics bank */
28112805   space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
r20824r20825
28172811   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28182812
28192813   /* video extensions */
2820   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
2814   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
28212815
28222816   /* coin lockout replaced by graphics bank */
28232817   space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
r20824r20825
28292823   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28302824
28312825   /* same as galaxian... */
2832   common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
2826   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
28332827
28342828   /* ...but needs a full 2k of RAM */
28352829   space.install_ram(0x4000, 0x47ff);
r20824r20825
28462840DRIVER_INIT_MEMBER(galaxian_state,mooncrst)
28472841{
28482842   /* video extensions */
2849   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
2843   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
28502844
28512845   /* decrypt program code */
2852   decode_mooncrst(machine(), 0x8000, machine().root_device().memregion("maincpu")->base());
2846   decode_mooncrst(0x8000, machine().root_device().memregion("maincpu")->base());
28532847}
28542848
28552849
28562850DRIVER_INIT_MEMBER(galaxian_state,mooncrsu)
28572851{
28582852   /* video extensions */
2859   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
2853   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
28602854}
28612855
28622856
r20824r20825
28652859   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28662860
28672861   /* video extensions */
2868   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
2862   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
28692863
28702864   /* LEDs and coin lockout replaced by graphics banking */
28712865   space.install_write_handler(0x6000, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
r20824r20825
28782872   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
28792873
28802874   /* video extensions */
2881   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info);
2875   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::moonqsr_extend_tile_info, &galaxian_state::moonqsr_extend_sprite_info);
28822876
28832877   /* decrypt program code */
2884   decode_mooncrst(machine(), 0x8000, decrypt);
2878   decode_mooncrst(0x8000, decrypt);
28852879   space.set_decrypted_region(0x0000, 0x7fff, decrypt);
28862880}
28872881
r20824r20825
29572951      which tenspot appears to have copied */
29582952
29592953   /* video extensions */
2960   //common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
2954   //common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
29612955
29622956   /* coin lockout replaced by graphics bank */
29632957   //space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w));
r20824r20825
29792973DRIVER_INIT_MEMBER(galaxian_state,devilfsg)
29802974{
29812975   /* video extensions */
2982   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
2976   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
29832977
29842978   /* IRQ line is INT, not NMI */
29852979   m_irq_line = 0;
r20824r20825
29912985   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
29922986
29932987   /* video extensions */
2994   common_init(machine(), NULL, galaxian_draw_background, NULL, NULL);
2988   common_init(NULL, &galaxian_state::galaxian_draw_background, NULL, NULL);
29952989   m_draw_bullet_ptr = NULL;
29962990
29972991   /* two sprite generators */
r20824r20825
30163010   space.unmap_write(0x6002, 0x6002, 0, 0x7f8);
30173011
30183012   /* remove the galaxian sound hardware */
3019   unmap_galaxian_sound(machine(), 0x6000);
3013   unmap_galaxian_sound( 0x6000);
30203014
30213015   /* install our AY-8910 handler */
30223016   space.install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),this));
r20824r20825
30263020DRIVER_INIT_MEMBER(galaxian_state,jumpbug)
30273021{
30283022   /* video extensions */
3029   common_init(machine(), scramble_draw_bullet, jumpbug_draw_background, jumpbug_extend_tile_info, jumpbug_extend_sprite_info);
3023   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::jumpbug_draw_background, &galaxian_state::jumpbug_extend_tile_info, &galaxian_state::jumpbug_extend_sprite_info);
30303024}
30313025
30323026
r20824r20825
30363030   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
30373031
30383032   /* video extensions */
3039   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
3033   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
30403034
30413035   /* move the interrupt enable from $b000 to $b001 */
30423036   space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
r20824r20825
30463040   iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
30473041
30483042   /* decrypt program code */
3049   decode_checkman(machine());
3043   decode_checkman();
30503044}
30513045
30523046
r20824r20825
30553049   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
30563050
30573051   /* video extensions */
3058   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
3052   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
30593053
30603054   /* attach the sound command handler */
30613055   space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
r20824r20825
30703064   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
30713065
30723066   /* video extensions */
3073   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
3067   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
30743068
30753069   /* attach the sound command handler */
30763070   space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
r20824r20825
30863080   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
30873081
30883082   /* video extensions */
3089   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
3083   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
30903084
30913085   /* move the interrupt enable from $b000 to $b001 */
30923086   space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
r20824r20825
30983092   space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this));   /* Protection check */
30993093
31003094   /* decrypt program code */
3101   decode_dingoe(machine());
3095   decode_dingoe();
31023096}
31033097
31043098
r20824r20825
31073101   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31083102
31093103   /* video extensions */
3110   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
3104   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info);
31113105
31123106   /* coin lockout replaced by graphics bank */
31133107   space.install_write_handler(0xa002, 0xa002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
r20824r20825
31253119   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31263120
31273121   /* video extensions */
3128   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info);
3122   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info);
31293123
31303124   /* needs a full 2k of RAM */
31313125   space.install_ram(0x8000, 0x87ff);
r20824r20825
31353129}
31363130
31373131
3138static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16])
3132void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16])
31393133{
3140   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3141   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
3142   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
3134   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3135   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
3136   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000);
31433137   int A;
31443138
31453139   space.set_decrypted_region(0x0000, 0xffff, decrypt);
r20824r20825
31783172   };
31793173
31803174   /* video extensions */
3181   common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info);
3175   common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info);
31823176
31833177   /* IRQ line is INT, not NMI */
31843178   m_irq_line = 0;
31853179
31863180   /* decrypt the code */
3187   mshuttle_decode(machine(), convtable);
3181   mshuttle_decode(convtable);
31883182}
31893183
31903184
r20824r20825
32033197   };
32043198
32053199   /* video extensions */
3206   common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info);
3200   common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info);
32073201
32083202   /* IRQ line is INT, not NMI */
32093203   m_irq_line = 0;
32103204
32113205   /* decrypt the code */
3212   mshuttle_decode(machine(), convtable);
3206   mshuttle_decode(convtable);
32133207}
32143208
32153209
32163210DRIVER_INIT_MEMBER(galaxian_state,fantastc)
32173211{
32183212   /* video extensions */
3219   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info);
3213   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info);
32203214
32213215   /* two sprite generators */
32223216   m_numspritegens = 2;
r20824r20825
32513245   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32523246
32533247   /* video extensions */
3254   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
3248   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
32553249
32563250   /* disable the stars */
32573251   space.unmap_write(0xb004, 0xb004, 0, 0x07f8);
r20824r20825
32713265   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32723266
32733267   /* video extensions */
3274   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
3268   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
32753269
32763270   /* move the interrupt enable from $b000 to $b001 */
32773271   space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
r20824r20825
32923286   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32933287
32943288   /* video extensions */
3295   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
3289   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
32963290
32973291   /* move the interrupt enable from $b000 to $b001 */
32983292   space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
r20824r20825
33163310   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33173311
33183312   /* video extensions */
3319   common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL);
3313   common_init(&galaxian_state::theend_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
33203314
33213315   /* coin counter on the upper bit of port C */
33223316   space.unmap_write(0x6802, 0x6802, 0, 0x7f8);
r20824r20825
33263320DRIVER_INIT_MEMBER(galaxian_state,scramble)
33273321{
33283322   /* video extensions */
3329   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3323   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
33303324}
33313325
33323326
r20824r20825
33353329   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33363330
33373331   /* video extensions */
3338   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3332   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
33393333
33403334   /* watchdog works for writes as well? (or is it just disabled?) */
33413335   space.install_write_handler(0x7000, 0x7000, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::watchdog_reset_w),this));
r20824r20825
33543348DRIVER_INIT_MEMBER(galaxian_state,sfx)
33553349{
33563350   /* basic configuration */
3357   common_init(machine(), scramble_draw_bullet, scramble_draw_background, upper_extend_tile_info, NULL);
3351   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::upper_extend_tile_info, NULL);
33583352   m_sfx_tilemap = TRUE;
33593353
33603354   /* sound board has space for extra ROM */
r20824r20825
33683362   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33693363
33703364   /* video extensions */
3371   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3365   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
33723366
33733367   /* watchdog is at $7800? (or is it just disabled?) */
33743368   space.unmap_read(0x7000, 0x7000, 0, 0x7ff);
r20824r20825
33793373DRIVER_INIT_MEMBER(galaxian_state,scobra)
33803374{
33813375   /* video extensions */
3382   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3376   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
33833377}
33843378
33853379
33863380DRIVER_INIT_MEMBER(galaxian_state,losttomb)
33873381{
33883382   /* video extensions */
3389   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3383   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
33903384
33913385   /* decrypt */
3392   decode_losttomb_gfx(machine());
3386   decode_losttomb_gfx();
33933387}
33943388
33953389
33963390DRIVER_INIT_MEMBER(galaxian_state,frogger)
33973391{
33983392   /* video extensions */
3399   common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
3393   common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
34003394   m_frogger_adjust = TRUE;
34013395
34023396   /* decrypt */
3403   decode_frogger_sound(machine());
3404   decode_frogger_gfx(machine());
3397   decode_frogger_sound();
3398   decode_frogger_gfx();
34053399}
34063400
34073401
r20824r20825
34103404   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
34113405
34123406   /* video extensions */
3413   common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
3407   common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
34143408
34153409   space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this));
34163410   space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),this));
r20824r20825
34193413   space.install_ram(0x8000, 0x87ff);
34203414
34213415   /* decrypt */
3422   decode_frogger_sound(machine());
3416   decode_frogger_sound();
34233417}
34243418
34253419
34263420DRIVER_INIT_MEMBER(galaxian_state,froggers)
34273421{
34283422   /* video extensions */
3429   common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
3423   common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
34303424
34313425   /* decrypt */
3432   decode_frogger_sound(machine());
3426   decode_frogger_sound();
34333427}
34343428
34353429
34363430DRIVER_INIT_MEMBER(galaxian_state,turtles)
34373431{
34383432   /* video extensions */
3439   common_init(machine(), NULL, turtles_draw_background, NULL, NULL);
3433   common_init(NULL, &galaxian_state::turtles_draw_background, NULL, NULL);
34403434}
34413435
34423436
r20824r20825
34453439{
34463440   /* no existing amidar sets run on Amidar hardware as described by Amidar schematics! */
34473441   /* video extensions */
3448   common_init(machine(), scramble_draw_bullet, amidar_draw_background, NULL, NULL);
3442   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::amidar_draw_background, NULL, NULL);
34493443}
34503444#endif
34513445
r20824r20825
34543448{
34553449   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
34563450
3457   common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
3451   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
34583452
34593453   /* hook up AY8910 */
34603454   machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this));
r20824r20825
34903484DRIVER_INIT_MEMBER(galaxian_state,anteater)
34913485{
34923486   /* video extensions */
3493   common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL);
3487   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL);
34943488
34953489   /* decode graphics */
3496   decode_anteater_gfx(machine());
3490   decode_anteater_gfx();
34973491}
34983492
34993493
35003494DRIVER_INIT_MEMBER(galaxian_state,anteateruk)
35013495{
35023496   /* video extensions */
3503   common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL);
3497   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL);
35043498}
35053499
35063500
35073501DRIVER_INIT_MEMBER(galaxian_state,superbon)
35083502{
35093503   /* video extensions */
3510   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3504   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
35113505
35123506   /* decode code */
3513   decode_superbon(machine());
3507   decode_superbon();
35143508}
35153509
35163510
35173511DRIVER_INIT_MEMBER(galaxian_state,calipso)
35183512{
35193513   /* video extensions */
3520   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, calipso_extend_sprite_info);
3514   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, &galaxian_state::calipso_extend_sprite_info);
35213515}
35223516
35233517
35243518DRIVER_INIT_MEMBER(galaxian_state,moonwar)
35253519{
35263520   /* video extensions */
3527   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
3521   common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
35283522
35293523   state_save_register_global(machine(), m_moonwar_port_select);
35303524}
r20824r20825
35433537DRIVER_INIT_MEMBER( galaxian_state, froggrs )
35443538{
35453539   /* video extensions */
3546   common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
3540   common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
35473541
35483542   /* decrypt */
3549   decode_frogger_sound(machine());
3550   decode_frogger_gfx(machine());
3543   decode_frogger_sound();
3544   decode_frogger_gfx();
35513545}
35523546
35533547
trunk/src/mame/drivers/gaiden.c
r20824r20825
15061506   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this));
15071507}
15081508
1509static void descramble_drgnbowl_gfx(running_machine &machine)
1509void gaiden_state::descramble_drgnbowl_gfx()
15101510{
15111511   int i;
1512   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1513   size_t size = machine.root_device().memregion("maincpu")->bytes();
1514   UINT8 *buffer = auto_alloc_array(machine, UINT8, size);
1512   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1513   size_t size = machine().root_device().memregion("maincpu")->bytes();
1514   UINT8 *buffer = auto_alloc_array(machine(), UINT8, size);
15151515
15161516   memcpy(buffer, ROM, size);
15171517   for( i = 0; i < size; i++ )
r20824r20825
15241524                        3, 2, 1, 0)];
15251525   }
15261526
1527   auto_free(machine, buffer);
1527   auto_free(machine(), buffer);
15281528
1529   ROM = machine.root_device().memregion("gfx2")->base();
1530   size = machine.root_device().memregion("gfx2")->bytes();
1531   buffer = auto_alloc_array(machine, UINT8, size);
1529   ROM = machine().root_device().memregion("gfx2")->base();
1530   size = machine().root_device().memregion("gfx2")->bytes();
1531   buffer = auto_alloc_array(machine(), UINT8, size);
15321532
15331533   memcpy(buffer,ROM,size);
15341534   for( i = 0; i < size; i++ )
r20824r20825
15411541                              5, 2, 1, 0)];
15421542   }
15431543
1544   auto_free(machine, buffer);
1544   auto_free(machine(), buffer);
15451545}
15461546
15471547DRIVER_INIT_MEMBER(gaiden_state,drgnbowl)
15481548{
15491549   m_raiga_jumppoints = jumppoints_00;
15501550
1551   descramble_drgnbowl_gfx(machine());
1551   descramble_drgnbowl_gfx();
15521552}
15531553
1554static void descramble_mastninj_gfx(running_machine &machine, UINT8* src)
1554void gaiden_state::descramble_mastninj_gfx(UINT8* src)
15551555{
15561556   UINT8 *buffer;
15571557   int len = 0x80000;
15581558
15591559   /*  rearrange gfx */
1560   buffer = auto_alloc_array(machine, UINT8, len);
1560   buffer = auto_alloc_array(machine(), UINT8, len);
15611561   {
15621562      int i;
15631563      for (i = 0;i < len; i++)
r20824r20825
15711571         3,2,1,0)];
15721572      }
15731573      memcpy(src, buffer, len);
1574      auto_free(machine, buffer);
1574      auto_free(machine(), buffer);
15751575   }
15761576
1577   buffer = auto_alloc_array(machine, UINT8, len);
1577   buffer = auto_alloc_array(machine(), UINT8, len);
15781578   {
15791579      int i;
15801580      for (i = 0; i < len; i++)
r20824r20825
15881588         3,2,1,0)];
15891589      }
15901590      memcpy(src, buffer, len);
1591      auto_free(machine, buffer);
1591      auto_free(machine(), buffer);
15921592   }
15931593}
15941594
15951595DRIVER_INIT_MEMBER(gaiden_state,mastninj)
15961596{
15971597   // rearrange the graphic roms into a format that MAME can decode
1598   descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx2")->base());
1599   descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx3")->base());
1598   descramble_mastninj_gfx(machine().root_device().memregion("gfx2")->base());
1599   descramble_mastninj_gfx(machine().root_device().memregion("gfx3")->base());
16001600   DRIVER_INIT_CALL(shadoww);
16011601}
16021602
trunk/src/mame/drivers/gijoe.c
r20824r20825
8282   }
8383}
8484
85static void gijoe_objdma( running_machine &machine )
85void gijoe_state::gijoe_objdma(  )
8686{
87   gijoe_state *state = machine.driver_data<gijoe_state>();
8887   UINT16 *src_head, *src_tail, *dst_head, *dst_tail;
8988
90   src_head = state->m_spriteram;
91   src_tail = state->m_spriteram + 255 * 8;
92   k053247_get_ram(state->m_k053246, &dst_head);
89   src_head = m_spriteram;
90   src_tail = m_spriteram + 255 * 8;
91   k053247_get_ram(m_k053246, &dst_head);
9392   dst_tail = dst_head + 255 * 8;
9493
9594   for (; src_head <= src_tail; src_head += 8)
r20824r20825
121120
122121   if (k053246_is_irq_enabled(m_k053246))
123122   {
124      gijoe_objdma(machine());
123      gijoe_objdma();
125124
126125      // 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock
127126      m_dmadelay_timer->adjust(JOE_DMADELAY);
trunk/src/mame/drivers/galaga.c
r20824r20825
882882   save_item(NAME(m_sub2_nmi_mask));
883883}
884884
885static void bosco_latch_reset(running_machine &machine)
885void galaga_state::bosco_latch_reset()
886886{
887   galaga_state *state = machine.driver_data<galaga_state>();
888   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
887   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
889888   int i;
890889
891890   /* Reset all latches */
892891   for (i = 0;i < 8;i++)
893      state->bosco_latch_w(space,i,0);
892      bosco_latch_w(space,i,0);
894893}
895894
896895MACHINE_RESET_MEMBER(galaga_state,galaga)
897896{
898897   /* Reset all latches */
899   bosco_latch_reset(machine());
898   bosco_latch_reset();
900899
901900   m_cpu3_interrupt_timer->adjust(machine().primary_screen->time_until_pos(64), 64);
902901}
trunk/src/mame/drivers/gladiatr.c
r20824r20825
982982ROM_END
983983
984984
985static void swap_block(UINT8 *src1,UINT8 *src2,int len)
985void gladiatr_state::swap_block(UINT8 *src1,UINT8 *src2,int len)
986986{
987987   int i,t;
988988
trunk/src/mame/drivers/gsword.c
r20824r20825
150150
151151
152152#if 0
153static int gsword_coins_in(void)
153int ::gsword_coins_in(void)
154154{
155155   /* emulate 8741 coin slot */
156   if (machine.root_device().ioport("IN4")->read() & 0xc0)
156   if (machine().root_device().ioport("IN4")->read() & 0xc0)
157157   {
158158      logerror("Coin In\n");
159159      return 0x80;
trunk/src/mame/drivers/glass.c
r20824r20825
284284
285285***************************************************************************/
286286
287static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
287void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
288288{
289289   int i;
290290
291291   /* get a pointer to the source data */
292   UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base();
292   UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
293293
294294   /* get a pointer to the destination data */
295   UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base();
295   UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
296296
297297   /* fill destination areas with the proper data */
298298   for (i = 0; i < length / 2; i++)
r20824r20825
404404   */
405405
406406   /* split ROM H13 */
407   glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
407   glass_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
408408
409409   /* split ROM H11 */
410   glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
410   glass_ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
411411
412412   /* install custom handler over RAM for protection */
413413   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));
trunk/src/mame/machine/galaxold.c
r20824r20825
6464}
6565
6666
67static void machine_reset_common(running_machine &machine, int line)
67void galaxold_state::machine_reset_common(int line)
6868{
69   galaxold_state *state = machine.driver_data<galaxold_state>();
70   ttl7474_device *ttl7474_9m_1 = machine.device<ttl7474_device>("7474_9m_1");
71   ttl7474_device *ttl7474_9m_2 = machine.device<ttl7474_device>("7474_9m_2");
72   state->m_irq_line = line;
69   ttl7474_device *ttl7474_9m_1 = machine().device<ttl7474_device>("7474_9m_1");
70   ttl7474_device *ttl7474_9m_2 = machine().device<ttl7474_device>("7474_9m_2");
71   m_irq_line = line;
7372
7473   /* initalize main CPU interrupt generator flip-flops */
7574   ttl7474_9m_2->preset_w(1);
r20824r20825
8079   ttl7474_9m_1->preset_w(0);
8180
8281   /* start a timer to generate interrupts */
83   timer_device *int_timer = machine.device<timer_device>("int_timer");
84   int_timer->adjust(machine.primary_screen->time_until_pos(0));
82   timer_device *int_timer = machine().device<timer_device>("int_timer");
83   int_timer->adjust(machine().primary_screen->time_until_pos(0));
8584}
8685
8786MACHINE_RESET_MEMBER(galaxold_state,galaxold)
8887{
89   machine_reset_common(machine(), INPUT_LINE_NMI);
88   machine_reset_common(INPUT_LINE_NMI);
9089}
9190
9291MACHINE_RESET_MEMBER(galaxold_state,devilfsg)
9392{
94   machine_reset_common(machine(), 0);
93   machine_reset_common(0);
9594}
9695
9796MACHINE_RESET_MEMBER(galaxold_state,hunchbkg)
9897{
99   machine_reset_common(machine(), 0);
98   machine_reset_common(0);
10099   machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxold_state::hunchbkg_irq_callback),this));
101100}
102101
r20824r20825
281280}
282281
283282
284static UINT8 decode_mooncrst(UINT8 data,offs_t addr)
283UINT8 galaxold_state::decode_mooncrst(UINT8 data,offs_t addr)
285284{
286285   UINT8 res;
287286
trunk/src/mame/machine/gaelco2.c
r20824r20825
1717
1818***************************************************************************/
1919
20static void gaelco2_ROM16_split_gfx(running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2)
20void gaelco2_state::gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2)
2121{
2222   int i;
2323
2424   /* get a pointer to the source data */
25   UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base();
25   UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
2626
2727   /* get a pointer to the destination data */
28   UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base();
28   UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
2929
3030   /* fill destination areas with the proper data */
3131   for (i = 0; i < length/2; i++){
r20824r20825
6262   */
6363
6464   /* split ROM u48 */
65   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
65   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
6666
6767   /* split ROM u47 */
68   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
68   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
6969
7070   /* split ROM u50 */
71   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
71   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
7272
7373   /* split ROM u49 */
74   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000);
74   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000);
7575}
7676
7777
r20824r20825
9393   */
9494
9595   /* split ROM ic65 */
96   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
96   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
9797
9898   /* split ROM ic66 */
99   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000);
99   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000);
100100
101101   /* split ROM ic67 */
102   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
102   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
103103}
104104
105105
r20824r20825
121121   */
122122
123123   /* split ROM sb44 */
124   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
124   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
125125
126126   /* split ROM sb45 */
127   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
127   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
128128
129129   /* split ROM sb46 */
130   gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
130   gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
131131}
132132
133133/***************************************************************************
trunk/src/mame/video/goindol.c
r20824r20825
8080
8181***************************************************************************/
8282
83static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram )
83void goindol_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram )
8484{
85   goindol_state *state = machine.driver_data<goindol_state>();
8685   int offs, sx, sy, tile, palette;
8786
88   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
87   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
8988   {
9089      sx = sprite_ram[offs];
9190      sy = 240 - sprite_ram[offs + 1];
9291
93      if (state->flip_screen())
92      if (flip_screen())
9493      {
9594         sx = 248 - sx;
9695         sy = 248 - sy;
r20824r20825
103102         palette = sprite_ram[offs + 2] >> 3;
104103
105104         drawgfx_transpen(bitmap,cliprect,
106                  machine.gfx[gfxbank],
105                  machine().gfx[gfxbank],
107106                  tile,
108107                  palette,
109                  state->flip_screen(),state->flip_screen(),
108                  flip_screen(),flip_screen(),
110109                  sx,sy, 0);
111110         drawgfx_transpen(bitmap,cliprect,
112                  machine.gfx[gfxbank],
111                  machine().gfx[gfxbank],
113112                  tile+1,
114113                  palette,
115                  state->flip_screen(),state->flip_screen(),
116                  sx,sy + (state->flip_screen() ? -8 : 8), 0);
114                  flip_screen(),flip_screen(),
115                  sx,sy + (flip_screen() ? -8 : 8), 0);
117116      }
118117   }
119118}
r20824r20825
125124
126125   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
127126   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
128   draw_sprites(machine(), bitmap, cliprect, 1, m_spriteram);
129   draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram2);
127   draw_sprites(bitmap, cliprect, 1, m_spriteram);
128   draw_sprites(bitmap, cliprect, 0, m_spriteram2);
130129   return 0;
131130}
trunk/src/mame/video/gsword.c
r20824r20825
158158         8, 8, 32, 64);
159159}
160160
161static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
161void gsword_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
162162{
163   gsword_state *state = machine.driver_data<gsword_state>();
164163   int offs;
165164
166   for (offs = 0; offs < state->m_spritexy_ram.bytes() - 1; offs+=2)
165   for (offs = 0; offs < m_spritexy_ram.bytes() - 1; offs+=2)
167166   {
168167      int sx,sy,flipx,flipy,spritebank,tile,color;
169168
170      if (state->m_spritexy_ram[offs]!=0xf1)
169      if (m_spritexy_ram[offs]!=0xf1)
171170      {
172171         spritebank = 0;
173         tile = state->m_spritetile_ram[offs];
174         color = state->m_spritetile_ram[offs+1] & 0x3f;
175         sy = 241-state->m_spritexy_ram[offs];
176         sx = state->m_spritexy_ram[offs+1]-56;
177         flipx = state->m_spriteattrib_ram[offs] & 0x02;
178         flipy = state->m_spriteattrib_ram[offs] & 0x01;
172         tile = m_spritetile_ram[offs];
173         color = m_spritetile_ram[offs+1] & 0x3f;
174         sy = 241-m_spritexy_ram[offs];
175         sx = m_spritexy_ram[offs+1]-56;
176         flipx = m_spriteattrib_ram[offs] & 0x02;
177         flipy = m_spriteattrib_ram[offs] & 0x01;
179178
180179         // Adjust sprites that should be far far right!
181180         if (sx<0) sx+=256;
r20824r20825
187186            tile -= 128;
188187            sy-=16;
189188         }
190         if (state->m_flipscreen)
189         if (m_flipscreen)
191190         {
192191            flipx = !flipx;
193192            flipy = !flipy;
194193         }
195         drawgfx_transmask(bitmap,cliprect,machine.gfx[1+spritebank],
194         drawgfx_transmask(bitmap,cliprect,machine().gfx[1+spritebank],
196195               tile,
197196               color,
198197               flipx,flipy,
199198               sx,sy,
200               colortable_get_transpen_mask(machine.colortable, machine.gfx[1+spritebank], color, 0x8f));
199               colortable_get_transpen_mask(machine().colortable, machine().gfx[1+spritebank], color, 0x8f));
201200      }
202201   }
203202}
r20824r20825
205204UINT32 gsword_state::screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
206205{
207206   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
208   draw_sprites(machine(), bitmap, cliprect);
207   draw_sprites(bitmap, cliprect);
209208   return 0;
210209}
trunk/src/mame/video/digdug.c
r20824r20825
237237
238238***************************************************************************/
239239
240static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
240void digdug_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
241241{
242   digdug_state *state =  machine.driver_data<digdug_state>();
243   UINT8 *spriteram = state->m_digdug_objram + 0x380;
244   UINT8 *spriteram_2 = state->m_digdug_posram + 0x380;
245   UINT8 *spriteram_3 = state->m_digdug_flpram + 0x380;
242   UINT8 *spriteram = m_digdug_objram + 0x380;
243   UINT8 *spriteram_2 = m_digdug_posram + 0x380;
244   UINT8 *spriteram_3 = m_digdug_flpram + 0x380;
246245   int offs;
247246
248247   // mask upper and lower columns
249248   rectangle visarea = cliprect;
250249   visarea.min_x = 2*8;
251250   visarea.max_x = 34*8-1;
252   if (state->flip_screen())
251   if (flip_screen())
253252   {
254253      visarea.min_x += 12*8;
255254      visarea.max_x += 12*8;
r20824r20825
277276      sy -= 16 * size;
278277      sy = (sy & 0xff) - 32;  // fix wraparound
279278
280      if (state->flip_screen())
279      if (flip_screen())
281280      {
282281         flipx ^= 1;
283282         flipy ^= 1;
r20824r20825
289288      {
290289         for (x = 0;x <= size;x++)
291290         {
292            UINT32 transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x1f);
293            drawgfx_transmask(bitmap,visarea,machine.gfx[1],
291            UINT32 transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x1f);
292            drawgfx_transmask(bitmap,visarea,machine().gfx[1],
294293               sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)],
295294               color,
296295               flipx,flipy,
297296               ((sx + 16*x) & 0xff), sy + 16*y,transmask);
298297            /* wraparound */
299            drawgfx_transmask(bitmap,visarea,machine.gfx[1],
298            drawgfx_transmask(bitmap,visarea,machine().gfx[1],
300299               sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)],
301300               color,
302301               flipx,flipy,
r20824r20825
311310{
312311   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
313312   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
314   draw_sprites(machine(),bitmap,cliprect);
313   draw_sprites(bitmap,cliprect);
315314   return 0;
316315}
trunk/src/mame/video/gaelco2.c
r20824r20825
332332
333333***************************************************************************/
334334
335static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs)
335void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs)
336336{
337   gaelco2_state *state = screen.machine().driver_data<gaelco2_state>();
338   UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
337   UINT16 *buffered_spriteram16 = m_spriteram->buffer();
339338   int j, x, y, ex, ey, px, py;
340339   gfx_element *gfx = screen.machine().gfx[0];
341340
342341   /* get sprite ram start and end offsets */
343   int start_offset = (state->m_vregs[1] & 0x10)*0x100;
342   int start_offset = (m_vregs[1] & 0x10)*0x100;
344343   int end_offset = start_offset + 0x1000;
345344
346345   /* sprite offset is based on the visible area */
347   int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((state->m_vregs[0] >> 4) & 0x01) + xoffs;
346   int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((m_vregs[0] >> 4) & 0x01) + xoffs;
348347
349348   for (j = start_offset; j < end_offset; j += 8){
350349      int data = buffered_spriteram16[(j/2) + 0];
r20824r20825
361360      int xsize = ((data3 >> 12) & 0x0f) + 1;
362361      int ysize = ((data2 >> 12) & 0x0f) + 1;
363362
364      if (state->m_dual_monitor && ((data & 0x8000) != mask)) continue;
363      if (m_dual_monitor && ((data & 0x8000) != mask)) continue;
365364
366365      /* if it's enabled, draw it */
367366      if ((data2 & 0x0200) != 0){
r20824r20825
371370               int data5 = buffered_spriteram16[((data4/2) + (y*xsize + x)) & 0x7fff];
372371               int number = ((data & 0x1ff) << 10) + (data5 & 0x0fff);
373372               int color = ((data >> 9) & 0x7f) + ((data5 >> 12) & 0x0f);
374               int color_effect = state->m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f);
373               int color_effect = m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f);
375374
376375               ex = xflip ? (xsize - 1 - x) : x;
377376               ey = yflip ? (ysize - 1 - y) : y;
r20824r20825
458457   return 0;
459458}
460459
461static UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index)
460UINT32 gaelco2_state::dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index)
462461{
463   gaelco2_state *state = screen.machine().driver_data<gaelco2_state>();
464462   int i;
465463
466464   /* read scroll values */
467   int scroll0x = state->m_videoram[0x2802/2] + 0x14;
468   int scroll1x = state->m_videoram[0x2806/2] + 0x10;
469   int scroll0y = state->m_videoram[0x2800/2] + 0x01;
470   int scroll1y = state->m_videoram[0x2804/2] + 0x01;
465   int scroll0x = m_videoram[0x2802/2] + 0x14;
466   int scroll1x = m_videoram[0x2806/2] + 0x10;
467   int scroll0y = m_videoram[0x2800/2] + 0x01;
468   int scroll1y = m_videoram[0x2804/2] + 0x01;
471469
472470   /* set y scroll registers */
473   state->m_pant[0]->set_scrolly(0, scroll0y & 0x1ff);
474   state->m_pant[1]->set_scrolly(0, scroll1y & 0x1ff);
471   m_pant[0]->set_scrolly(0, scroll0y & 0x1ff);
472   m_pant[1]->set_scrolly(0, scroll1y & 0x1ff);
475473
476474   /* set x linescroll registers */
477475   for (i = 0; i < 512; i++){
478      state->m_pant[0]->set_scrollx(i & 0x1ff, (state->m_vregs[0] & 0x8000) ? (state->m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff);
479      state->m_pant[1]->set_scrollx(i & 0x1ff, (state->m_vregs[1] & 0x8000) ? (state->m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff);
476      m_pant[0]->set_scrollx(i & 0x1ff, (m_vregs[0] & 0x8000) ? (m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff);
477      m_pant[1]->set_scrollx(i & 0x1ff, (m_vregs[1] & 0x8000) ? (m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff);
480478   }
481479
482480   /* draw screen */
483481   bitmap.fill(0, cliprect);
484482
485   state->m_pant[index]->draw(bitmap, cliprect, 0, 0);
483   m_pant[index]->draw(bitmap, cliprect, 0, 0);
486484   draw_sprites(screen,bitmap,cliprect, 0x8000 * index, 0);
487485
488486   return 0;
trunk/src/mame/video/gotya.c
r20824r20825
110110   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gotya_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(gotya_state::tilemap_scan_rows_thehand),this), 8, 8, 64, 32);
111111}
112112
113static void draw_status_row( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col )
113void gotya_state::draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col )
114114{
115   gotya_state *state = machine.driver_data<gotya_state>();
116115   int row;
117116
118   if (state->flip_screen())
117   if (flip_screen())
119118   {
120119      sx = 35 - sx;
121120   }
r20824r20825
124123   {
125124      int sy;
126125
127      if (state->flip_screen())
126      if (flip_screen())
128127         sy = row;
129128      else
130129         sy = 31 - row;
131130
132131      drawgfx_opaque(bitmap,cliprect,
133         machine.gfx[0],
134         state->m_videoram2[row * 32 + col],
135         state->m_videoram2[row * 32 + col + 0x10] & 0x0f,
136         state->flip_screen_x(), state->flip_screen_y(),
132         machine().gfx[0],
133         m_videoram2[row * 32 + col],
134         m_videoram2[row * 32 + col + 0x10] & 0x0f,
135         flip_screen_x(), flip_screen_y(),
137136         8 * sx, 8 * sy);
138137   }
139138}
140139
141static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
140void gotya_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
142141{
143   gotya_state *state = machine.driver_data<gotya_state>();
144   UINT8 *spriteram = state->m_spriteram;
142   UINT8 *spriteram = m_spriteram;
145143   int offs;
146144
147145   for (offs = 2; offs < 0x0e; offs += 2)
r20824r20825
151149      int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256;
152150      int sy = spriteram[offs + 0x00];
153151
154      if (state->flip_screen())
152      if (flip_screen())
155153         sy = 240 - sy;
156154
157155      drawgfx_transpen(bitmap,cliprect,
158         machine.gfx[1],
156         machine().gfx[1],
159157         code, color,
160         state->flip_screen_x(), state->flip_screen_y(),
158         flip_screen_x(), flip_screen_y(),
161159         sx, sy, 0);
162160   }
163161}
164162
165static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
163void gotya_state::draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect )
166164{
167   draw_status_row(machine, bitmap, cliprect, 0,  1);
168   draw_status_row(machine, bitmap, cliprect, 1,  0);
169   draw_status_row(machine, bitmap, cliprect, 2,  2);  /* these two are blank, but I dont' know if the data comes */
170   draw_status_row(machine, bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */
171   draw_status_row(machine, bitmap, cliprect, 35, 14);
172   draw_status_row(machine, bitmap, cliprect, 34, 15);
165   draw_status_row(bitmap, cliprect, 0,  1);
166   draw_status_row(bitmap, cliprect, 1,  0);
167   draw_status_row(bitmap, cliprect, 2,  2);  /* these two are blank, but I dont' know if the data comes */
168   draw_status_row(bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */
169   draw_status_row(bitmap, cliprect, 35, 14);
170   draw_status_row(bitmap, cliprect, 34, 15);
173171}
174172
175173UINT32 gotya_state::screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
176174{
177175   m_bg_tilemap->set_scrollx(0, -(*m_scroll + (m_scroll_bit_8 * 256)) - 2 * 8);
178176   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
179   draw_sprites(machine(), bitmap, cliprect);
180   draw_status(machine(), bitmap, cliprect);
177   draw_sprites(bitmap, cliprect);
178   draw_status(bitmap, cliprect);
181179   return 0;
182180}
trunk/src/mame/video/fastfred.c
r20824r20825
352352   m_fg_tilemap->set_transparent_pen(0);
353353
354354   /* the game has a galaxian starfield */
355   galaxold_init_stars(machine(), 256);
355   galaxold_init_stars(256);
356356   m_stars_on = 1;
357357
358358   /* web colors */
r20824r20825
363363UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
364364{
365365   m_web_tilemap->draw(bitmap, cliprect, 0,0);
366   galaxold_draw_stars(machine(), bitmap, cliprect);
366   galaxold_draw_stars(bitmap, cliprect);
367367   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
368368   draw_sprites(bitmap, cliprect);
369369   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
trunk/src/mame/video/xevious.c
r20824r20825
410410
411411***************************************************************************/
412412
413static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
413void xevious_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
414414{
415   xevious_state *state =  machine.driver_data<xevious_state>();
416
417   UINT8 *spriteram = state->m_xevious_sr3 + 0x780;
418   UINT8 *spriteram_2 = state->m_xevious_sr1 + 0x780;
419   UINT8 *spriteram_3 = state->m_xevious_sr2 + 0x780;
415   UINT8 *spriteram = m_xevious_sr3 + 0x780;
416   UINT8 *spriteram_2 = m_xevious_sr1 + 0x780;
417   UINT8 *spriteram_3 = m_xevious_sr2 + 0x780;
420418   int offs,sx,sy;
421419
422420   for (offs = 0;offs < 0x80;offs += 2)
r20824r20825
444442         sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1);
445443         sy = 28*8-spriteram_2[offs]-1;
446444
447         if (state->flip_screen())
445         if (flip_screen())
448446         {
449447            flipx = !flipx;
450448            flipy = !flipy;
r20824r20825
452450            sx += 96;
453451         }
454452
455         transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[bank], color, 0x80);
453         transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[bank], color, 0x80);
456454
457455         if (spriteram_3[offs] & 2)  /* double height (?) */
458456         {
459457            if (spriteram_3[offs] & 1)  /* double width, double height */
460458            {
461459               code &= ~3;
462               drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
460               drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
463461                     code+3,color,flipx,flipy,
464462                     flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask);
465               drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
463               drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
466464                     code+1,color,flipx,flipy,
467465                     flipx ? sx : sx+16,flipy ? sy : sy-16,transmask);
468466            }
469467            code &= ~2;
470            drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
468            drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
471469                  code+2,color,flipx,flipy,
472470                  flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask);
473            drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
471            drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
474472                  code,color,flipx,flipy,
475473                  flipx ? sx+16 : sx,flipy ? sy : sy-16,transmask);
476474         }
477475         else if (spriteram_3[offs] & 1) /* double width */
478476         {
479477            code &= ~1;
480            drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
478            drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
481479                  code,color,flipx,flipy,
482480                  flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask);
483            drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
481            drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
484482                  code+1,color,flipx,flipy,
485483                  flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask);
486484         }
487485         else    /* normal */
488486         {
489            drawgfx_transmask(bitmap,cliprect,machine.gfx[bank],
487            drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
490488                  code,color,flipx,flipy,sx,sy,transmask);
491489         }
492490      }
r20824r20825
497495UINT32 xevious_state::screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
498496{
499497   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
500   draw_sprites(machine(), bitmap,cliprect);
498   draw_sprites(bitmap,cliprect);
501499   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
502500   return 0;
503501}
trunk/src/mame/video/gotcha.c
r20824r20825
1313   return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5);
1414}
1515
16INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs)
16inline void gotcha_state::get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs)
1717{
18   gotcha_state *state = machine.driver_data<gotcha_state>();
1918   UINT16 data = vram[tile_index];
20   int code = (data & 0x3ff) | (state->m_gfxbank[(data & 0x0c00) >> 10] << 10);
19   int code = (data & 0x3ff) | (m_gfxbank[(data & 0x0c00) >> 10] << 10);
2120
22   SET_TILE_INFO(0, code, (data >> 12) + color_offs, 0);
21   SET_TILE_INFO_MEMBER(0, code, (data >> 12) + color_offs, 0);
2322}
2423
2524TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info)
2625{
27   get_tile_info(machine(), tileinfo, tile_index, m_fgvideoram, 0);
26   get_tile_info(tileinfo, tile_index, m_fgvideoram, 0);
2827}
2928
3029TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info)
3130{
32   get_tile_info(machine(), tileinfo, tile_index, m_bgvideoram, 16);
31   get_tile_info(tileinfo, tile_index, m_bgvideoram, 16);
3332}
3433
3534
trunk/src/mame/video/gberet.c
r20824r20825
125125   m_bg_tilemap->set_scroll_rows(32);
126126}
127127
128static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
128void gberet_state::gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
129129{
130   gberet_state *state = machine.driver_data<gberet_state>();
131130   int offs;
132131   UINT8 *sr;
133132
134   if (state->m_spritebank & 0x08)
135      sr = state->m_spriteram2;
133   if (m_spritebank & 0x08)
134      sr = m_spriteram2;
136135   else
137      sr = state->m_spriteram;
136      sr = m_spriteram;
138137
139138   for (offs = 0; offs < 0xc0; offs += 4)
140139   {
r20824r20825
148147         int flipx = attr & 0x10;
149148         int flipy = attr & 0x20;
150149
151         if (state->flip_screen())
150         if (flip_screen())
152151         {
153152            sx = 240 - sx;
154153            sy = 240 - sy;
r20824r20825
156155            flipy = !flipy;
157156         }
158157
159         drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy,
160            colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
158         drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
159            colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
161160      }
162161   }
163162}
r20824r20825
165164UINT32 gberet_state::screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
166165{
167166   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
168   gberet_draw_sprites(machine(), bitmap, cliprect);
167   gberet_draw_sprites(bitmap, cliprect);
169168   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
170169   return 0;
171170}
r20824r20825
183182      m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8);
184183}
185184
186static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
185void gberet_state::gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
187186{
188   gberet_state *state = machine.driver_data<gberet_state>();
189   UINT8 *spriteram = state->m_spriteram;
187   UINT8 *spriteram = m_spriteram;
190188   int offs;
191189
192   for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
190   for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
193191   {
194192      if (spriteram[offs + 1])
195193      {
r20824r20825
201199         int flipx = attr & 0x10;
202200         int flipy = attr & 0x20;
203201
204         if (state->flip_screen())
202         if (flip_screen())
205203         {
206204            sx = 240 - sx;
207205            sy = 240 - sy;
r20824r20825
209207            flipy = !flipy;
210208         }
211209
212         drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy,
213            colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0));
210         drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
211            colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
214212      }
215213   }
216214}
r20824r20825
218216UINT32 gberet_state::screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
219217{
220218   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
221   gberetb_draw_sprites(machine(), bitmap, cliprect);
219   gberetb_draw_sprites(bitmap, cliprect);
222220   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
223221   return 0;
224222}
trunk/src/mame/video/galpanic.c
r20824r20825
4545}
4646
4747
48static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
48void galpanic_state::comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
4949{
50   galpanic_state *state = machine.driver_data<galpanic_state>();
51   UINT16 *spriteram16 = state->m_spriteram;
50   UINT16 *spriteram16 = m_spriteram;
5251   int offs;
5352   int sx=0, sy=0;
5453
55   for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 4)
54   for (offs = 0;offs < m_spriteram.bytes()/2;offs += 4)
5655   {
5756      int code,color,flipx,flipy;
5857
r20824r20825
7574      sx = (sx&0x1ff) - (sx&0x200);
7675      sy = (sy&0x1ff) - (sy&0x200);
7776
78      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
77      drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
7978            code,
8079            color,
8180            flipx,flipy,
r20824r20825
8382   }
8483}
8584
86static void draw_fgbitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
85void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
8786{
88   galpanic_state *state = machine.driver_data<galpanic_state>();
8987   int offs;
9088
91   for (offs = 0;offs < state->m_fgvideoram.bytes()/2;offs++)
89   for (offs = 0;offs < m_fgvideoram.bytes()/2;offs++)
9290   {
9391      int sx,sy,color;
9492
9593      sx = offs % 256;
9694      sy = offs / 256;
97      color = state->m_fgvideoram[offs];
95      color = m_fgvideoram[offs];
9896      if (color)
9997         bitmap.pix16(sy, sx) = color;
10098   }
r20824r20825
107105   /* copy the temporary bitmap to the screen */
108106   copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);
109107
110   draw_fgbitmap(machine(), bitmap, cliprect);
108   draw_fgbitmap(bitmap, cliprect);
111109
112110   pandora_update(pandora, bitmap, cliprect);
113111
r20824r20825
119117   /* copy the temporary bitmap to the screen */
120118   copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);
121119
122   draw_fgbitmap(machine(), bitmap, cliprect);
120   draw_fgbitmap(bitmap, cliprect);
123121
124122
125123//  if(galpanic_clear_sprites)
126124   {
127125      m_sprites_bitmap.fill(0, cliprect);
128      comad_draw_sprites(machine(),bitmap,cliprect);
126      comad_draw_sprites(bitmap,cliprect);
129127   }
130128//  else
131129//  {
trunk/src/mame/video/gyruss.c
r20824r20825
127127}
128128
129129
130static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx )
130void gyruss_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx )
131131{
132   gyruss_state *state = machine.driver_data<gyruss_state>();
133132   int offs;
134133
135134   for (offs = 0xbc; offs >= 0; offs -= 4)
136135   {
137      int x = state->m_spriteram[offs];
138      int y = 241 - state->m_spriteram[offs + 3];
136      int x = m_spriteram[offs];
137      int y = 241 - m_spriteram[offs + 3];
139138
140      int gfx_bank = state->m_spriteram[offs + 1] & 0x01;
141      int code = ((state->m_spriteram[offs + 2] & 0x20) << 2) | ( state->m_spriteram[offs + 1] >> 1);
142      int color = state->m_spriteram[offs + 2] & 0x0f;
143      int flip_x = ~state->m_spriteram[offs + 2] & 0x40;
144      int flip_y =  state->m_spriteram[offs + 2] & 0x80;
139      int gfx_bank = m_spriteram[offs + 1] & 0x01;
140      int code = ((m_spriteram[offs + 2] & 0x20) << 2) | ( m_spriteram[offs + 1] >> 1);
141      int color = m_spriteram[offs + 2] & 0x0f;
142      int flip_x = ~m_spriteram[offs + 2] & 0x40;
143      int flip_y =  m_spriteram[offs + 2] & 0x80;
145144
146145      drawgfx_transpen(bitmap, cliprect, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, 0);
147146   }
r20824r20825
157156   }
158157
159158   m_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
160   draw_sprites(machine(), bitmap, cliprect, machine().gfx);
159   draw_sprites(bitmap, cliprect, machine().gfx);
161160   m_tilemap->draw(bitmap, cliprect, 0, 0);
162161
163162   return 0;
trunk/src/mame/video/gaelco3d.c
r20824r20825
346346 *
347347 *************************************/
348348
349void gaelco3d_render(screen_device &screen)
349void gaelco3d_state::gaelco3d_render(screen_device &screen)
350350{
351351   gaelco3d_state *state = screen.machine().driver_data<gaelco3d_state>();
352352   /* wait for any queued stuff to complete */
353   state->m_poly->wait("Time to render");
353   m_poly->wait("Time to render");
354354
355355#if DISPLAY_STATS
356356{
357357   int scan = screen.vpos();
358   popmessage("Polys = %4d  Timeleft = %3d", state->m_poly->polygons(), (state->m_lastscan < scan) ? (scan - state->m_lastscan) : (scan + (state->m_lastscan - screen.visible_area().max_y)));
358   popmessage("Polys = %4d  Timeleft = %3d", m_poly->polygons(), (m_lastscan < scan) ? (scan - m_lastscan) : (scan + (m_lastscan - screen.visible_area().max_y)));
359359}
360360#endif
361361
trunk/src/mame/video/galaxian.c
r20824r20825
227227#define RGB_MAXIMUM         224
228228
229229
230
231230/*************************************
232231 *
233 *  Function prototypes
234 *
235 *************************************/
236
237static void state_save_register(running_machine &machine);
238
239
240static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase);
241
242static void stars_init(running_machine &machine);
243static void stars_update_origin(running_machine &machine);
244static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask);
245
246static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base);
247
248
249
250/*************************************
251 *
252232 *  Palette setup
253233 *
254234 *************************************/
r20824r20825
417397   m_background_green = 0;
418398
419399   /* initialize stars */
420   stars_init(machine());
400   stars_init();
421401
422402   /* register for save states */
423   state_save_register(machine());
403   state_save_register();
424404}
425405
426406
427static void state_save_register(running_machine &machine)
407void galaxian_state::state_save_register()
428408{
429   galaxian_state *state = machine.driver_data<galaxian_state>();
430   state_save_register_global(machine, state->m_flipscreen_x);
431   state_save_register_global(machine, state->m_flipscreen_y);
432   state_save_register_global(machine, state->m_background_enable);
433   state_save_register_global(machine, state->m_background_red);
434   state_save_register_global(machine, state->m_background_green);
435   state_save_register_global(machine, state->m_background_blue);
409   state_save_register_global(machine(), m_flipscreen_x);
410   state_save_register_global(machine(), m_flipscreen_y);
411   state_save_register_global(machine(), m_background_enable);
412   state_save_register_global(machine(), m_background_red);
413   state_save_register_global(machine(), m_background_green);
414   state_save_register_global(machine(), m_background_blue);
436415
437   state_save_register_global_array(machine, state->m_gfxbank);
416   state_save_register_global_array(machine(), m_gfxbank);
438417
439   state_save_register_global(machine, state->m_stars_enabled);
440   state_save_register_global(machine, state->m_star_rng_origin);
441   state_save_register_global(machine, state->m_star_rng_origin_frame);
442   state_save_register_global(machine, state->m_stars_blink_state);
418   state_save_register_global(machine(), m_stars_enabled);
419   state_save_register_global(machine(), m_star_rng_origin);
420   state_save_register_global(machine(), m_star_rng_origin_frame);
421   state_save_register_global(machine(), m_stars_blink_state);
443422}
444423
445424
r20824r20825
453432UINT32 galaxian_state::screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
454433{
455434   /* draw the background layer (including stars) */
456   (*m_draw_background_ptr)(machine(), bitmap, cliprect);
435   (this->*m_draw_background_ptr)(bitmap, cliprect);
457436
458437   /* draw the tilemap characters over top */
459438   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
460439
461440   /* render the sprites next. Some custom pcbs (eg. zigzag, fantastc) have more than one sprite generator (ideally, this should be rendered in parallel) */
462441   for (int i = 0; i < m_numspritegens; i++)
463      sprites_draw(machine(), bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]);
442      sprites_draw(bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]);
464443
465444   /* if we have bullets to draw, render them following */
466445   if (m_draw_bullet_ptr != NULL)
467      bullets_draw(machine(), bitmap, cliprect, &m_spriteram[m_bullets_base]);
446      bullets_draw(bitmap, cliprect, &m_spriteram[m_bullets_base]);
468447
469448   return 0;
470449}
r20824r20825
487466   UINT8 color = attrib & 7;
488467
489468   if (m_extend_tile_info_ptr != NULL)
490      (*m_extend_tile_info_ptr)(machine(), &code, &color, attrib, x);
469      (this->*m_extend_tile_info_ptr)(&code, &color, attrib, x);
491470
492471   SET_TILE_INFO_MEMBER(0, code, color, 0);
493472}
r20824r20825
545524 *
546525 *************************************/
547526
548static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase)
527void galaxian_state::sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase)
549528{
550   galaxian_state *state = machine.driver_data<galaxian_state>();
551529   rectangle clip = cliprect;
552530   int sprnum;
553531
r20824r20825
556534
557535   /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */
558536   /* according to the schematics, it should be the first 16 pixels */
559   clip.min_x = MAX(clip.min_x, (!state->m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE);
560   clip.max_x = MIN(clip.max_x, (256 - state->m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1);
537   clip.min_x = MAX(clip.min_x, (!m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE);
538   clip.max_x = MIN(clip.max_x, (256 - m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1);
561539
562540   /* The line buffer is only written if it contains a '0' currently; */
563541   /* it is cleared during the visible area, and populated during HBLANK */
r20824r20825
567545   {
568546      const UINT8 *base = &spritebase[sprnum * 4];
569547      /* Frogger: top and bottom 4 bits swapped entering the adder */
570      UINT8 base0 = state->m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0];
548      UINT8 base0 = m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0];
571549      /* the first three sprites match against y-1 */
572550      UINT8 sy = 240 - (base0 - (sprnum < 3));
573551      UINT16 code = base[1] & 0x3f;
r20824r20825
577555      UINT8 sx = base[3] + hoffset;
578556
579557      /* extend the sprite information */
580      if (state->m_extend_sprite_info_ptr != NULL)
581         (*state->m_extend_sprite_info_ptr)(machine, base, &sx, &sy, &flipx, &flipy, &code, &color);
558      if (m_extend_sprite_info_ptr != NULL)
559         (this->*m_extend_sprite_info_ptr)(base, &sx, &sy, &flipx, &flipy, &code, &color);
582560
583561      /* apply flipscreen in X direction */
584      if (state->m_flipscreen_x)
562      if (m_flipscreen_x)
585563      {
586564         sx = 240 - sx;
587565         flipx = !flipx;
588566      }
589567
590568      /* apply flipscreen in Y direction */
591      if (state->m_flipscreen_y)
569      if (m_flipscreen_y)
592570      {
593571         sy = 240 - sy;
594572         flipy = !flipy;
r20824r20825
596574
597575      /* draw */
598576      drawgfx_transpen(bitmap, clip,
599            machine.gfx[1],
577            machine().gfx[1],
600578            code, color,
601579            flipx, flipy,
602580            GALAXIAN_H0START + GALAXIAN_XSCALE * sx, sy, 0);
r20824r20825
611589 *
612590 *************************************/
613591
614static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base)
592void galaxian_state::bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base)
615593{
616   galaxian_state *state = machine.driver_data<galaxian_state>();
617594   int y;
618595
619596   /* iterate over scanlines */
r20824r20825
624601      int which;
625602
626603      /* the first 3 entries match Y-1 */
627      effy = state->m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1);
604      effy = m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1);
628605      for (which = 0; which < 3; which++)
629606         if ((UINT8)(base[which*4+1] + effy) == 0xff)
630607            shell = which;
631608
632609      /* remaining entries match Y */
633      effy = state->m_flipscreen_y ? (y ^ 255) : y;
610      effy = m_flipscreen_y ? (y ^ 255) : y;
634611      for (which = 3; which < 8; which++)
635612         if ((UINT8)(base[which*4+1] + effy) == 0xff)
636613         {
r20824r20825
642619
643620      /* draw the shell */
644621      if (shell != 0xff)
645         (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y);
622         (this->*m_draw_bullet_ptr)(bitmap, cliprect, shell, 255 - base[shell*4+3], y);
646623      if (missile != 0xff)
647         (*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y);
624         (this->*m_draw_bullet_ptr)(bitmap, cliprect, missile, 255 - base[missile*4+3], y);
648625   }
649626}
650627
r20824r20825
665642      /* when the direction changes, we count a different number of clocks */
666643      /* per frame, so we need to reset the origin of the stars to the current */
667644      /* frame before we flip */
668      stars_update_origin(machine());
645      stars_update_origin();
669646
670647      m_flipscreen_x = data & 0x01;
671648      m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0));
r20824r20825
774751 *
775752 *************************************/
776753
777static void stars_init(running_machine &machine)
754void galaxian_state::stars_init()
778755{
779   galaxian_state *state = machine.driver_data<galaxian_state>();
780756   UINT32 shiftreg;
781757   int i;
782758
783759   /* reset the blink and enabled states */
784   state->m_stars_enabled = FALSE;
785   state->m_stars_blink_state = 0;
760   m_stars_enabled = FALSE;
761   m_stars_blink_state = 0;
786762
787763   /* precalculate the RNG */
788   state->m_stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD);
764   m_stars = auto_alloc_array(machine(), UINT8, STAR_RNG_PERIOD);
789765   shiftreg = 0;
790766   for (i = 0; i < STAR_RNG_PERIOD; i++)
791767   {
r20824r20825
796772      int color = (~shiftreg & 0x1f8) >> 3;
797773
798774      /* store the color value in the low 6 bits and the enable in the upper bit */
799      state->m_stars[i] = color | (enabled << 7);
775      m_stars[i] = color | (enabled << 7);
800776
801777      /* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */
802778      shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16);
r20824r20825
811787 *
812788 *************************************/
813789
814static void stars_update_origin(running_machine &machine)
790void galaxian_state::stars_update_origin()
815791{
816   galaxian_state *state = machine.driver_data<galaxian_state>();
817   int curframe = machine.primary_screen->frame_number();
792   int curframe = machine().primary_screen->frame_number();
818793
819794   /* only update on a different frame */
820   if (curframe != state->m_star_rng_origin_frame)
795   if (curframe != m_star_rng_origin_frame)
821796   {
822797      /* The RNG period is 2^17-1; each frame, the shift register is clocked */
823798      /* 512*256 = 2^17 times. This means that we clock one extra time each */
r20824r20825
825800      /* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */
826801      /* In this case, we only one time less than the period each frame. Both */
827802      /* of these off-by-one countings produce the horizontal star scrolling. */
828      int per_frame_delta = state->m_flipscreen_x ? 1 : -1;
829      int total_delta = per_frame_delta * (curframe - state->m_star_rng_origin_frame);
803      int per_frame_delta = m_flipscreen_x ? 1 : -1;
804      int total_delta = per_frame_delta * (curframe - m_star_rng_origin_frame);
830805
831806      /* we can't just use % here because mod of a negative number is undefined */
832807      while (total_delta < 0)
833808         total_delta += STAR_RNG_PERIOD;
834809
835810      /* now that everything is positive, do the mod */
836      state->m_star_rng_origin = (state->m_star_rng_origin + total_delta) % STAR_RNG_PERIOD;
837      state->m_star_rng_origin_frame = curframe;
811      m_star_rng_origin = (m_star_rng_origin + total_delta) % STAR_RNG_PERIOD;
812      m_star_rng_origin_frame = curframe;
838813   }
839814}
840815
r20824r20825
859834 *
860835 *************************************/
861836
862static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask)
837void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask)
863838{
864839   int x;
865840
r20824r20825
891866      */
892867
893868      /* first RNG clock: one pixel */
894      star = state->m_stars[star_offs++];
869      star = m_stars[star_offs++];
895870      if (star_offs >= STAR_RNG_PERIOD)
896871         star_offs = 0;
897872      if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0)
898         bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = state->m_star_color[star & 0x3f];
873         bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f];
899874
900875      /* second RNG clock: two pixels */
901      star = state->m_stars[star_offs++];
876      star = m_stars[star_offs++];
902877      if (star_offs >= STAR_RNG_PERIOD)
903878         star_offs = 0;
904879      if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0)
905880      {
906         bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = state->m_star_color[star & 0x3f];
907         bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = state->m_star_color[star & 0x3f];
881         bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f];
882         bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f];
908883      }
909884   }
910885}
r20824r20825
917892 *
918893 *************************************/
919894
920void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
895void galaxian_state::galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
921896{
922   galaxian_state *state = machine.driver_data<galaxian_state>();
923897   /* erase the background to black first */
924898   bitmap.fill(RGB_BLACK, cliprect);
925899
926900   /* update the star origin to the current frame */
927   stars_update_origin(machine);
901   stars_update_origin();
928902
929903   /* render stars if enabled */
930   if (state->m_stars_enabled)
904   if (m_stars_enabled)
931905   {
932906      int y;
933907
934908      /* iterate over scanlines */
935909      for (y = cliprect.min_y; y <= cliprect.max_y; y++)
936910      {
937         UINT32 star_offs = state->m_star_rng_origin + y * 512;
938         stars_draw_row(state, bitmap, 256, y, star_offs, 0xff);
911         UINT32 star_offs = m_star_rng_origin + y * 512;
912         stars_draw_row(bitmap, 256, y, star_offs, 0xff);
939913      }
940914   }
941915}
942916
943917
944static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped)
918void galaxian_state::background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped)
945919{
946   galaxian_state *state = machine.driver_data<galaxian_state>();
947920   /* horizontal bgcolor split */
948   if (state->m_flipscreen_x)
921   if (m_flipscreen_x)
949922   {
950923      rectangle draw = cliprect;
951924      draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1);
r20824r20825
972945}
973946
974947
975static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx)
948void galaxian_state::scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx)
976949{
977   galaxian_state *state = machine.driver_data<galaxian_state>();
978950   /* update the star origin to the current frame */
979   stars_update_origin(machine);
951   stars_update_origin();
980952
981953   /* render stars if enabled */
982   if (state->m_stars_enabled)
954   if (m_stars_enabled)
983955   {
984      int blink_state = state->m_stars_blink_state & 3;
956      int blink_state = m_stars_blink_state & 3;
985957      int y;
986958
987959      /* iterate over scanlines */
r20824r20825
992964         {
993965            /* blink states 0 and 1 suppress stars when certain bits of the color == 0 */
994966            static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff };
995            stars_draw_row(state, bitmap, maxx, y, y * 512, colormask_table[blink_state]);
967            stars_draw_row(bitmap, maxx, y, y * 512, colormask_table[blink_state]);
996968         }
997969      }
998970   }
999971}
1000972
1001973
1002void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
974void galaxian_state::scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
1003975{
1004   galaxian_state *state = machine.driver_data<galaxian_state>();
1005976   /* blue background - 390 ohm resistor */
1006   bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
977   bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
1007978
1008   scramble_draw_stars(machine, bitmap, cliprect, 256);
979   scramble_draw_stars(bitmap, cliprect, 256);
1009980}
1010981
1011982
1012void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
983void galaxian_state::anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
1013984{
1014   galaxian_state *state = machine.driver_data<galaxian_state>();
1015985   /* blue background, horizontal split as seen on flyer and real cabinet */
1016   background_draw_colorsplit(machine, bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56);
986   background_draw_colorsplit(bitmap, cliprect, m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56);
1017987
1018   scramble_draw_stars(machine, bitmap, cliprect, 256);
988   scramble_draw_stars(bitmap, cliprect, 256);
1019989}
1020990
1021991
1022void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
992void galaxian_state::jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
1023993{
1024   galaxian_state *state = machine.driver_data<galaxian_state>();
1025994   /* blue background - 390 ohm resistor */
1026   bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
995   bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
1027996
1028997   /* render stars same as scramble but nothing in the status area */
1029   scramble_draw_stars(machine, bitmap, cliprect, 240);
998   scramble_draw_stars(bitmap, cliprect, 240);
1030999}
10311000
10321001
1033void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1002void galaxian_state::turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
10341003{
1035   galaxian_state *state = machine.driver_data<galaxian_state>();
10361004   /*
10371005       The background color generator is connected this way:
10381006
r20824r20825
10401008           GREEN - 470 ohm resistor
10411009           BLUE  - 390 ohm resistor
10421010   */
1043   bitmap.fill(MAKE_RGB(state->m_background_red * 0x55, state->m_background_green * 0x47, state->m_background_blue * 0x55), cliprect);
1011   bitmap.fill(MAKE_RGB(m_background_red * 0x55, m_background_green * 0x47, m_background_blue * 0x55), cliprect);
10441012}
10451013
10461014
1047void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1015void galaxian_state::frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
10481016{
10491017   /* color split point verified on real machine */
10501018   /* hmmm, according to schematics it is at 128+8; which is right? */
1051   background_draw_colorsplit(machine, bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8);
1019   background_draw_colorsplit(bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8);
10521020}
10531021
10541022
10551023#ifdef UNUSED_FUNCTION
1056static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect)
1024int galaxian_state::flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect)
10571025{
1058   galaxian_state *state = machine.driver_data<galaxian_state>();
10591026   draw = cliprect;
1060   if (!state->m_flipscreen_x)
1027   if (!m_flipscreen_x)
10611028   {
10621029      draw.min_x = xstart * GALAXIAN_XSCALE;
10631030      draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
r20824r20825
10711038   return (draw.min_x <= draw.max_x);
10721039}
10731040
1074void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1041void galaxian_state::amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
10751042{
1076   galaxian_state *state = machine.driver_data<galaxian_state>();
1077   const UINT8 *prom = state->memregion("user1")->base();
1043   const UINT8 *prom = memregion("user1")->base();
10781044   rectangle draw;
10791045   int x;
10801046
r20824r20825
10951061                 GREEN - 560 ohm resistor
10961062                 BLUE  - 470 ohm resistor
10971063         */
1098         UINT8 red = ((~prom[x] & 0x02) && state->m_background_red) ? 0x7c : 0x00;
1099         UINT8 green = ((~prom[x] & 0x02) && state->m_background_green) ? 0x3c : 0x00;
1100         UINT8 blue = ((~prom[x] & 0x01) && state->m_background_blue) ? 0x47 : 0x00;
1064         UINT8 red = ((~prom[x] & 0x02) && m_background_red) ? 0x7c : 0x00;
1065         UINT8 green = ((~prom[x] & 0x02) && m_background_green) ? 0x3c : 0x00;
1066         UINT8 blue = ((~prom[x] & 0x01) && m_background_blue) ? 0x47 : 0x00;
11011067         bitmap.fill(MAKE_RGB(red, green, blue, draw));
11021068      }
11031069}
r20824r20825
11111077 *
11121078 *************************************/
11131079
1114INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color)
1080inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color)
11151081{
11161082   if (y >= cliprect.min_y && y <= cliprect.max_y)
11171083   {
r20824r20825
11311097}
11321098
11331099
1134void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1100void galaxian_state::galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11351101{
1136   galaxian_state *state = machine.driver_data<galaxian_state>();
11371102   /*
11381103       Both "shells" and "missiles" begin displaying when the horizontal counter
11391104       reaches $FC, and they stop displaying when it reaches $00, resulting in
r20824r20825
11411106       white; the final entry is called a "missile" and renders as yellow.
11421107   */
11431108   x -= 4;
1144   galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]);
1145   galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]);
1146   galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]);
1147   galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]);
1109   galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
1110   galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
1111   galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
1112   galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
11481113}
11491114
11501115
1151void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1116void galaxian_state::mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11521117{
11531118   /* verified by schematics:
11541119       * both "W" and "Y" bullets are 4 pixels long
r20824r20825
11771142}
11781143
11791144
1180void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1145void galaxian_state::scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11811146{
11821147   /*
11831148       Scramble only has "shells", which begin displaying when the counter
r20824r20825
11891154}
11901155
11911156
1192void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1157void galaxian_state::theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11931158{
1194   galaxian_state *state = machine.driver_data<galaxian_state>();
11951159   /* Same as galaxian except blue/green are swapped */
11961160   x -= 4;
1197   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs])));
1198   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs])));
1199   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs])));
1200   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs])));
1161   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
1162   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
1163   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
1164   galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
12011165}
12021166
12031167
r20824r20825
12091173 *************************************/
12101174
12111175/*** generic ***/
1212void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1176void galaxian_state::upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12131177{
12141178   /* tiles are in the upper half of a larger ROM */
12151179   *code += 0x100;
12161180}
12171181
1218void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1182void galaxian_state::upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12191183{
12201184   /* sprites are in the upper half of a larger ROM */
12211185   *code += 0x40;
r20824r20825
12231187
12241188
12251189/*** Frogger ***/
1226void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1190void galaxian_state::frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12271191{
12281192   *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04);
12291193}
12301194
1231void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1195void galaxian_state::frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12321196{
12331197   *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04);
12341198}
12351199
12361200
12371201/*** Ghostmuncher Galaxian ***/
1238void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1202void galaxian_state::gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12391203{
1240   galaxian_state *state = machine.driver_data<galaxian_state>();
1241   *code |= state->m_gfxbank[0] << 9;
1242//  *color |= state->m_gfxbank[0] << 3;
1204   *code |= m_gfxbank[0] << 9;
1205//  *color |= m_gfxbank[0] << 3;
12431206}
12441207
1245void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1208void galaxian_state::gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12461209{
1247   galaxian_state *state = machine.driver_data<galaxian_state>();
1248   *code |= (state->m_gfxbank[0] << 7) | 0x40;
1249   *color |= state->m_gfxbank[0] << 3;
1210   *code |= (m_gfxbank[0] << 7) | 0x40;
1211   *color |= m_gfxbank[0] << 3;
12501212}
12511213
12521214
12531215/*** Pisces ***/
1254void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1216void galaxian_state::pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12551217{
1256   galaxian_state *state = machine.driver_data<galaxian_state>();
1257   *code |= state->m_gfxbank[0] << 8;
1218   *code |= m_gfxbank[0] << 8;
12581219}
12591220
1260void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1221void galaxian_state::pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12611222{
1262   galaxian_state *state = machine.driver_data<galaxian_state>();
1263   *code |= state->m_gfxbank[0] << 6;
1223   *code |= m_gfxbank[0] << 6;
12641224}
12651225
12661226
12671227/*** Batman Part 2 ***/
1268void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1228void galaxian_state::batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12691229{
1270   galaxian_state *state = machine.driver_data<galaxian_state>();
12711230   if (*code & 0x80)
1272      *code |= state->m_gfxbank[0] << 8;
1231      *code |= m_gfxbank[0] << 8;
12731232}
12741233
12751234
12761235/*** Moon Cresta ***/
1277void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1236void galaxian_state::mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12781237{
1279   galaxian_state *state = machine.driver_data<galaxian_state>();
1280   if (state->m_gfxbank[2] && (*code & 0xc0) == 0x80)
1281      *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100;
1238   if (m_gfxbank[2] && (*code & 0xc0) == 0x80)
1239      *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100;
12821240}
12831241
1284void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1242void galaxian_state::mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12851243{
1286   galaxian_state *state = machine.driver_data<galaxian_state>();
1287   if (state->m_gfxbank[2] && (*code & 0x30) == 0x20)
1288      *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40;
1244   if (m_gfxbank[2] && (*code & 0x30) == 0x20)
1245      *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40;
12891246}
12901247
12911248
12921249/*** Moon Quasar ***/
1293void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1250void galaxian_state::moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
12941251{
12951252   *code |= (attrib & 0x20) << 3;
12961253}
12971254
1298void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1255void galaxian_state::moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
12991256{
13001257   *code |= (base[2] & 0x20) << 1;
13011258}
13021259
13031260
13041261/*** Moon Shuttle ***/
1305void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1262void galaxian_state::mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
13061263{
13071264   *code |= (attrib & 0x30) << 4;
13081265}
13091266
1310void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1267void galaxian_state::mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
13111268{
13121269   *code |= (base[2] & 0x30) << 2;
13131270}
13141271
13151272
13161273/*** Calipso ***/
1317void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1274void galaxian_state::calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
13181275{
13191276   /* same as the others, but no sprite flipping, but instead the bits are used
13201277      as extra sprite code bits, giving 256 sprite images */
r20824r20825
13261283
13271284
13281285/*** Jumpbug ***/
1329void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
1286void galaxian_state::jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
13301287{
1331   galaxian_state *state = machine.driver_data<galaxian_state>();
1332   if ((*code & 0xc0) == 0x80 && (state->m_gfxbank[2] & 0x01))
1333      *code += 128 + (( state->m_gfxbank[0] & 0x01) << 6) +
1334                  (( state->m_gfxbank[1] & 0x01) << 7) +
1335                  ((~state->m_gfxbank[4] & 0x01) << 8);
1288   if ((*code & 0xc0) == 0x80 && (m_gfxbank[2] & 0x01))
1289      *code += 128 + (( m_gfxbank[0] & 0x01) << 6) +
1290                  (( m_gfxbank[1] & 0x01) << 7) +
1291                  ((~m_gfxbank[4] & 0x01) << 8);
13361292}
13371293
1338void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
1294void galaxian_state::jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
13391295{
1340   galaxian_state *state = machine.driver_data<galaxian_state>();
1341   if ((*code & 0x30) == 0x20 && (state->m_gfxbank[2] & 0x01) != 0)
1296   if ((*code & 0x30) == 0x20 && (m_gfxbank[2] & 0x01) != 0)
13421297   {
1343      *code += 32 + (( state->m_gfxbank[0] & 0x01) << 4) +
1344                  (( state->m_gfxbank[1] & 0x01) << 5) +
1345                  ((~state->m_gfxbank[4] & 0x01) << 6);
1298      *code += 32 + (( m_gfxbank[0] & 0x01) << 4) +
1299                  (( m_gfxbank[1] & 0x01) << 5) +
1300                  ((~m_gfxbank[4] & 0x01) << 6);
13461301   }
13471302}
trunk/src/mame/video/gstriker.c
r20824r20825
5050   m_VS920A[1].tmap->mark_tile_dirty(offset);
5151}
5252
53static void VS920A_init(running_machine &machine, int numchips)
53void gstriker_state::VS920A_init(int numchips)
5454{
55   gstriker_state *state = machine.driver_data<gstriker_state>();
5655   int i;
5756
5857   if (numchips > MAX_VS920A)
r20824r20825
6059
6160   for (i=0;i<numchips;i++)
6261   {
63      state->m_VS920A[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),state),TILEMAP_SCAN_ROWS,8,8,64,32);
62      m_VS920A[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
6463
65      state->m_VS920A[i].tmap->set_transparent_pen(0);
64      m_VS920A[i].tmap->set_transparent_pen(0);
6665   }
6766}
6867
69static tilemap_t* VS920A_get_tilemap(gstriker_state *state, int numchip)
68tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip)
7069{
71   return state->m_VS920A[numchip].tmap;
70   return m_VS920A[numchip].tmap;
7271}
7372
74static void VS920A_set_pal_base(gstriker_state *state, int numchip, int pal_base)
73void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base)
7574{
76   state->m_VS920A[numchip].pal_base = pal_base;
75   m_VS920A[numchip].pal_base = pal_base;
7776}
7877
79static void VS920A_set_gfx_region(gstriker_state *state, int numchip, int gfx_region)
78void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region)
8079{
81   state->m_VS920A[numchip].gfx_region = gfx_region;
80   m_VS920A[numchip].gfx_region = gfx_region;
8281}
8382
84static void VS920A_draw(gstriker_state *state, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
83void gstriker_state::VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
8584{
86   state->m_VS920A_cur_chip = &state->m_VS920A[numchip];
85   m_VS920A_cur_chip = &m_VS920A[numchip];
8786
88   state->m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority);
87   m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority);
8988}
9089
9190
r20824r20825
207206   return (row*64) + (col&63) + ((col&64)<<6);
208207}
209208
210static void MB60553_init(running_machine &machine, int numchips)
209void gstriker_state::MB60553_init(int numchips)
211210{
212   gstriker_state *state = machine.driver_data<gstriker_state>();
213211   int i;
214212
215213   if (numchips > MAX_MB60553)
r20824r20825
217215
218216   for (i=0;i<numchips;i++)
219217   {
220      state->m_MB60553[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),state),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),state), 16,16,128,64);
218      m_MB60553[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64);
221219
222      state->m_MB60553[i].tmap->set_transparent_pen(0);
220      m_MB60553[i].tmap->set_transparent_pen(0);
223221   }
224222}
225223
226static void MB60553_set_pal_base(gstriker_state *state, int numchip, int pal_base)
224void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base)
227225{
228   state->m_MB60553[numchip].pal_base = pal_base;
226   m_MB60553[numchip].pal_base = pal_base;
229227}
230228
231static void MB60553_set_gfx_region(gstriker_state *state, int numchip, int gfx_region)
229void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region)
232230{
233   state->m_MB60553[numchip].gfx_region = gfx_region;
231   m_MB60553[numchip].gfx_region = gfx_region;
234232}
235233
236234/* THIS IS STILL WRONG! */
237static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
235void gstriker_state::MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
238236{
239   gstriker_state *state = machine.driver_data<gstriker_state>();
240237   int line;
241238   rectangle clip;
242   state->m_MB60553_cur_chip = &state->m_MB60553[numchip];
239   m_MB60553_cur_chip = &m_MB60553[numchip];
243240
244   clip.min_x = machine.primary_screen->visible_area().min_x;
245   clip.max_x = machine.primary_screen->visible_area().max_x;
241   clip.min_x = machine().primary_screen->visible_area().min_x;
242   clip.max_x = machine().primary_screen->visible_area().max_x;
246243
247244   for (line = 0; line < 224;line++)
248245   {
r20824r20825
253250
254251      UINT32 incxx,incyy;
255252
256      startx = state->m_MB60553_cur_chip->regs[0];
257      starty = state->m_MB60553_cur_chip->regs[1];
253      startx = m_MB60553_cur_chip->regs[0];
254      starty = m_MB60553_cur_chip->regs[1];
258255
259256      startx += (24<<4); // maybe not..
260257
261      startx -=  state->m_lineram[(line)*8+7]/2;
258      startx -=  m_lineram[(line)*8+7]/2;
262259
263      incxx = state->m_lineram[(line)*8+0]<<4;
264      incyy = state->m_lineram[(line)*8+3]<<4;
260      incxx = m_lineram[(line)*8+0]<<4;
261      incyy = m_lineram[(line)*8+3]<<4;
265262
266263      clip.min_y = clip.max_y = line;
267264
268      state->m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12,
265      m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12,
269266            incxx,0,0,incyy,
270267            1,
271268            0,priority);
r20824r20825
276273
277274}
278275
279static tilemap_t* MB60553_get_tilemap(gstriker_state *state, int numchip)
276tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip)
280277{
281   return state->m_MB60553[numchip].tmap;
278   return m_MB60553[numchip].tmap;
282279}
283280
284281
r20824r20825
338335
339336   // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably
340337   //  needs sprite orthogonality
341   MB60553_draw(machine(), 0, bitmap,cliprect, 0);
338   MB60553_draw(0, bitmap,cliprect, 0);
342339
343340   m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0);
344341
345   VS920A_draw(this, 0, bitmap, cliprect, 0);
342   VS920A_draw(0, bitmap, cliprect, 0);
346343
347344   m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2);
348345
r20824r20825
367364   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
368365
369366   // Initalize the chip for the score plane
370   VS920A_init(machine(), 1);
371   VS920A_set_gfx_region(this, 0, 0);
372   VS920A_set_pal_base(this, 0, 0x30);
373   VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf);
367   VS920A_init(1);
368   VS920A_set_gfx_region(0, 0);
369   VS920A_set_pal_base(0, 0x30);
370   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
374371
375372   // Initalize the chip for the screen plane
376   MB60553_init(machine(), 1);
377   MB60553_set_gfx_region(this, 0, 1);
378   MB60553_set_pal_base(this, 0, 0);
379   MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
373   MB60553_init(1);
374   MB60553_set_gfx_region(0, 1);
375   MB60553_set_pal_base(0, 0);
376   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
380377}
381378
382379VIDEO_START_MEMBER(gstriker_state,twrldc94)
r20824r20825
384381   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
385382
386383   // Initalize the chip for the score plane
387   VS920A_init(machine(), 1);
388   VS920A_set_gfx_region(this, 0, 0);
389   VS920A_set_pal_base(this, 0, 0x40);
390   VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf);
384   VS920A_init(1);
385   VS920A_set_gfx_region(0, 0);
386   VS920A_set_pal_base(0, 0x40);
387   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
391388
392389   // Initalize the chip for the screen plane
393   MB60553_init(machine(), 1);
394   MB60553_set_gfx_region(this, 0, 1);
395   MB60553_set_pal_base(this, 0, 0x50);
396   MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
390   MB60553_init(1);
391   MB60553_set_gfx_region(0, 1);
392   MB60553_set_pal_base(0, 0x50);
393   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
397394}
398395
399396VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
r20824r20825
401398   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
402399
403400   // Initalize the chip for the score plane
404   VS920A_init(machine(), 1);
405   VS920A_set_gfx_region(this, 0, 0);
406   VS920A_set_pal_base(this, 0, 0x30);
407   VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf);
401   VS920A_init(1);
402   VS920A_set_gfx_region(0, 0);
403   VS920A_set_pal_base(0, 0x30);
404   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
408405
409406   // Initalize the chip for the screen plane
410   MB60553_init(machine(), 1);
411   MB60553_set_gfx_region(this, 0, 1);
412   MB60553_set_pal_base(this, 0, 0x20);
413   MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf);
407   MB60553_init(1);
408   MB60553_set_gfx_region(0, 1);
409   MB60553_set_pal_base(0, 0x20);
410   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
414411}
trunk/src/mame/video/gng.c
r20824r20825
101101
102102***************************************************************************/
103103
104static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
104void gng_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
105105{
106   gng_state *state = machine.driver_data<gng_state>();
107   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
108   gfx_element *gfx = machine.gfx[2];
106   UINT8 *buffered_spriteram = m_spriteram->buffer();
107   gfx_element *gfx = machine().gfx[2];
109108   int offs;
110109
111110
112   for (offs = state->m_spriteram->bytes() - 4; offs >= 0; offs -= 4)
111   for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4)
113112   {
114113      UINT8 attributes = buffered_spriteram[offs + 1];
115114      int sx = buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01);
r20824r20825
117116      int flipx = attributes & 0x04;
118117      int flipy = attributes & 0x08;
119118
120      if (state->flip_screen())
119      if (flip_screen())
121120      {
122121         sx = 240 - sx;
123122         sy = 240 - sy;
r20824r20825
136135UINT32 gng_state::screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
137136{
138137   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
139   draw_sprites(machine(), bitmap, cliprect);
138   draw_sprites(bitmap, cliprect);
140139   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
141140   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
142141   return 0;
trunk/src/mame/video/grchamp.c
r20824r20825
108108}
109109
110110#if 0
111static int collision_check(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, int which )
111int grchamp_state::collision_check(grchamp_state *state, bitmap_ind16 &bitmap, int which )
112112{
113   int bgcolor = machine.pens[0];
114   int sprite_transp = machine.pens[0x24];
115   const rectangle &visarea = machine.primary_screen->visible_area();
116   int y0 = 240 - state->m_cpu0_out[3];
117   int x0 = 256 - state->m_cpu0_out[2];
113   int bgcolor = machine().pens[0];
114   int sprite_transp = machine().pens[0x24];
115   const rectangle &visarea = machine().primary_screen->visible_area();
116   int y0 = 240 - m_cpu0_out[3];
117   int x0 = 256 - m_cpu0_out[2];
118118   int x,y,sx,sy;
119119   int pixel;
120120   int result = 0;
r20824r20825
122122   if( which==0 )
123123   {
124124      /* draw the current player sprite into a work bitmap */
125      drawgfx_opaque( state->m_work_bitmap,
126         state->m_work_bitmap.cliprect(),
127         machine.gfx[4],
128         state->m_cpu0_out[4]&0xf,
125      drawgfx_opaque( m_work_bitmap,
126         m_work_bitmap.cliprect(),
127         machine().gfx[4],
128         m_cpu0_out[4]&0xf,
129129         1, /* color */
130130         0,0,
131131         0,0 );
r20824r20825
135135   {
136136      for( x = 0; x<32; x++ )
137137      {
138         pixel = state->m_work_bitmap.pix16(y, x);
138         pixel = m_work_bitmap.pix16(y, x);
139139         if( pixel != sprite_transp ){
140140            sx = x+x0;
141141            sy = y+y0;
r20824r20825
158158   return result?(1<<which):0;
159159}
160160
161static void draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog)
161void grchamp_state::draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog)
162162{
163163   int x,y,offs;
164164
r20824r20825
175175   }
176176}
177177
178static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
178void grchamp_state::draw_sprites(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
179179{
180   gfx_element *gfx = machine.gfx[5];
181   int bank = (state->m_cpu0_out[0] & 0x20) ? 0x40 : 0x00;
182   const UINT8 *source = state->m_spriteram + 0x40;
180   gfx_element *gfx = machine().gfx[5];
181   int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00;
182   const UINT8 *source = m_spriteram + 0x40;
183183   const UINT8 *finish = source + 0x40;
184184
185185   while (source < finish)
r20824r20825
201201#endif
202202
203203
204static void draw_objects(running_machine &machine, grchamp_state *state, int y, UINT8 *objdata)
204void grchamp_state::draw_objects(int y, UINT8 *objdata)
205205{
206206/*
207207    CPU 5/7:
r20824r20825
238238
239239
240240*/
241   const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x20;
241   const UINT8 *prom = machine().root_device().memregion("proms")->base() + 0x20;
242242   gfx_element *gfx;
243   int change = (state->m_cpu0_out[0] & 0x20) << 3;
243   int change = (m_cpu0_out[0] & 0x20) << 3;
244244   int num;
245245
246246   /* first clear to 0; this is done as the previous scanline was scanned */
247247   memset(objdata, 0, 256);
248248
249249   /* now draw the sprites; this is done during HBLANK */
250   gfx = machine.gfx[4];
250   gfx = machine().gfx[4];
251251   for (num = 0; num < 16; num++)
252252   {
253253      /*
r20824r20825
261261
262262      /* the first of the 4 bytes is the Y position; this is used to match the scanline */
263263      /* we match this scanline if the sum & 0xf0 == 0 */
264      int sy = state->m_spriteram[0x40 + (dataoffs & ~0x20)];
264      int sy = m_spriteram[0x40 + (dataoffs & ~0x20)];
265265      int dy = sy + ~y;
266266      if ((dy & 0xf0) == 0)
267267      {
268268         /* the second byte is: code is in bits 0-5, xflip in bit 6, yflip in bit 7 */
269269         /* note that X flip is reversed (on purpose) */
270         int codeflip = state->m_spriteram[0x41 + dataoffs];
270         int codeflip = m_spriteram[0x41 + dataoffs];
271271         int code = (codeflip & 0x3f) + (change >> 2);
272272         int yflip = (codeflip & 0x80) ? 0x0f : 0x00;
273273         int xflip = (codeflip & 0x40) ? 0x0f : 0x00;
274274         const UINT8 *src = gfx->get_data(code) + ((dy ^ yflip) & 15) * gfx->rowbytes();
275275
276276         /* the third byte is: color in bits 0-2 */
277         int color = (state->m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2;
277         int color = (m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2;
278278
279279         /* the fourth byte is the X position */
280         int sx = state->m_spriteram[0x43 + dataoffs];
280         int sx = m_spriteram[0x43 + dataoffs];
281281         int x;
282282
283283         /* draw 16 pixels */
r20824r20825
299299   }
300300
301301   /* finally draw the text characters; this is done as we read out the object buffers */
302   gfx = machine.gfx[0];
302   gfx = machine().gfx[0];
303303   for (num = 0; num < 32; num++)
304304   {
305305      /*
r20824r20825
311311      */
312312      int hprime = num ^ 0x1f;
313313      int dataoffs = hprime << 1;
314      int sy = state->m_spriteram[0x00 + dataoffs];
314      int sy = m_spriteram[0x00 + dataoffs];
315315      int dy = sy + ~y;
316      int color = (state->m_spriteram[0x01 + dataoffs] & 0x07) << 2;
317      int code = state->m_videoram[hprime | ((dy & 0xf8) << 2)] + change;
316      int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2;
317      int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change;
318318      const UINT8 *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes();
319319      int x;
320320
r20824r20825
398398      UINT8 objdata[256];
399399
400400      /* draw the objects for this scanline */
401      draw_objects(machine(), this, y, objdata);
401      draw_objects(y, objdata);
402402
403403      /* iterate over columns */
404404      for (x = cliprect.min_x; x <= cliprect.max_x; x++)
trunk/src/mame/video/gameplan.c
r20824r20825
3636 *
3737 *************************************/
3838
39static void gameplan_get_pens( pen_t *pens )
39void gameplan_state::gameplan_get_pens( pen_t *pens )
4040{
4141   offs_t i;
4242
r20824r20825
4646
4747
4848/* RGBI palette. Is it correct, or does it use the standard RGB? */
49static void leprechn_get_pens( pen_t *pens )
49void gameplan_state::leprechn_get_pens( pen_t *pens )
5050{
5151   offs_t i;
5252
trunk/src/mame/video/gaplus.c
r20824r20825
125125#define SPEED_2 1.0
126126#define SPEED_3 2.0
127127
128static void starfield_init(running_machine &machine)
128void gaplus_state::starfield_init()
129129{
130   gaplus_state *state = machine.driver_data<gaplus_state>();
131   struct star *stars = state->m_stars;
130   struct star *stars = m_stars;
132131   int generator = 0;
133132   int x,y;
134133   int set = 0;
135134
136   int width = machine.primary_screen->width();
137   int height = machine.primary_screen->height();
135   int width = machine().primary_screen->width();
136   int height = machine().primary_screen->height();
138137
139   state->m_total_stars = 0;
138   m_total_stars = 0;
140139
141140   /* precalculate the star background */
142141   /* this comes from the Galaxian hardware, Gaplus is probably different */
r20824r20825
155154            int color;
156155
157156            color = (~(generator >> 8)) & 0x3f;
158            if ( color && state->m_total_stars < MAX_STARS ) {
159               stars[state->m_total_stars].x = x;
160               stars[state->m_total_stars].y = y;
161               stars[state->m_total_stars].col = color;
162               stars[state->m_total_stars].set = set++;
157            if ( color && m_total_stars < MAX_STARS ) {
158               stars[m_total_stars].x = x;
159               stars[m_total_stars].y = y;
160               stars[m_total_stars].col = color;
161               stars[m_total_stars].set = set++;
163162
164163               if ( set == 3 )
165164                  set = 0;
166165
167               state->m_total_stars++;
166               m_total_stars++;
168167            }
169168         }
170169      }
r20824r20825
185184
186185   colortable_configure_tilemap_groups(machine().colortable, m_bg_tilemap, machine().gfx[0], 0xff);
187186
188   starfield_init(machine());
187   starfield_init();
189188}
190189
191190
r20824r20825
221220
222221***************************************************************************/
223222
224static void starfield_render(running_machine &machine, bitmap_ind16 &bitmap)
223void gaplus_state::starfield_render(bitmap_ind16 &bitmap)
225224{
226   gaplus_state *state = machine.driver_data<gaplus_state>();
227   struct star *stars = state->m_stars;
225   struct star *stars = m_stars;
228226   int i;
229227
230   int width = machine.primary_screen->width();
231   int height = machine.primary_screen->height();
228   int width = machine().primary_screen->width();
229   int height = machine().primary_screen->height();
232230
233231   /* check if we're running */
234   if ( ( state->m_starfield_control[0] & 1 ) == 0 )
232   if ( ( m_starfield_control[0] & 1 ) == 0 )
235233      return;
236234
237235   /* draw the starfields */
238   for ( i = 0; i < state->m_total_stars; i++ )
236   for ( i = 0; i < m_total_stars; i++ )
239237   {
240238      int x, y;
241239
r20824r20825
249247   }
250248}
251249
252static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
250void gaplus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
253251{
254   gaplus_state *state = machine.driver_data<gaplus_state>();
255   UINT8 *spriteram = state->m_spriteram + 0x780;
252   UINT8 *spriteram = m_spriteram + 0x780;
256253   UINT8 *spriteram_2 = spriteram + 0x800;
257254   UINT8 *spriteram_3 = spriteram_2 + 0x800;
258255   int offs;
r20824r20825
278275         int duplicate = spriteram_3[offs] & 0x80;
279276         int x,y;
280277
281         if (state->flip_screen())
278         if (flip_screen())
282279         {
283280            flipx ^= 1;
284281            flipy ^= 1;
r20824r20825
291288         {
292289            for (x = 0;x <= sizex;x++)
293290            {
294               drawgfx_transmask(bitmap,cliprect,machine.gfx[1],
291               drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
295292                  sprite + (duplicate ? 0 : (gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)])),
296293                  color,
297294                  flipx,flipy,
298295                  sx + 16*x,sy + 16*y,
299                  colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0xff));
296                  colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0xff));
300297            }
301298         }
302299      }
r20824r20825
310307
311308   bitmap.fill(0, cliprect);
312309
313   starfield_render(machine(), bitmap);
310   starfield_render(bitmap);
314311
315312   /* draw the low priority characters */
316313   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
317314
318   draw_sprites(machine(), bitmap, cliprect);
315   draw_sprites(bitmap, cliprect);
319316
320317   /* draw the high priority characters */
321318   /* (I don't know if this feature is used by Gaplus, but it's shown in the schematics) */
trunk/src/mame/video/galastrm.c
r20824r20825
8282
8383********************************************************/
8484
85static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs)
85void galastrm_state::draw_sprites_pre(int x_offs, int y_offs)
8686{
87   galastrm_state *state = machine.driver_data<galastrm_state>();
88   UINT32 *spriteram32 = state->m_spriteram;
89   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
87   UINT32 *spriteram32 = m_spriteram;
88   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
9089   int offs, data, tilenum, color, flipx, flipy;
9190   int x, y, priority, dblsize, curx, cury;
9291   int sprites_flipscreen = 0;
r20824r20825
9695
9796   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
9897      while processing sprite ram and then draw them all at the end */
99   state->m_sprite_ptr_pre = state->m_spritelist;
98   m_sprite_ptr_pre = m_spritelist;
10099
101   for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
100   for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
102101   {
103102      data = spriteram32[offs+0];
104103      flipx =    (data & 0x00800000) >> 23;
r20824r20825
171170            flipy = !flipy;
172171         }
173172
174         state->m_sprite_ptr_pre->gfx = 0;
175         state->m_sprite_ptr_pre->code = code;
176         state->m_sprite_ptr_pre->color = color;
177         state->m_sprite_ptr_pre->flipx = !flipx;
178         state->m_sprite_ptr_pre->flipy = flipy;
179         state->m_sprite_ptr_pre->x = curx;
180         state->m_sprite_ptr_pre->y = cury;
181         state->m_sprite_ptr_pre->zoomx = zx << 12;
182         state->m_sprite_ptr_pre->zoomy = zy << 12;
183         state->m_sprite_ptr_pre->primask = priority;
173         m_sprite_ptr_pre->gfx = 0;
174         m_sprite_ptr_pre->code = code;
175         m_sprite_ptr_pre->color = color;
176         m_sprite_ptr_pre->flipx = !flipx;
177         m_sprite_ptr_pre->flipy = flipy;
178         m_sprite_ptr_pre->x = curx;
179         m_sprite_ptr_pre->y = cury;
180         m_sprite_ptr_pre->zoomx = zx << 12;
181         m_sprite_ptr_pre->zoomy = zy << 12;
182         m_sprite_ptr_pre->primask = priority;
184183
185         state->m_sprite_ptr_pre++;
184         m_sprite_ptr_pre++;
186185      }
187186      if (bad_chunks)
188187logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
189188   }
190189}
191190
192static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority)
191void galastrm_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority)
193192{
194   galastrm_state *state = machine.driver_data<galastrm_state>();
195   struct tempsprite *sprite_ptr = state->m_sprite_ptr_pre;
193   struct tempsprite *sprite_ptr = m_sprite_ptr_pre;
196194
197   while (sprite_ptr != state->m_spritelist)
195   while (sprite_ptr != m_spritelist)
198196   {
199197      sprite_ptr--;
200198
201199      if ((priority != 0 && sprite_ptr->primask != 0) ||
202200         (priority == 0 && sprite_ptr->primask == 0))
203201      {
204         pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
202         pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
205203            sprite_ptr->code,
206204            sprite_ptr->color,
207205            sprite_ptr->flipx,sprite_ptr->flipy,
208206            sprite_ptr->x,sprite_ptr->y,
209207            sprite_ptr->zoomx,sprite_ptr->zoomy,
210            machine.priority_bitmap,primasks[sprite_ptr->primask],0);
208            machine().priority_bitmap,primasks[sprite_ptr->primask],0);
211209      }
212210   }
213211}
r20824r20825
238236   }
239237}
240238
241static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip)
239void galastrm_state::tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip)
242240{
243   galastrm_state *state = machine.driver_data<galastrm_state>();
244   poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
241   poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(m_poly);
245242   poly_draw_scanline_func callback;
246243   poly_vertex vert[4];
247   int rsx = state->m_tc0610_ctrl_reg[1][0];
248   int rsy = state->m_tc0610_ctrl_reg[1][1];
249   const int rzx = state->m_tc0610_ctrl_reg[1][2];
250   const int rzy = state->m_tc0610_ctrl_reg[1][3];
251   const int ryx = state->m_tc0610_ctrl_reg[1][5];
252   const int ryy = state->m_tc0610_ctrl_reg[1][4];
244   int rsx = m_tc0610_ctrl_reg[1][0];
245   int rsy = m_tc0610_ctrl_reg[1][1];
246   const int rzx = m_tc0610_ctrl_reg[1][2];
247   const int rzy = m_tc0610_ctrl_reg[1][3];
248   const int ryx = m_tc0610_ctrl_reg[1][5];
249   const int ryy = m_tc0610_ctrl_reg[1][4];
253250   const int lx  = srcbitmap.width();
254251   const int ly  = srcbitmap.height();
255252
r20824r20825
283280   zcs = ((float)pxx/4096.0) / (float)(lx / 2);
284281
285282
286   if ((rsx == -240 && rsy == 1072) || !state->m_tc0610_ctrl_reg[1][7])
283   if ((rsx == -240 && rsy == 1072) || !m_tc0610_ctrl_reg[1][7])
287284   {
288      state->m_rsxoffs = 0;
289      state->m_rsyoffs = 0;
285      m_rsxoffs = 0;
286      m_rsyoffs = 0;
290287   }
291288   else
292289   {
293      if (rsx > state->m_rsxb && state->m_rsxb < 0 && rsx-state->m_rsxb > 0x8000)
290      if (rsx > m_rsxb && m_rsxb < 0 && rsx-m_rsxb > 0x8000)
294291      {
295         if (state->m_rsxoffs == 0)
296            state->m_rsxoffs = -0x10000;
292         if (m_rsxoffs == 0)
293            m_rsxoffs = -0x10000;
297294         else
298            state->m_rsxoffs = 0;
295            m_rsxoffs = 0;
299296      }
300      if (rsx < state->m_rsxb && state->m_rsxb > 0 && state->m_rsxb-rsx > 0x8000)
297      if (rsx < m_rsxb && m_rsxb > 0 && m_rsxb-rsx > 0x8000)
301298      {
302         if (state->m_rsxoffs == 0)
303            state->m_rsxoffs = 0x10000-1;
299         if (m_rsxoffs == 0)
300            m_rsxoffs = 0x10000-1;
304301         else
305            state->m_rsxoffs = 0;
302            m_rsxoffs = 0;
306303      }
307      if (rsy > state->m_rsyb && state->m_rsyb < 0 && rsy-state->m_rsyb > 0x8000)
304      if (rsy > m_rsyb && m_rsyb < 0 && rsy-m_rsyb > 0x8000)
308305      {
309         if (state->m_rsyoffs == 0)
310            state->m_rsyoffs = -0x10000;
306         if (m_rsyoffs == 0)
307            m_rsyoffs = -0x10000;
311308         else
312            state->m_rsyoffs = 0;
309            m_rsyoffs = 0;
313310      }
314      if (rsy < state->m_rsyb && state->m_rsyb > 0 && state->m_rsyb-rsy > 0x8000)
311      if (rsy < m_rsyb && m_rsyb > 0 && m_rsyb-rsy > 0x8000)
315312      {
316         if (state->m_rsyoffs == 0)
317            state->m_rsyoffs = 0x10000-1;
313         if (m_rsyoffs == 0)
314            m_rsyoffs = 0x10000-1;
318315         else
319            state->m_rsyoffs = 0;
316            m_rsyoffs = 0;
320317      }
321318   }
322   state->m_rsxb = rsx;
323   state->m_rsyb = rsy;
324   if (state->m_rsxoffs) rsx += state->m_rsxoffs;
325   if (state->m_rsyoffs) rsy += state->m_rsyoffs;
326   if (rsx < -0x14000 || rsx >= 0x14000) state->m_rsxoffs = 0;
327   if (rsy < -0x14000 || rsy >= 0x14000) state->m_rsyoffs = 0;
319   m_rsxb = rsx;
320   m_rsyb = rsy;
321   if (m_rsxoffs) rsx += m_rsxoffs;
322   if (m_rsyoffs) rsy += m_rsyoffs;
323   if (rsx < -0x14000 || rsx >= 0x14000) m_rsxoffs = 0;
324   if (rsy < -0x14000 || rsy >= 0x14000) m_rsyoffs = 0;
328325
329326
330327   pxx = 0;
r20824r20825
338335   //ysn = 0.0;
339336   //ycs = 0.0;
340337
341   if (state->m_tc0610_ctrl_reg[1][7])
338   if (m_tc0610_ctrl_reg[1][7])
342339   {
343340      if (ryx != 0 || ryy != 0)
344341      {
r20824r20825
423420
424421   extra->texbase = &srcbitmap;
425422   callback = tc0610_draw_scanline;
426   poly_render_quad(state->m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
423   poly_render_quad(m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
427424}
428425
429426/**************************************************************
r20824r20825
542539      }
543540   }
544541
545   draw_sprites_pre(machine(), 42-X_OFFSET, -571+Y_OFFSET);
546   draw_sprites(machine(),m_tmpbitmaps,clip,primasks,1);
542   draw_sprites_pre(42-X_OFFSET, -571+Y_OFFSET);
543   draw_sprites(m_tmpbitmaps,clip,primasks,1);
547544
548545   copybitmap_trans(bitmap,m_polybitmap,0,0, 0,0,cliprect,0);
549546   m_polybitmap.fill(0, clip);
550   tc0610_rotate_draw(machine(),m_polybitmap,m_tmpbitmaps,cliprect);
547   tc0610_rotate_draw(m_polybitmap,m_tmpbitmaps,cliprect);
551548
552549   priority_bitmap.fill(0, cliprect);
553   draw_sprites(machine(),bitmap,cliprect,primasks,0);
550   draw_sprites(bitmap,cliprect,primasks,0);
554551
555552   tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0);
556553   tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);
trunk/src/mame/video/galaxold.c
r20824r20825
77#include "emu.h"
88#include "includes/galaxold.h"
99
10#define STARS_COLOR_BASE_LEGACY (machine.root_device().memregion("proms")->bytes())
1110#define STARS_COLOR_BASE        (machine().root_device().memregion("proms")->bytes())
1211#define BULLETS_COLOR_BASE      (STARS_COLOR_BASE + 64)
13#define BULLETS_COLOR_BASE_LEGACY       (STARS_COLOR_BASE_LEGACY + 64)
1412#define BACKGROUND_COLOR_BASE   (BULLETS_COLOR_BASE + 2)
15#define BACKGROUND_COLOR_BASE_LEGACY    (BULLETS_COLOR_BASE_LEGACY + 2)
1613
17
18
19
20static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x);
21static void   pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x);
22static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x);
23static void  mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x);
24static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x);
25
26static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
27static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
28static void  batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
29static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
30static void   ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
31static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
32
33static void drivfrcg_modify_color(UINT8 *color);
34
35
36
37
38      void galaxold_init_stars(running_machine &machine, int colors_offset);
39static void     noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
40      void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
41static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
42static void   rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
43static void  mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
44static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c);
45static void start_stars_scroll_timer(running_machine &machine);
46
47/* bullets circuit */
48static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
49static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
50static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
51static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
52
53/* background circuit */
54static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
55static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
56static void  ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
57static void  mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
58static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
59static void  minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
60static void   rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
61static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
62
63
64
65
6614/***************************************************************************
6715
6816  Convert the color PROMs into a more useable format.
r20824r20825
12775   }
12876
12977
130   galaxold_init_stars(machine(), STARS_COLOR_BASE);
78   galaxold_init_stars(STARS_COLOR_BASE);
13179
13280
13381   /* bullets - yellow and white */
r20824r20825
372320   }
373321
374322
375   galaxold_init_stars(machine(), STARS_COLOR_BASE);
323   galaxold_init_stars(STARS_COLOR_BASE);
376324
377325
378326   /* bullets - yellow and white */
r20824r20825
430378
431379***************************************************************************/
432380
433static void state_save_register(running_machine &machine)
381void galaxold_state::state_save_register()
434382{
435   galaxold_state *state = machine.driver_data<galaxold_state>();
436   state_save_register_global_array(machine, state->m_gfxbank);
437   state_save_register_global(machine, state->m_flipscreen_x);
438   state_save_register_global(machine, state->m_flipscreen_y);
383   state_save_register_global_array(machine(), m_gfxbank);
384   state_save_register_global(machine(), m_flipscreen_x);
385   state_save_register_global(machine(), m_flipscreen_y);
439386
440   state_save_register_global(machine, state->m_stars_on);
441   state_save_register_global(machine, state->m_stars_scrollpos);
442   state_save_register_global(machine, state->m_stars_blink_state);
387   state_save_register_global(machine(), m_stars_on);
388   state_save_register_global(machine(), m_stars_scrollpos);
389   state_save_register_global(machine(), m_stars_blink_state);
443390
444   state_save_register_global(machine, state->m_darkplnt_bullet_color);
391   state_save_register_global(machine(), m_darkplnt_bullet_color);
445392
446   state_save_register_global(machine, state->m_background_enable);
447   state_save_register_global(machine, state->m_background_red);
448   state_save_register_global(machine, state->m_background_green);
449   state_save_register_global(machine, state->m_background_blue);
393   state_save_register_global(machine(), m_background_enable);
394   state_save_register_global(machine(), m_background_red);
395   state_save_register_global(machine(), m_background_green);
396   state_save_register_global(machine(), m_background_blue);
450397}
451398
452static void video_start_common(running_machine &machine)
399void galaxold_state::video_start_common()
453400{
454   galaxold_state *state = machine.driver_data<galaxold_state>();
455   state->m_modify_charcode = 0;
456   state->m_modify_spritecode = 0;
457   state->m_modify_color = 0;
458   state->m_modify_ypos = 0;
401   m_modify_charcode = 0;
402   m_modify_spritecode = 0;
403   m_modify_color = 0;
404   m_modify_ypos = 0;
459405
460   state->m_mooncrst_gfxextend = 0;
406   m_mooncrst_gfxextend = 0;
461407
462   state->m_draw_bullets = 0;
408   m_draw_bullets = 0;
463409
464   state->m_draw_background = galaxold_draw_background;
465   state->m_background_enable = 0;
466   state->m_background_blue = 0;
467   state->m_background_red = 0;
468   state->m_background_green = 0;
410   m_draw_background = &galaxold_state::galaxold_draw_background;
411   m_background_enable = 0;
412   m_background_blue = 0;
413   m_background_red = 0;
414   m_background_green = 0;
469415
470   state->m_draw_stars = noop_draw_stars;
416   m_draw_stars = &galaxold_state::noop_draw_stars;
471417
472   state->m_flipscreen_x = 0;
473   state->m_flipscreen_y = 0;
418   m_flipscreen_x = 0;
419   m_flipscreen_y = 0;
474420
475   state->m_spriteram2_present = 0;
421   m_spriteram2_present = 0;
476422
477   state_save_register(machine);
423   state_save_register();
478424}
479425
480426VIDEO_START_MEMBER(galaxold_state,galaxold_plain)
481427{
482   video_start_common(machine());
428   video_start_common();
483429   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
484430   m_bg_tilemap->set_transparent_pen(0);
485431
r20824r20825
492438{
493439   VIDEO_START_CALL_MEMBER(galaxold_plain);
494440
495   m_draw_stars = galaxold_draw_stars;
441   m_draw_stars = &galaxold_state::galaxold_draw_stars;
496442
497   m_draw_bullets = galaxold_draw_bullets;
443   m_draw_bullets = &galaxold_state::galaxold_draw_bullets;
498444}
499445
500446VIDEO_START_MEMBER(galaxold_state,scrambold)
r20824r20825
506452    */
507453   m_bg_tilemap->set_scrolldx(0, 0);
508454
509   m_draw_stars = scrambold_draw_stars;
455   m_draw_stars = &galaxold_state::scrambold_draw_stars;
510456
511   m_draw_bullets = scrambold_draw_bullets;
457   m_draw_bullets = &galaxold_state::scrambold_draw_bullets;
512458
513   m_draw_background = scrambold_draw_background;
459   m_draw_background = &galaxold_state::scrambold_draw_background;
514460}
515461
516462VIDEO_START_MEMBER(galaxold_state,darkplnt)
r20824r20825
518464   VIDEO_START_CALL_MEMBER(galaxold_plain);
519465
520466   m_bg_tilemap->set_scrolldx(0, 0);
521   m_draw_bullets = darkplnt_draw_bullets;
467   m_draw_bullets = &galaxold_state::darkplnt_draw_bullets;
522468}
523469
524470VIDEO_START_MEMBER(galaxold_state,rescue)
525471{
526472   VIDEO_START_CALL_MEMBER(scrambold);
527473
528   m_draw_stars = rescue_draw_stars;
474   m_draw_stars = &galaxold_state::rescue_draw_stars;
529475
530   m_draw_background = rescue_draw_background;
476   m_draw_background = &galaxold_state::rescue_draw_background;
531477}
532478
533479VIDEO_START_MEMBER(galaxold_state,minefld)
534480{
535481   VIDEO_START_CALL_MEMBER(scrambold);
536482
537   m_draw_stars = rescue_draw_stars;
483   m_draw_stars = &galaxold_state::rescue_draw_stars;
538484
539   m_draw_background = minefld_draw_background;
485   m_draw_background = &galaxold_state::minefld_draw_background;
540486}
541487
542488VIDEO_START_MEMBER(galaxold_state,stratgyx)
543489{
544490   VIDEO_START_CALL_MEMBER(galaxold_plain);
545491
546   m_draw_background = stratgyx_draw_background;
492   m_draw_background = &galaxold_state::stratgyx_draw_background;
547493}
548494
549495VIDEO_START_MEMBER(galaxold_state,ckongs)
550496{
551497   VIDEO_START_CALL_MEMBER(scrambold);
552498
553   m_modify_spritecode = mshuttle_modify_spritecode;
499   m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode;
554500}
555501
556502VIDEO_START_MEMBER(galaxold_state,mariner)
557503{
558504   VIDEO_START_CALL_MEMBER(galaxold_plain);
559505
560   m_draw_stars = mariner_draw_stars;
506   m_draw_stars = &galaxold_state::mariner_draw_stars;
561507
562   m_draw_bullets = scrambold_draw_bullets;
508   m_draw_bullets = &galaxold_state::scrambold_draw_bullets;
563509
564   m_draw_background = mariner_draw_background;
510   m_draw_background = &galaxold_state::mariner_draw_background;
565511
566   m_modify_charcode = mariner_modify_charcode;
512   m_modify_charcode = &galaxold_state::mariner_modify_charcode;
567513}
568514
569515VIDEO_START_MEMBER(galaxold_state,mimonkey)
570516{
571517   VIDEO_START_CALL_MEMBER(scrambold);
572518
573   m_modify_charcode   = mimonkey_modify_charcode;
574   m_modify_spritecode = mimonkey_modify_spritecode;
519   m_modify_charcode   = &galaxold_state::mimonkey_modify_charcode;
520   m_modify_spritecode = &galaxold_state::mimonkey_modify_spritecode;
575521}
576522
577523VIDEO_START_MEMBER(galaxold_state,dkongjrm)
578524{
579525   VIDEO_START_CALL_MEMBER(galaxold_plain);
580526
581   m_modify_charcode   = pisces_modify_charcode;
582   m_modify_spritecode = dkongjrm_modify_spritecode;
527   m_modify_charcode   = &galaxold_state::pisces_modify_charcode;
528   m_modify_spritecode = &galaxold_state::dkongjrm_modify_spritecode;
583529
584530   m_spriteram2_present= 1;
585531}
r20824r20825
588534{
589535   VIDEO_START_CALL_MEMBER(scrambold);
590536
591   m_modify_spritecode = batman2_modify_spritecode;
537   m_modify_spritecode = &galaxold_state::batman2_modify_spritecode;
592538}
593539
594static void pisces_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
540void galaxold_state::pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
595541{
596   galaxold_state *state = machine.driver_data<galaxold_state>();
597   *code |= (state->m_gfxbank[0] << 6);
542   *code |= (m_gfxbank[0] << 6);
598543}
599544
600545VIDEO_START_MEMBER(galaxold_state,pisces)
601546{
602547   VIDEO_START_CALL_MEMBER(galaxold);
603548
604   m_modify_charcode   = pisces_modify_charcode;
605   m_modify_spritecode = pisces_modify_spritecode;
549   m_modify_charcode   = &galaxold_state::pisces_modify_charcode;
550   m_modify_spritecode = &galaxold_state::pisces_modify_spritecode;
606551}
607552
608553#ifdef UNUSED_FUNCTION
609static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
554void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
610555{
611556   int i;
612557
r20824r20825
625570{
626571   VIDEO_START_CALL_MEMBER(galaxold);
627572
628   m_draw_bullets = theend_draw_bullets;
573   m_draw_bullets = &galaxold_state::theend_draw_bullets;
629574}
630575#endif
631576
632static void mooncrst_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
577void galaxold_state::mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
633578{
634   galaxold_state *state = machine.driver_data<galaxold_state>();
635   if (state->m_gfxbank[2] && ((*code & 0x30) == 0x20))
579   if (m_gfxbank[2] && ((*code & 0x30) == 0x20))
636580   {
637      *code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40;
581      *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40;
638582   }
639583}
640584
r20824r20825
642586{
643587   VIDEO_START_CALL_MEMBER(galaxold);
644588
645   m_modify_charcode   = mooncrst_modify_charcode;
646   m_modify_spritecode = mooncrst_modify_spritecode;
589   m_modify_charcode   = &galaxold_state::mooncrst_modify_charcode;
590   m_modify_spritecode = &galaxold_state::mooncrst_modify_spritecode;
647591}
648592
649static void batman2_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
593void galaxold_state::batman2_modify_charcode(UINT16 *code, UINT8 x)
650594{
651   galaxold_state *state = machine.driver_data<galaxold_state>();
652595   if (*code & 0x80)
653596   {
654      *code |= (state->m_gfxbank[0] << 8);
597      *code |= (m_gfxbank[0] << 8);
655598   }
656599}
657600
r20824r20825
659602{
660603   VIDEO_START_CALL_MEMBER(galaxold);
661604
662   m_modify_charcode   = batman2_modify_charcode;
663   m_modify_spritecode = batman2_modify_spritecode;
605   m_modify_charcode   = &galaxold_state::batman2_modify_charcode;
606   m_modify_spritecode = &galaxold_state::batman2_modify_spritecode;
664607}
665608
666609
667610
668static void rockclim_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
611void galaxold_state::rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
669612{
670   galaxold_state *state = machine.driver_data<galaxold_state>();
671   state->m_rockclim_tilemap->draw(bitmap, cliprect, 0,0);
613   m_rockclim_tilemap->draw(bitmap, cliprect, 0,0);
672614}
673615
674static void rockclim_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
616void galaxold_state::rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
675617{
676   galaxold_state *state = machine.driver_data<galaxold_state>();
677   if (state->m_gfxbank[2])    *code|=0x40;
618   if (m_gfxbank[2])    *code|=0x40;
678619}
679620
680621VIDEO_START_MEMBER(galaxold_state,rockclim)
r20824r20825
682623   VIDEO_START_CALL_MEMBER(galaxold);
683624   m_rockclim_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::rockclim_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
684625
685   m_draw_background = rockclim_draw_background;
686   m_modify_charcode = mooncrst_modify_charcode;
687   m_modify_spritecode = rockclim_modify_spritecode;
626   m_draw_background = &galaxold_state::rockclim_draw_background;
627   m_modify_charcode = &galaxold_state::mooncrst_modify_charcode;
628   m_modify_spritecode = &galaxold_state::rockclim_modify_spritecode;
688629
689630   m_rockclim_v = m_rockclim_h = 0;
690631   state_save_register_global(machine(), m_rockclim_v);
r20824r20825
706647
707648VIDEO_START_MEMBER(galaxold_state,drivfrcg)
708649{
709   video_start_common(machine());
650   video_start_common();
710651   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
711652
712653   m_bg_tilemap->set_transparent_pen(0);
713654   m_bg_tilemap->set_scroll_cols(32);
714655
715   m_modify_spritecode = mshuttle_modify_spritecode;
716   m_modify_color = drivfrcg_modify_color;
656   m_modify_spritecode = &galaxold_state::mshuttle_modify_spritecode;
657   m_modify_color = &galaxold_state::drivfrcg_modify_color;
717658
718659   m_color_mask = 0xff;
719660}
720661
721662VIDEO_START_MEMBER(galaxold_state,ad2083)
722663{
723   video_start_common(machine());
664   video_start_common();
724665   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::drivfrcg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
725666
726667   m_bg_tilemap->set_transparent_pen(0);
727668   m_bg_tilemap->set_scroll_cols(32);
728669
729   m_modify_spritecode = ad2083_modify_spritecode;
670   m_modify_spritecode = &galaxold_state::ad2083_modify_spritecode;
730671
731   m_draw_bullets = scrambold_draw_bullets;
672   m_draw_bullets = &galaxold_state::scrambold_draw_bullets;
732673
733   m_draw_background = ad2083_draw_background;
674   m_draw_background = &galaxold_state::ad2083_draw_background;
734675
735676   m_color_mask = 7;
736677}
r20824r20825
756697
757698VIDEO_START_MEMBER(galaxold_state,racknrol)
758699{
759   video_start_common(machine());
700   video_start_common();
760701   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::racknrol_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
761702
762703   m_bg_tilemap->set_transparent_pen(0);
r20824r20825
780721   SET_TILE_INFO_MEMBER(0, code, color, 0);
781722}
782723
783static void harem_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
724void galaxold_state::harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
784725{
785   galaxold_state *state = machine.driver_data<galaxold_state>();
786   *code |= (state->m_gfxbank[0] << 7) | 0x40;
726   *code |= (m_gfxbank[0] << 7) | 0x40;
787727}
788728
789729VIDEO_START_MEMBER(galaxold_state,harem)
790730{
791   video_start_common(machine());
731   video_start_common();
792732   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(galaxold_state::harem_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
793733//  m_bg_tilemap->set_transparent_pen(0);   // opaque tilemap to get sky and sand colors
794734
r20824r20825
796736
797737   m_color_mask = (machine().gfx[0]->granularity() == 4) ? 7 : 3;
798738
799   m_modify_spritecode = harem_modify_spritecode;
739   m_modify_spritecode = &galaxold_state::harem_modify_spritecode;
800740}
801741
802742VIDEO_START_MEMBER(galaxold_state,ozon1)
r20824r20825
812752
813753   m_bg_tilemap->set_scrolldx(0, 384-256);
814754
815   m_modify_spritecode = batman2_modify_spritecode;
755   m_modify_spritecode = &galaxold_state::batman2_modify_spritecode;
816756}
817757
818758TILE_GET_INFO_MEMBER(galaxold_state::dambustr_get_tile_info2)
r20824r20825
824764
825765   if (m_modify_charcode)
826766   {
827      (*m_modify_charcode)(machine(), &code, x);
767      (this->*m_modify_charcode)(&code, x);
828768   }
829769
830770   if (m_modify_color)
831771   {
832      (*m_modify_color)(&color);
772      (this->*m_modify_color)(&color);
833773   }
834774
835775   SET_TILE_INFO_MEMBER(0, code, color, 0);
r20824r20825
845785   m_dambustr_bg_priority = 0;
846786   m_dambustr_char_bank = 0;
847787
848   m_draw_background = dambustr_draw_background;
788   m_draw_background = &galaxold_state::dambustr_draw_background;
849789
850   m_modify_charcode   = dambustr_modify_charcode;
851   m_modify_spritecode = dambustr_modify_spritecode;
790   m_modify_charcode   = &galaxold_state::dambustr_modify_charcode;
791   m_modify_spritecode = &galaxold_state::dambustr_modify_spritecode;
852792
853   m_draw_bullets = dambustr_draw_bullets;
793   m_draw_bullets = &galaxold_state::dambustr_draw_bullets;
854794
855795   /* allocate the temporary bitmap for the background priority */
856796   m_dambustr_tmpbitmap = auto_bitmap_ind16_alloc(machine(), machine().primary_screen->width(), machine().primary_screen->height());
r20824r20825
891831      {
892832         if (m_modify_ypos)
893833         {
894            (*m_modify_ypos)(&data);
834            (this->*m_modify_ypos)(&data);
895835         }
896836
897837         m_bg_tilemap->set_scrolly(offset >> 1, data);
r20824r20825
1036976
1037977/* character banking functions */
1038978
1039static void mooncrst_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
979void galaxold_state::mooncrst_modify_charcode(UINT16 *code, UINT8 x)
1040980{
1041   galaxold_state *state = machine.driver_data<galaxold_state>();
1042   if (state->m_gfxbank[2] && ((*code & 0xc0) == 0x80))
981   if (m_gfxbank[2] && ((*code & 0xc0) == 0x80))
1043982   {
1044      *code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100;
983      *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100;
1045984   }
1046985}
1047986
1048static void pisces_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
987void galaxold_state::pisces_modify_charcode(UINT16 *code, UINT8 x)
1049988{
1050   galaxold_state *state = machine.driver_data<galaxold_state>();
1051   *code |= (state->m_gfxbank[0] << 8);
989   *code |= (m_gfxbank[0] << 8);
1052990}
1053991
1054static void mimonkey_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
992void galaxold_state::mimonkey_modify_charcode(UINT16 *code, UINT8 x)
1055993{
1056   galaxold_state *state = machine.driver_data<galaxold_state>();
1057   *code |= (state->m_gfxbank[0] << 8) | (state->m_gfxbank[2] << 9);
994   *code |= (m_gfxbank[0] << 8) | (m_gfxbank[2] << 9);
1058995}
1059996
1060static void mariner_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
997void galaxold_state::mariner_modify_charcode(UINT16 *code, UINT8 x)
1061998{
1062999   UINT8 *prom;
10631000
10641001
10651002   /* bit 0 of the PROM controls character banking */
10661003
1067   prom = machine.root_device().memregion("user2")->base();
1004   prom = machine().root_device().memregion("user2")->base();
10681005
10691006   *code |= ((prom[x] & 0x01) << 8);
10701007}
10711008
1072static void dambustr_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
1009void galaxold_state::dambustr_modify_charcode(UINT16 *code, UINT8 x)
10731010{
1074   galaxold_state *state = machine.driver_data<galaxold_state>();
1075   if (state->m_dambustr_char_bank == 0) { // text mode
1011   if (m_dambustr_char_bank == 0) { // text mode
10761012      *code |= 0x0300;
10771013   }
10781014   else {              // graphics mode
r20824r20825
10871023
10881024/* sprite banking functions */
10891025
1090static void mshuttle_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1026void galaxold_state::mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
10911027{
10921028   *code |= ((spriteram[offs + 2] & 0x30) << 2);
10931029}
10941030
10951031
1096static void mimonkey_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1032void galaxold_state::mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
10971033{
1098   galaxold_state *state = machine.driver_data<galaxold_state>();
1099   *code |= (state->m_gfxbank[0] << 6) | (state->m_gfxbank[2] << 7);
1034   *code |= (m_gfxbank[0] << 6) | (m_gfxbank[2] << 7);
11001035}
11011036
1102static void batman2_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1037void galaxold_state::batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
11031038{
11041039   /* only the upper 64 sprites are used */
11051040   *code |= 0x40;
11061041}
11071042
1108static void dkongjrm_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1043void galaxold_state::dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
11091044{
11101045   /* No x flip */
11111046   *code = (spriteram[offs + 1] & 0x7f) | 0x80;
11121047   *flipx = 0;
11131048}
11141049
1115static void ad2083_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1050void galaxold_state::ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
11161051{
11171052   /* No x flip */
11181053   *code = (spriteram[offs + 1] & 0x7f) | ((spriteram[offs + 2] & 0x30) << 2);
11191054   *flipx = 0;
11201055}
11211056
1122static void dambustr_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1057void galaxold_state::dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
11231058{
11241059   *code += 0x40;
11251060}
r20824r20825
11271062
11281063/* color PROM mapping functions */
11291064
1130static void drivfrcg_modify_color(UINT8 *color)
1065void galaxold_state::drivfrcg_modify_color(UINT8 *color)
11311066{
11321067   *color = ((*color & 0x40) >> 3) | (*color & 7);
11331068}
r20824r20825
11371072
11381073/* bullet drawing functions */
11391074
1140static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1075void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11411076{
11421077   int i;
11431078
r20824r20825
11521087
11531088
11541089         /* yellow missile, white shells (this is the terminology on the schematics) */
1155         color = ((offs == 7*4) ? BULLETS_COLOR_BASE_LEGACY : BULLETS_COLOR_BASE_LEGACY + 1);
1090         color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1);
11561091
11571092         bitmap.pix16(y, x) = color;
11581093      }
11591094   }
11601095}
11611096
1162static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1097void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11631098{
1164   galaxold_state *state = machine.driver_data<galaxold_state>();
1165   if (state->m_flipscreen_x)  x++;
1099   if (m_flipscreen_x)  x++;
11661100
11671101   x = x - 6;
11681102
11691103   if (cliprect.contains(x, y))
11701104      /* yellow bullets */
1171      bitmap.pix16(y, x) = BULLETS_COLOR_BASE_LEGACY;
1105      bitmap.pix16(y, x) = BULLETS_COLOR_BASE;
11721106}
11731107
1174static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1108void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11751109{
1176   galaxold_state *state = machine.driver_data<galaxold_state>();
1177   if (state->m_flipscreen_x)  x++;
1110   if (m_flipscreen_x)  x++;
11781111
11791112   x = x - 6;
11801113
11811114   if (cliprect.contains(x, y))
1182      bitmap.pix16(y, x) = 32 + state->m_darkplnt_bullet_color;
1115      bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color;
11831116}
11841117
1185static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
1118void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y)
11861119{
1187   galaxold_state *state = machine.driver_data<galaxold_state>();
11881120   int i, color;
11891121
1190   if (state->flip_screen_x())  x++;
1122   if (flip_screen_x())  x++;
11911123
11921124   x = x - 6;
11931125
r20824r20825
11961128   {
11971129      if (offs < 4*4)
11981130      {
1199         color = BULLETS_COLOR_BASE_LEGACY;
1131         color = BULLETS_COLOR_BASE;
12001132         y--;
12011133      }
12021134      else {
1203         color = BULLETS_COLOR_BASE_LEGACY + 1;
1135         color = BULLETS_COLOR_BASE + 1;
12041136         x--;
12051137      }
12061138
r20824r20825
12131145
12141146/* background drawing functions */
12151147
1216static void galaxold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1148void galaxold_state::galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12171149{
12181150   /* plain black background */
12191151   bitmap.fill(0, cliprect);
12201152}
12211153
1222static void scrambold_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1154void galaxold_state::scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12231155{
1224   galaxold_state *state = machine.driver_data<galaxold_state>();
1225   if (state->m_background_enable)
1226      bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY, cliprect);
1156   if (m_background_enable)
1157      bitmap.fill(BACKGROUND_COLOR_BASE, cliprect);
12271158   else
12281159      bitmap.fill(0, cliprect);
12291160}
12301161
1231static void ad2083_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1162void galaxold_state::ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12321163{
1233   galaxold_state *state = machine.driver_data<galaxold_state>();
1234   int color = (state->m_background_blue << 2) | (state->m_background_green << 1) | state->m_background_red;
1164   int color = (m_background_blue << 2) | (m_background_green << 1) | m_background_red;
12351165
1236   bitmap.fill(BACKGROUND_COLOR_BASE_LEGACY + color, cliprect);
1166   bitmap.fill(BACKGROUND_COLOR_BASE + color, cliprect);
12371167}
12381168
1239static void stratgyx_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1169void galaxold_state::stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12401170{
1241   galaxold_state *state = machine.driver_data<galaxold_state>();
12421171   UINT8 x;
12431172   UINT8 *prom;
1244   int base = BACKGROUND_COLOR_BASE_LEGACY;
1173   int base = BACKGROUND_COLOR_BASE;
12451174
12461175
12471176   /* the background PROM is connected the following way:
r20824r20825
12511180                the green gun if BCG is asserted
12521181      bits 2-7 are unconnected */
12531182
1254   prom = state->memregion("user1")->base();
1183   prom = memregion("user1")->base();
12551184
12561185   for (x = 0; x < 32; x++)
12571186   {
r20824r20825
12601189
12611190      color = 0;
12621191
1263      if ((~prom[x] & 0x02) && state->m_background_red)   color |= 0x01;
1264      if ((~prom[x] & 0x02) && state->m_background_green) color |= 0x02;
1265      if ((~prom[x] & 0x01) && state->m_background_blue)  color |= 0x04;
1192      if ((~prom[x] & 0x02) && m_background_red)   color |= 0x01;
1193      if ((~prom[x] & 0x02) && m_background_green) color |= 0x02;
1194      if ((~prom[x] & 0x01) && m_background_blue)  color |= 0x04;
12661195
1267      if (state->m_flipscreen_x)
1196      if (m_flipscreen_x)
12681197         sx = 8 * (31 - x);
12691198      else
12701199         sx = 8 * x;
r20824r20825
12731202   }
12741203}
12751204
1276static void minefld_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1205void galaxold_state::minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12771206{
1278   galaxold_state *state = machine.driver_data<galaxold_state>();
1279   if (state->m_background_enable)
1207   if (m_background_enable)
12801208   {
1281      int base = BACKGROUND_COLOR_BASE_LEGACY;
1209      int base = BACKGROUND_COLOR_BASE;
12821210      int x;
12831211
12841212
r20824r20825
12941222      bitmap.fill(0, cliprect);
12951223}
12961224
1297static void rescue_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1225void galaxold_state::rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
12981226{
1299   galaxold_state *state = machine.driver_data<galaxold_state>();
1300   if (state->m_background_enable)
1227   if (m_background_enable)
13011228   {
1302      int base = BACKGROUND_COLOR_BASE_LEGACY;
1229      int base = BACKGROUND_COLOR_BASE;
13031230      int x;
13041231
13051232      for (x = 0; x < 128; x++)
r20824r20825
13141241      bitmap.fill(0, cliprect);
13151242}
13161243
1317static void mariner_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1244void galaxold_state::mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
13181245{
1319   galaxold_state *state = machine.driver_data<galaxold_state>();
1320   int base = BACKGROUND_COLOR_BASE_LEGACY;
1246   int base = BACKGROUND_COLOR_BASE;
13211247   UINT8 x;
13221248   UINT8 *prom;
13231249
r20824r20825
13261252      line (column) of the screen.  The first 0x20 bytes for unflipped,
13271253      and the 2nd 0x20 bytes for flipped screen. */
13281254
1329   prom = state->memregion("user1")->base();
1255   prom = memregion("user1")->base();
13301256
1331   if (state->m_flipscreen_x)
1257   if (m_flipscreen_x)
13321258   {
13331259      for (x = 0; x < 32; x++)
13341260      {
r20824r20825
13581284   }
13591285}
13601286
1361static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1287void galaxold_state::dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
13621288{
1363   galaxold_state *state = machine.driver_data<galaxold_state>();
1364   int base = BACKGROUND_COLOR_BASE_LEGACY;
1365   int col1 = base + state->m_dambustr_bg_color_1;
1366   int col2 = base + state->m_dambustr_bg_color_2;
1289   int base = BACKGROUND_COLOR_BASE;
1290   int col1 = base + m_dambustr_bg_color_1;
1291   int col2 = base + m_dambustr_bg_color_2;
13671292
1368   if (state->flip_screen_x())
1293   if (flip_screen_x())
13691294   {
1370      bitmap.plot_box(  0, 0, 256-state->m_dambustr_bg_split_line, 256, col2);
1371      bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col1);
1295      bitmap.plot_box(  0, 0, 256-m_dambustr_bg_split_line, 256, col2);
1296      bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col1);
13721297   }
13731298   else
13741299   {
1375      bitmap.plot_box(  0, 0, 256-state->m_dambustr_bg_split_line, 256, col1);
1376      bitmap.plot_box(256-state->m_dambustr_bg_split_line, 0, state->m_dambustr_bg_split_line, 256, col2);
1300      bitmap.plot_box(  0, 0, 256-m_dambustr_bg_split_line, 256, col1);
1301      bitmap.plot_box(256-m_dambustr_bg_split_line, 0, m_dambustr_bg_split_line, 256, col2);
13771302   }
13781303
13791304}
13801305
1381static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1306void galaxold_state::dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
13821307{
1383   galaxold_state *state = machine.driver_data<galaxold_state>();
13841308
1385   if (state->flip_screen_x())
1309   if (flip_screen_x())
13861310   {
1387      rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255);
1388      copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
1311      rectangle clip(254 - m_dambustr_bg_split_line, m_dambustr_bg_split_line, 0, 255);
1312      copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
13891313   }
13901314   else
13911315   {
1392      rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255);
1393      copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
1316      rectangle clip(0, 254 - m_dambustr_bg_split_line, 0, 255);
1317      copybitmap(bitmap, *m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
13941318   }
13951319}
13961320
r20824r20825
13981322
13991323/* star drawing functions */
14001324
1401void galaxold_init_stars(running_machine &machine, int colors_offset)
1325void galaxold_state::galaxold_init_stars(int colors_offset)
14021326{
1403   galaxold_state *state = machine.driver_data<galaxold_state>();
1404   struct star *stars = state->m_stars;
1327   struct star *stars = m_stars;
14051328   int i;
14061329   int total_stars;
14071330   UINT32 generator;
14081331   int x,y;
14091332
14101333
1411   state->m_stars_on = 0;
1412   state->m_stars_blink_state = 0;
1413   state->m_stars_blink_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),state));
1414   state->m_stars_scroll_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),state));
1415   state->m_timer_adjusted = 0;
1416   state->m_stars_colors_start = colors_offset;
1334   m_stars_on = 0;
1335   m_stars_blink_state = 0;
1336   m_stars_blink_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_blink_callback),this));
1337   m_stars_scroll_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxold_state::stars_scroll_callback),this));
1338   m_timer_adjusted = 0;
1339   m_stars_colors_start = colors_offset;
14171340
14181341   for (i = 0;i < 64;i++)
14191342   {
r20824r20825
14271350      g = map[bits];
14281351      bits = (i >> 4) & 0x03;
14291352      b = map[bits];
1430      palette_set_color_rgb(machine,colors_offset+i,r,g,b);
1353      palette_set_color_rgb(machine(),colors_offset+i,r,g,b);
14311354   }
14321355
14331356
r20824r20825
14711394   }
14721395}
14731396
1474static void plot_star(galaxold_state *state, bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect)
1397void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect)
14751398{
1476   if (state->m_flipscreen_x)
1399   if (m_flipscreen_x)
14771400      x = 255 - x;
14781401
1479   if (state->m_flipscreen_y)
1402   if (m_flipscreen_y)
14801403      y = 255 - y;
14811404
14821405   if (cliprect.contains(x, y))
1483      bitmap.pix16(y, x) = state->m_stars_colors_start + color;
1406      bitmap.pix16(y, x) = m_stars_colors_start + color;
14841407}
14851408
1486static void noop_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1409void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect)
14871410{
14881411}
14891412
1490void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1413void galaxold_state::galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect)
14911414{
1492   galaxold_state *state = machine.driver_data<galaxold_state>();
1493   struct star *stars = state->m_stars;
1415   struct star *stars = m_stars;
14941416   int offs;
14951417
14961418
1497   if (!state->m_timer_adjusted)
1419   if (!m_timer_adjusted)
14981420   {
1499      start_stars_scroll_timer(machine);
1500      state->m_timer_adjusted = 1;
1421      start_stars_scroll_timer();
1422      m_timer_adjusted = 1;
15011423   }
15021424
15031425
r20824r20825
15061428      int x,y;
15071429
15081430
1509      x = ((stars[offs].x +   state->m_stars_scrollpos) & 0x01ff) >> 1;
1510      y = ( stars[offs].y + ((state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff;
1431      x = ((stars[offs].x +   m_stars_scrollpos) & 0x01ff) >> 1;
1432      y = ( stars[offs].y + ((m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff;
15111433
15121434      if ((y & 0x01) ^ ((x >> 3) & 0x01))
15131435      {
1514         plot_star(state, bitmap, x, y, stars[offs].color, cliprect);
1436         plot_star(bitmap, x, y, stars[offs].color, cliprect);
15151437      }
15161438   }
15171439}
15181440
1519static void scrambold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1441void galaxold_state::scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect)
15201442{
1521   galaxold_state *state = machine.driver_data<galaxold_state>();
1522   struct star *stars = state->m_stars;
1443   struct star *stars = m_stars;
15231444   int offs;
15241445
15251446
1526   if (!state->m_timer_adjusted)
1447   if (!m_timer_adjusted)
15271448   {
1528      start_stars_blink_timer(machine, 100000, 10000, 0.00001);
1529      state->m_timer_adjusted = 1;
1449      start_stars_blink_timer(100000, 10000, 0.00001);
1450      m_timer_adjusted = 1;
15301451   }
15311452
15321453
r20824r20825
15411462      if ((y & 0x01) ^ ((x >> 3) & 0x01))
15421463      {
15431464         /* determine when to skip plotting */
1544         switch (state->m_stars_blink_state & 0x03)
1465         switch (m_stars_blink_state & 0x03)
15451466         {
15461467         case 0:
15471468            if (!(stars[offs].color & 0x01))  continue;
r20824r20825
15571478            break;
15581479         }
15591480
1560         plot_star(state, bitmap, x, y, stars[offs].color, cliprect);
1481         plot_star(bitmap, x, y, stars[offs].color, cliprect);
15611482      }
15621483   }
15631484}
15641485
1565static void rescue_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1486void galaxold_state::rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect)
15661487{
1567   galaxold_state *state = machine.driver_data<galaxold_state>();
1568   struct star *stars = state->m_stars;
1488   struct star *stars = m_stars;
15691489   int offs;
15701490
15711491
15721492   /* same as Scramble, but only top (left) half of screen */
15731493
1574   if (!state->m_timer_adjusted)
1494   if (!m_timer_adjusted)
15751495   {
1576      start_stars_blink_timer(machine, 100000, 10000, 0.00001);
1577      state->m_timer_adjusted = 1;
1496      start_stars_blink_timer(100000, 10000, 0.00001);
1497      m_timer_adjusted = 1;
15781498   }
15791499
15801500
r20824r20825
15891509      if ((x < 128) && ((y & 0x01) ^ ((x >> 3) & 0x01)))
15901510      {
15911511         /* determine when to skip plotting */
1592         switch (state->m_stars_blink_state & 0x03)
1512         switch (m_stars_blink_state & 0x03)
15931513         {
15941514         case 0:
15951515            if (!(stars[offs].color & 0x01))  continue;
r20824r20825
16051525            break;
16061526         }
16071527
1608         plot_star(state, bitmap, x, y, stars[offs].color, cliprect);
1528         plot_star(bitmap, x, y, stars[offs].color, cliprect);
16091529      }
16101530   }
16111531}
16121532
1613static void mariner_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1533void galaxold_state::mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect)
16141534{
1615   galaxold_state *state = machine.driver_data<galaxold_state>();
1616   struct star *stars = state->m_stars;
1535   struct star *stars = m_stars;
16171536   int offs;
16181537   UINT8 *prom;
16191538
16201539
1621   if (!state->m_timer_adjusted)
1540   if (!m_timer_adjusted)
16221541   {
1623      start_stars_scroll_timer(machine);
1624      state->m_timer_adjusted = 1;
1542      start_stars_scroll_timer();
1543      m_timer_adjusted = 1;
16251544   }
16261545
16271546
16281547   /* bit 2 of the PROM controls star visibility */
16291548
1630   prom = machine.root_device().memregion("user2")->base();
1549   prom = machine().root_device().memregion("user2")->base();
16311550
16321551   for (offs = 0;offs < STAR_COUNT;offs++)
16331552   {
16341553      int x,y;
16351554
16361555
1637      x = ((stars[offs].x +   -state->m_stars_scrollpos) & 0x01ff) >> 1;
1638      y = ( stars[offs].y + ((-state->m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff;
1556      x = ((stars[offs].x +   -m_stars_scrollpos) & 0x01ff) >> 1;
1557      y = ( stars[offs].y + ((-m_stars_scrollpos + stars[offs].x) >> 9)) & 0xff;
16391558
16401559      if ((y & 0x01) ^ ((x >> 3) & 0x01))
16411560      {
16421561         if (prom[(x/8 + 1) & 0x1f] & 0x04)
16431562         {
1644            plot_star(state, bitmap, x, y, stars[offs].color, cliprect);
1563            plot_star(bitmap, x, y, stars[offs].color, cliprect);
16451564         }
16461565      }
16471566   }
r20824r20825
16521571   m_stars_blink_state++;
16531572}
16541573
1655static void start_stars_blink_timer(running_machine &machine, double ra, double rb, double c)
1574void galaxold_state::start_stars_blink_timer(double ra, double rb, double c)
16561575{
1657   galaxold_state *state = machine.driver_data<galaxold_state>();
16581576   /* calculate the period using the formula given in the 555 datasheet */
16591577
16601578   int period_in_ms = 693 * (ra + 2.0 * rb) * c;
16611579
1662   state->m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms));
1580   m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms));
16631581}
16641582
16651583
r20824r20825
16711589   }
16721590}
16731591
1674static void start_stars_scroll_timer(running_machine &machine)
1592void galaxold_state::start_stars_scroll_timer()
16751593{
1676   galaxold_state *state = machine.driver_data<galaxold_state>();
1677   state->m_stars_scroll_timer->adjust(machine.primary_screen->frame_period(), 0, machine.primary_screen->frame_period());
1594   m_stars_scroll_timer->adjust(machine().primary_screen->frame_period(), 0, machine().primary_screen->frame_period());
16781595}
16791596
16801597
r20824r20825
16881605
16891606   if (m_modify_charcode)
16901607   {
1691      (*m_modify_charcode)(machine(), &code, x);
1608      (this->*m_modify_charcode)(&code, x);
16921609   }
16931610
16941611   if (m_modify_color)
16951612   {
1696      (*m_modify_color)(&color);
1613      (this->*m_modify_color)(&color);
16971614   }
16981615
16991616   SET_TILE_INFO_MEMBER(0, code, color, 0);
r20824r20825
17051622   SET_TILE_INFO_MEMBER(2, code, 0, 0);
17061623}
17071624
1708static void draw_bullets_common(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
1625void galaxold_state::draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect)
17091626{
1710   galaxold_state *state = machine.driver_data<galaxold_state>();
17111627   int offs;
17121628
17131629
1714   for (offs = 0;offs < state->m_bulletsram.bytes();offs += 4)
1630   for (offs = 0;offs < m_bulletsram.bytes();offs += 4)
17151631   {
17161632      UINT8 sx,sy;
17171633
1718      sy = 255 - state->m_bulletsram[offs + 1];
1719      sx = 255 - state->m_bulletsram[offs + 3];
1634      sy = 255 - m_bulletsram[offs + 1];
1635      sx = 255 - m_bulletsram[offs + 3];
17201636
1721      if (state->m_flipscreen_y)  sy = 255 - sy;
1637      if (m_flipscreen_y)  sy = 255 - sy;
17221638
1723      (*state->m_draw_bullets)(machine, bitmap, cliprect, offs, sx, sy);
1639      (this->*m_draw_bullets)(bitmap, cliprect, offs, sx, sy);
17241640   }
17251641}
17261642
17271643
1728static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size)
1644void galaxold_state::draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size)
17291645{
17301646   const rectangle spritevisiblearea(2*8+1, 32*8-1, 2*8,   30*8-1);
17311647   const rectangle spritevisibleareaflipx(0*8, 30*8-2, 2*8, 30*8-1);
17321648
1733   galaxold_state *state = machine.driver_data<galaxold_state>();
17341649   int offs;
17351650
17361651
r20824r20825
17451660      flipx = spriteram[offs + 1] & 0x40;
17461661      flipy = spriteram[offs + 1] & 0x80;
17471662      code = spriteram[offs + 1] & 0x3f;
1748      color = spriteram[offs + 2] & state->m_color_mask;
1663      color = spriteram[offs + 2] & m_color_mask;
17491664
1750      if (state->m_modify_spritecode)
1665      if (m_modify_spritecode)
17511666      {
1752         (*state->m_modify_spritecode)(machine, spriteram, &code, &flipx, &flipy, offs);
1667         (this->*m_modify_spritecode)(spriteram, &code, &flipx, &flipy, offs);
17531668      }
17541669
1755      if (state->m_modify_color)
1670      if (m_modify_color)
17561671      {
1757         (*state->m_modify_color)(&color);
1672         (this->*m_modify_color)(&color);
17581673      }
17591674
1760      if (state->m_modify_ypos)
1675      if (m_modify_ypos)
17611676      {
1762         (*state->m_modify_ypos)(&sy);
1677         (this->*m_modify_ypos)(&sy);
17631678      }
17641679
1765      if (state->m_flipscreen_x)
1680      if (m_flipscreen_x)
17661681      {
17671682         sx = 240 - sx;
17681683         flipx = !flipx;
17691684      }
17701685
1771      if (state->m_flipscreen_y)
1686      if (m_flipscreen_y)
17721687      {
17731688         flipy = !flipy;
17741689      }
r20824r20825
17861701      if (offs < 3*4)  sy++;
17871702
17881703
1789      drawgfx_transpen(bitmap, state->m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine.gfx[1],
1704      drawgfx_transpen(bitmap, m_flipscreen_x ? spritevisibleareaflipx : spritevisiblearea, machine().gfx[1],
17901705            code,color,
17911706            flipx,flipy,
17921707            sx,sy,0);
r20824r20825
17961711
17971712UINT32 galaxold_state::screen_update_galaxold(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
17981713{
1799   (*m_draw_background)(machine(), bitmap, cliprect);
1714   (this->*m_draw_background)(bitmap, cliprect);
18001715
18011716   if (m_stars_on)
18021717   {
1803      (*m_draw_stars)(machine(), bitmap, cliprect);
1718      (this->*m_draw_stars)(bitmap, cliprect);
18041719   }
18051720
18061721
r20824r20825
18081723
18091724   if (m_draw_bullets)
18101725   {
1811      draw_bullets_common(machine(), bitmap, cliprect);
1726      draw_bullets_common(bitmap, cliprect);
18121727   }
18131728
18141729
1815   draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes());
1730   draw_sprites(bitmap, m_spriteram, m_spriteram.bytes());
18161731
18171732   if (m_spriteram2_present)
18181733   {
1819      draw_sprites(machine(), bitmap, m_spriteram2, m_spriteram2.bytes());
1734      draw_sprites(bitmap, m_spriteram2, m_spriteram2.bytes());
18201735   }
18211736   return 0;
18221737}
r20824r20825
18271742   int i, j;
18281743   UINT8 color;
18291744
1830   (*m_draw_background)(machine(), bitmap, cliprect);
1745   (this->*m_draw_background)(bitmap, cliprect);
18311746
18321747   if (m_stars_on)
18331748   {
1834      (*m_draw_stars)(machine(), bitmap, cliprect);
1749      (this->*m_draw_stars)(bitmap, cliprect);
18351750   }
18361751
18371752   /* save the background for drawing it again later, if background has priority over characters */
r20824r20825
18411756
18421757   if (m_draw_bullets)
18431758   {
1844      draw_bullets_common(machine(), bitmap, cliprect);
1759      draw_bullets_common(bitmap, cliprect);
18451760   }
18461761
1847   draw_sprites(machine(), bitmap, m_spriteram, m_spriteram.bytes());
1762   draw_sprites(bitmap, m_spriteram, m_spriteram.bytes());
18481763
18491764   if (m_dambustr_bg_priority)
18501765   {
18511766      /* draw the upper part of the background, as it has priority */
1852      dambustr_draw_upper_background(machine(), bitmap, cliprect);
1767      dambustr_draw_upper_background(bitmap, cliprect);
18531768
18541769      /* only rows with color code > 3 are stronger than the background */
18551770      memset(m_dambustr_videoram2, 0x20, 0x0400);
r20824r20825
18671782   return 0;
18681783}
18691784
1870static void bagmanmc_modify_charcode(running_machine &machine, UINT16 *code, UINT8 x)
1785void galaxold_state::bagmanmc_modify_charcode(UINT16 *code, UINT8 x)
18711786{
1872   galaxold_state *state = machine.driver_data<galaxold_state>();
1873   *code |= (state->m_gfxbank[0] << 9);
1787   *code |= (m_gfxbank[0] << 9);
18741788}
18751789
1876static void bagmanmc_modify_spritecode(running_machine &machine, UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
1790void galaxold_state::bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs)
18771791{
1878   galaxold_state *state = machine.driver_data<galaxold_state>();
1879   *code |= (state->m_gfxbank[0] << 7) | 0x40;
1792   *code |= (m_gfxbank[0] << 7) | 0x40;
18801793}
18811794
18821795VIDEO_START_MEMBER(galaxold_state,bagmanmc)
18831796{
18841797   VIDEO_START_CALL_MEMBER(galaxold);
18851798
1886   m_modify_charcode = bagmanmc_modify_charcode;
1887   m_modify_spritecode = bagmanmc_modify_spritecode;
1799   m_modify_charcode = &galaxold_state::bagmanmc_modify_charcode;
1800   m_modify_spritecode = &galaxold_state::bagmanmc_modify_spritecode;
18881801}
trunk/src/mame/video/gaiden.c
r20824r20825
272272   to blend into the final 32-bit rgb bitmaps, this is currently broken (due to zsolt's core
273273   changes?) it appears that the sprite drawing is no longer putting the correct raw data
274274   in the bitmaps? */
275static void blendbitmaps(running_machine &machine,
276      bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
275void gaiden_state::blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
277276      int sx,int sy,const rectangle &cliprect)
278277{
279278   int y,x;
280   const pen_t *paldata = machine.pens;
279   const pen_t *paldata = machine().pens;
281280
282281   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
283282   {
r20824r20825
330329 *         |---------x------- | x position (high bit)
331330 */
332331
333static void drgnbowl_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
332void gaiden_state::drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
334333{
335   gaiden_state *state = machine.driver_data<gaiden_state>();
336   UINT16 *spriteram = state->m_spriteram;
334   UINT16 *spriteram = m_spriteram;
337335   int i, code, color, x, y, flipx, flipy, priority_mask;
338336
339337   for( i = 0; i < 0x800/2; i += 4 )
r20824r20825
355353      else
356354         priority_mask = 0;
357355
358      pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3],
356      pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3],
359357            code,
360            machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(),
358            machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(),
361359            flipx,flipy,x,y,
362            machine.priority_bitmap, priority_mask,15);
360            machine().priority_bitmap, priority_mask,15);
363361
364362      /* wrap x*/
365      pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3],
363      pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3],
366364            code,
367            machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(),
365            machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(),
368366            flipx,flipy,x-512,y,
369            machine.priority_bitmap, priority_mask,15);
367            machine().priority_bitmap, priority_mask,15);
370368
371369   }
372370}
r20824r20825
391389   gaiden_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen());
392390
393391   /* mix & blend the tilemaps and sprites into a 32-bit bitmap */
394   blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
392   blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
395393   return 0;
396394
397395}
r20824r20825
416414   raiga_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen());
417415
418416   /* mix & blend the tilemaps and sprites into a 32-bit bitmap */
419   blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
417   blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
420418   return 0;
421419}
422420
r20824r20825
427425   m_background->draw(bitmap, cliprect, 0, 1);
428426   m_foreground->draw(bitmap, cliprect, 0, 2);
429427   m_text_layer->draw(bitmap, cliprect, 0, 4);
430   drgnbowl_draw_sprites(machine(), bitmap, cliprect);
428   drgnbowl_draw_sprites(bitmap, cliprect);
431429   return 0;
432430}
trunk/src/mame/video/gunsmoke.c
r20824r20825
133133   colortable_configure_tilemap_groups(machine().colortable, m_fg_tilemap, machine().gfx[0], 0x4f);
134134}
135135
136static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
136void gunsmoke_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
137137{
138   gunsmoke_state *state = machine.driver_data<gunsmoke_state>();
139   UINT8 *spriteram = state->m_spriteram;
138   UINT8 *spriteram = m_spriteram;
140139   int offs;
141140
142   for (offs = state->m_spriteram.bytes() - 32; offs >= 0; offs -= 32)
141   for (offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32)
143142   {
144143      int attr = spriteram[offs + 1];
145144      int bank = (attr & 0xc0) >> 6;
r20824r20825
151150      int sy = spriteram[offs + 2];
152151
153152      if (bank == 3)
154         bank += state->m_sprite3bank;
153         bank += m_sprite3bank;
155154
156155      code += 256 * bank;
157156
158      if (state->flip_screen())
157      if (flip_screen())
159158      {
160159         sx = 240 - sx;
161160         sy = 240 - sy;
r20824r20825
163162         flipy = !flipy;
164163      }
165164
166      drawgfx_transpen(bitmap, cliprect, machine.gfx[2], code, color, flipx, flipy, sx, sy, 0);
165      drawgfx_transpen(bitmap, cliprect, machine().gfx[2], code, color, flipx, flipy, sx, sy, 0);
167166   }
168167}
169168
r20824r20825
178177      bitmap.fill(get_black_pen(machine()), cliprect);
179178
180179   if (m_objon)
181      draw_sprites(machine(), bitmap, cliprect);
180      draw_sprites(bitmap, cliprect);
182181
183182   if (m_chon)
184183      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
trunk/src/mame/video/gcpinbal.c
r20824r20825
4040         0);
4141}
4242
43static void gcpinbal_core_vh_start( running_machine &machine )
43void gcpinbal_state::gcpinbal_core_vh_start(  )
4444{
45   gcpinbal_state *state = machine.driver_data<gcpinbal_state>();
4645   int xoffs = 0;
4746   int yoffs = 0;
4847
49   state->m_tilemap[0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32);
50   state->m_tilemap[1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32);
51   state->m_tilemap[2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),state), TILEMAP_SCAN_ROWS,8,8,64,64);
48   m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
49   m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
50   m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS,8,8,64,64);
5251
53   state->m_tilemap[0]->set_transparent_pen(0);
54   state->m_tilemap[1]->set_transparent_pen(0);
55   state->m_tilemap[2]->set_transparent_pen(0);
52   m_tilemap[0]->set_transparent_pen(0);
53   m_tilemap[1]->set_transparent_pen(0);
54   m_tilemap[2]->set_transparent_pen(0);
5655
5756   /* flipscreen n/a */
58   state->m_tilemap[0]->set_scrolldx(-xoffs, 0);
59   state->m_tilemap[1]->set_scrolldx(-xoffs, 0);
60   state->m_tilemap[2]->set_scrolldx(-xoffs, 0);
61   state->m_tilemap[0]->set_scrolldy(-yoffs, 0);
62   state->m_tilemap[1]->set_scrolldy(-yoffs, 0);
63   state->m_tilemap[2]->set_scrolldy(-yoffs, 0);
57   m_tilemap[0]->set_scrolldx(-xoffs, 0);
58   m_tilemap[1]->set_scrolldx(-xoffs, 0);
59   m_tilemap[2]->set_scrolldx(-xoffs, 0);
60   m_tilemap[0]->set_scrolldy(-yoffs, 0);
61   m_tilemap[1]->set_scrolldy(-yoffs, 0);
62   m_tilemap[2]->set_scrolldy(-yoffs, 0);
6463}
6564
6665void gcpinbal_state::video_start()
6766{
68   gcpinbal_core_vh_start(machine());
67   gcpinbal_core_vh_start();
6968}
7069
7170
r20824r20825
164163
165164****************************************************************/
166165
167static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
166void gcpinbal_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
168167{
169   gcpinbal_state *state = machine.driver_data<gcpinbal_state>();
170   UINT16 *spriteram = state->m_spriteram;
168   UINT16 *spriteram = m_spriteram;
171169   int offs, chain_pos;
172170   int x, y, curx, cury;
173171   int priority = 0;
r20824r20825
175173   UINT16 code;
176174
177175   /* According to Raine, word in ioc_ram determines sprite/tile priority... */
178   priority = (state->m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;
176   priority = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;
179177
180   for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
178   for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
181179   {
182180      code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8);
183181      code &= 0x3fff;
r20824r20825
204202
205203         for (chain_pos = chain; chain_pos >= 0; chain_pos--)
206204         {
207            pdrawgfx_transpen(bitmap, cliprect,machine.gfx[0],
205            pdrawgfx_transpen(bitmap, cliprect,machine().gfx[0],
208206                  code,
209207                  col,
210208                  flipx, flipy,
211209                  curx,cury,
212                  machine.priority_bitmap,
210                  machine().priority_bitmap,
213211                  priority ? 0xfc : 0xf0,0);
214212
215213            code++;
r20824r20825
310308   m_tilemap[layer[2]]->draw(bitmap, cliprect, 0, 4);
311309
312310
313   draw_sprites(machine(), bitmap, cliprect, 16);
311   draw_sprites(bitmap, cliprect, 16);
314312
315313#if 0
316314   {
trunk/src/mame/video/ginganin.c
r20824r20825
203203
204204------------------------------------------------------------------------ */
205205
206static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
206void ginganin_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
207207{
208   ginganin_state *state = machine.driver_data<ginganin_state>();
209   UINT16 *spriteram = state->m_spriteram;
208   UINT16 *spriteram = m_spriteram;
210209   int offs;
211210
212   for (offs = 0; offs < (state->m_spriteram.bytes() >> 1); offs += 4)
211   for (offs = 0; offs < (m_spriteram.bytes() >> 1); offs += 4)
213212   {
214213      int y = spriteram[offs + 0];
215214      int x = spriteram[offs + 1];
r20824r20825
221220      x = (x & 0xff) - (x & 0x100);
222221      y = (y & 0xff) - (y & 0x100);
223222
224      if (state->m_flipscreen)
223      if (m_flipscreen)
225224      {
226225         x = 240 - x;
227226         y = 240 - y;
r20824r20825
229228         flipy = !flipy;
230229      }
231230
232      drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
231      drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
233232            code & 0x3fff,
234233            attr >> 12,
235234            flipx, flipy,
r20824r20825
279278   if (layers_ctrl1 & 2)
280279      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
281280   if (layers_ctrl1 & 8)
282      draw_sprites(machine(), bitmap, cliprect);
281      draw_sprites(bitmap, cliprect);
283282   if (layers_ctrl1 & 4)
284283      m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
285284
trunk/src/mame/video/gaelco.c
r20824r20825
116116      3  | xxxxxxxx xxxxxx-- | sprite code
117117*/
118118
119static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
119void gaelco_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
120120{
121   gaelco_state *state = machine.driver_data<gaelco_state>();
122121   int i, x, y, ex, ey;
123   gfx_element *gfx = machine.gfx[0];
122   gfx_element *gfx = machine().gfx[0];
124123
125124   static const int x_offset[2] = {0x0,0x2};
126125   static const int y_offset[2] = {0x0,0x1};
127126
128127   for (i = 0x800 - 4 - 1; i >= 3; i -= 4)
129128   {
130      int sx = state->m_spriteram[i + 2] & 0x01ff;
131      int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff;
132      int number = state->m_spriteram[i + 3];
133      int color = (state->m_spriteram[i + 2] & 0x7e00) >> 9;
134      int attr = (state->m_spriteram[i] & 0xfe00) >> 9;
135      int priority = (state->m_spriteram[i] & 0x3000) >> 12;
129      int sx = m_spriteram[i + 2] & 0x01ff;
130      int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
131      int number = m_spriteram[i + 3];
132      int color = (m_spriteram[i + 2] & 0x7e00) >> 9;
133      int attr = (m_spriteram[i] & 0xfe00) >> 9;
134      int priority = (m_spriteram[i] & 0x3000) >> 12;
136135
137136      int xflip = attr & 0x20;
138137      int yflip = attr & 0x40;
r20824r20825
170169            pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey],
171170                  color,xflip,yflip,
172171                  sx-0x0f+x*8,sy+y*8,
173                  machine.priority_bitmap,pri_mask,0);
172                  machine().priority_bitmap,pri_mask,0);
174173         }
175174      }
176175   }
r20824r20825
205204   m_tilemap[1]->draw(bitmap, cliprect, 0, 4);
206205   m_tilemap[0]->draw(bitmap, cliprect, 0, 4);
207206
208   draw_sprites(machine(), bitmap, cliprect);
207   draw_sprites(bitmap, cliprect);
209208   return 0;
210209}
211210
r20824r20825
244243   m_tilemap[1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8);
245244   m_tilemap[0]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8);
246245
247   draw_sprites(machine(), bitmap, cliprect);
246   draw_sprites(bitmap, cliprect);
248247   return 0;
249248}
trunk/src/mame/video/gunbustr.c
r20824r20825
5555
5656********************************************************/
5757
58static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
58void gunbustr_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
5959{
60   gunbustr_state *state = machine.driver_data<gunbustr_state>();
61   UINT32 *spriteram32 = state->m_spriteram;
62   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
60   UINT32 *spriteram32 = m_spriteram;
61   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
6362   int offs, data, tilenum, color, flipx, flipy;
6463   int x, y, priority, dblsize, curx, cury;
6564   int sprites_flipscreen = 0;
r20824r20825
6968
7069   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
7170      while processing sprite ram and then draw them all at the end */
72   struct tempsprite *sprite_ptr = state->m_spritelist;
71   struct tempsprite *sprite_ptr = m_spritelist;
7372
74   for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
73   for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
7574   {
7675      data = spriteram32[offs+0];
7776      flipx =    (data & 0x00800000) >> 23;
r20824r20825
166165            }
167166            else
168167            {
169               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
168               drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
170169                     sprite_ptr->code,
171170                     sprite_ptr->color,
172171                     sprite_ptr->flipx,sprite_ptr->flipy,
r20824r20825
181180   }
182181
183182   /* this happens only if primsks != NULL */
184   while (sprite_ptr != state->m_spritelist)
183   while (sprite_ptr != m_spritelist)
185184   {
186185      sprite_ptr--;
187186
188      pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
187      pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
189188            sprite_ptr->code,
190189            sprite_ptr->color,
191190            sprite_ptr->flipx,sprite_ptr->flipy,
192191            sprite_ptr->x,sprite_ptr->y,
193192            sprite_ptr->zoomx,sprite_ptr->zoomy,
194            machine.priority_bitmap,sprite_ptr->primask,0);
193            machine().priority_bitmap,sprite_ptr->primask,0);
195194   }
196195}
197196
r20824r20825
235234   tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2);
236235   tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4);
237236   tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8);    /* text layer */
238   draw_sprites(machine(), bitmap, cliprect, primasks, 48, -116);
237   draw_sprites(bitmap, cliprect, primasks, 48, -116);
239238#endif
240239   return 0;
241240}
trunk/src/mame/video/galivan.c
r20824r20825
294294
295295***************************************************************************/
296296
297static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
297void galivan_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
298298{
299   galivan_state *state = machine.driver_data<galivan_state>();
300   const UINT8 *spritepalettebank = state->memregion("user1")->base();
301   UINT8 *spriteram = state->m_spriteram;
299   const UINT8 *spritepalettebank = memregion("user1")->base();
300   UINT8 *spriteram = m_spriteram;
302301   int offs;
303302
304303   /* draw the sprites */
305   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
304   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
306305   {
307306      int code;
308307      int attr = spriteram[offs + 2];
r20824r20825
313312
314313      sx = (spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01);
315314      sy = 240 - spriteram[offs];
316      if (state->m_flipscreen)
315      if (m_flipscreen)
317316      {
318317         sx = 240 - sx;
319318         sy = 240 - sy;
r20824r20825
324323//      code = spriteram[offs + 1] + ((attr & 0x02) << 7);
325324      code = spriteram[offs + 1] + ((attr & 0x06) << 7);  // for ninjemak, not sure ?
326325
327      drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
326      drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
328327            code,
329328            color + 16 * (spritepalettebank[code >> 2] & 0x0f),
330329            flipx,flipy,
r20824r20825
347346   {
348347      m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
349348      m_tx_tilemap->draw(bitmap, cliprect, 1, 0);
350      draw_sprites(machine(), bitmap, cliprect);
349      draw_sprites(bitmap, cliprect);
351350   }
352351   else
353352   {
354      draw_sprites(machine(), bitmap, cliprect);
353      draw_sprites(bitmap, cliprect);
355354      m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
356355      m_tx_tilemap->draw(bitmap, cliprect, 1, 0);
357356   }
r20824r20825
370369   else
371370      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
372371
373   draw_sprites(machine(), bitmap, cliprect);
372   draw_sprites(bitmap, cliprect);
374373   m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
375374   return 0;
376375}
trunk/src/mame/video/gottlieb.c
r20824r20825
198198 *
199199 *************************************/
200200
201static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
201void gottlieb_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
202202{
203   gottlieb_state *state = machine.driver_data<gottlieb_state>();
204   UINT8 *spriteram = state->m_spriteram;
203   UINT8 *spriteram = m_spriteram;
205204   rectangle clip = cliprect;
206205   int offs;
207206
r20824r20825
215214      /* of level animation. */
216215      int sx = (spriteram[offs + 1]) - 4;
217216      int sy = (spriteram[offs]) - 13;
218      int code = (255 ^ spriteram[offs + 2]) + 256 * state->m_spritebank;
217      int code = (255 ^ spriteram[offs + 2]) + 256 * m_spritebank;
219218
220      if (state->flip_screen_x()) sx = 233 - sx;
221      if (state->flip_screen_y()) sy = 244 - sy;
219      if (flip_screen_x()) sx = 233 - sx;
220      if (flip_screen_y()) sy = 244 - sy;
222221
223222      drawgfx_transpen(bitmap, clip,
224         machine.gfx[2],
223         machine().gfx[2],
225224         code, 0,
226         state->flip_screen_x(), state->flip_screen_y(),
225         flip_screen_x(), flip_screen_y(),
227226         sx,sy, 0);
228227   }
229228}
r20824r20825
245244      bitmap.fill(machine().pens[0], cliprect);
246245
247246   /* draw the sprites */
248   draw_sprites(machine(), bitmap, cliprect);
247   draw_sprites(bitmap, cliprect);
249248
250249   /* if the background has higher priority, render it now */
251250   if (m_background_priority)
trunk/src/mame/video/glass.c
r20824r20825
159159      3  | xxxxxxxx xxxxxxxx | sprite code
160160*/
161161
162static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
162void glass_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
163163{
164   glass_state *state = machine.driver_data<glass_state>();
165164   int i;
166   gfx_element *gfx = machine.gfx[0];
165   gfx_element *gfx = machine().gfx[0];
167166
168167   for (i = 3; i < (0x1000 - 6) / 2; i += 4)
169168   {
170      int sx = state->m_spriteram[i + 2] & 0x01ff;
171      int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff;
172      int number = state->m_spriteram[i + 3];
173      int color = (state->m_spriteram[i + 2] & 0x1e00) >> 9;
174      int attr = (state->m_spriteram[i] & 0xfe00) >> 9;
169      int sx = m_spriteram[i + 2] & 0x01ff;
170      int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
171      int number = m_spriteram[i + 3];
172      int color = (m_spriteram[i + 2] & 0x1e00) >> 9;
173      int attr = (m_spriteram[i] & 0xfe00) >> 9;
175174
176175      int xflip = attr & 0x20;
177176      int yflip = attr & 0x40;
r20824r20825
203202   copybitmap(bitmap, *m_screen_bitmap, 0, 0, 0x18, 0x24, cliprect);
204203   m_pant[1]->draw(bitmap, cliprect, 0, 0);
205204   m_pant[0]->draw(bitmap, cliprect, 0, 0);
206   draw_sprites(machine(), bitmap, cliprect);
205   draw_sprites(bitmap, cliprect);
207206   return 0;
208207}
trunk/src/mame/video/gladiatr.c
r20824r20825
189189
190190***************************************************************************/
191191
192static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
192void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
193193{
194   gladiatr_state *state = machine.driver_data<gladiatr_state>();
195194   int offs;
196195
197196   for (offs = 0;offs < 0x80;offs += 2)
r20824r20825
201200         {0x0,0x1},
202201         {0x2,0x3},
203202      };
204      UINT8 *src = &state->m_spriteram[offs + (state->m_sprite_buffer << 7)];
203      UINT8 *src = &m_spriteram[offs + (m_sprite_buffer << 7)];
205204      int attributes = src[0x800];
206205      int size = (attributes & 0x10) >> 4;
207      int bank = (attributes & 0x01) + ((attributes & 0x02) ? state->m_sprite_bank : 0);
206      int bank = (attributes & 0x01) + ((attributes & 0x02) ? m_sprite_bank : 0);
208207      int tile_number = (src[0]+256*bank);
209208      int sx = src[0x400+1] + 256*(src[0x801]&1) - 0x38;
210209      int sy = 240 - src[0x400] - (size ? 16 : 0);
r20824r20825
213212      int color = src[1] & 0x1f;
214213      int x,y;
215214
216      if (state->flip_screen())
215      if (flip_screen())
217216      {
218217         xflip = !xflip;
219218         yflip = !yflip;
r20824r20825
228227
229228            int t = tile_offset[ey][ex] + tile_number;
230229
231            drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
230            drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
232231                  t,
233232                  color,
234233                  xflip, yflip,
r20824r20825
243242UINT32 gladiatr_state::screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
244243{
245244   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
246   draw_sprites(machine(), bitmap,cliprect);
245   draw_sprites(bitmap,cliprect);
247246
248247   /* the fg layer just selects the upper palette bank on underlying pixels */
249248   {
r20824r20825
290289      m_fg_tilemap->set_scrolly(0, m_fg_scrolly);
291290
292291      m_bg_tilemap->draw(bitmap, cliprect, 0,0);
293      draw_sprites(machine(), bitmap,cliprect);
292      draw_sprites(bitmap,cliprect);
294293      m_fg_tilemap->draw(bitmap, cliprect, 0,0);
295294   }
296295   else
trunk/src/mame/video/groundfx.c
r20824r20825
5959
6060***************************************************************/
6161
62static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs)
62void groundfx_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs)
6363{
64   groundfx_state *state = machine.driver_data<groundfx_state>();
65   UINT32 *spriteram32 = state->m_spriteram;
66   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
64   UINT32 *spriteram32 = m_spriteram;
65   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
6766   int offs, data, tilenum, color, flipx, flipy;
6867   int x, y, priority, dblsize, curx, cury;
6968   int sprites_flipscreen = 0;
r20824r20825
7473
7574   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
7675      while processing sprite ram and then draw them all at the end */
77   struct tempsprite *sprite_ptr = state->m_spritelist;
76   struct tempsprite *sprite_ptr = m_spritelist;
7877
79   for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
78   for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
8079   {
8180      data = spriteram32[offs+0];
8281      flipx =    (data & 0x00800000) >> 23;
r20824r20825
170169   }
171170
172171   /* this happens only if primsks != NULL */
173   while (sprite_ptr != state->m_spritelist)
172   while (sprite_ptr != m_spritelist)
174173   {
175174      const rectangle *clipper;
176175
177176      sprite_ptr--;
178177
179178      if (do_hack && sprite_ptr->pri==1 && sprite_ptr->y<100)
180         clipper=&state->m_hack_cliprect;
179         clipper=&m_hack_cliprect;
181180      else
182181         clipper=&cliprect;
183182
184      pdrawgfxzoom_transpen(bitmap,*clipper,machine.gfx[sprite_ptr->gfx],
183      pdrawgfxzoom_transpen(bitmap,*clipper,machine().gfx[sprite_ptr->gfx],
185184            sprite_ptr->code,
186185            sprite_ptr->color,
187186            sprite_ptr->flipx,sprite_ptr->flipy,
188187            sprite_ptr->x,sprite_ptr->y,
189188            sprite_ptr->zoomx,sprite_ptr->zoomy,
190            machine.priority_bitmap,primasks[sprite_ptr->pri],0);
189            machine().priority_bitmap,primasks[sprite_ptr->pri],0);
191190   }
192191}
193192
r20824r20825
252251
253252      if (tc0480scp_long_r(tc0480scp, space, 0x20 / 4, 0xffffffff) != 0x240866) /* Stupid hack for start of race */
254253         tc0480scp_tilemap_draw(tc0480scp, bitmap, m_hack_cliprect, layer[0], 0, 0);
255      draw_sprites(machine(), bitmap, cliprect, 1, 44, -574);
254      draw_sprites(bitmap, cliprect, 1, 44, -574);
256255   }
257256   else
258257   {
r20824r20825
263262
264263      tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);
265264
266      draw_sprites(machine(), bitmap, cliprect, 0, 44, -574);
265      draw_sprites(bitmap, cliprect, 0, 44, -574);
267266   }
268267
269268   tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0);    /* TC0480SCP text layer */
trunk/src/mame/video/goal92.c
r20824r20825
8484   SET_TILE_INFO_MEMBER(region, tile, color, 0);
8585}
8686
87static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
87void goal92_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
8888{
89   goal92_state *state = machine.driver_data<goal92_state>();
90   UINT16 *buffered_spriteram16 = state->m_buffered_spriteram;
89   UINT16 *buffered_spriteram16 = m_buffered_spriteram;
9190   int offs, fx, fy, x, y, color, sprite;
9291
9392   for (offs = 3; offs <= 0x400 - 5; offs += 4)
r20824r20825
122121
123122      y = 256 - (y + 7);
124123
125      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
124      drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
126125            sprite,
127126            color,fx,fy,x,y,15);
128127   }
r20824r20825
162161   bitmap.fill(get_black_pen(machine()), cliprect);
163162
164163   m_bg_layer->draw(bitmap, cliprect, 0, 0);
165   draw_sprites(machine(), bitmap, cliprect, 2);
164   draw_sprites(bitmap, cliprect, 2);
166165
167166   if (!(m_fg_bank & 0xff))
168      draw_sprites(machine(), bitmap, cliprect, 1);
167      draw_sprites(bitmap, cliprect, 1);
169168
170169   m_fg_layer->draw(bitmap, cliprect, 0, 0);
171170
172171   if(m_fg_bank & 0xff)
173      draw_sprites(machine(), bitmap, cliprect, 1);
172      draw_sprites(bitmap, cliprect, 1);
174173
175   draw_sprites(machine(), bitmap, cliprect, 0);
176   draw_sprites(machine(), bitmap, cliprect, 3);
174   draw_sprites(bitmap, cliprect, 0);
175   draw_sprites(bitmap, cliprect, 3);
177176   m_tx_layer->draw(bitmap, cliprect, 0, 0);
178177   return 0;
179178}
trunk/src/mame/video/bosco.c
r20824r20825
9292}
9393
9494
95INLINE void get_tile_info_bosco(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs)
95inline void bosco_state::get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs)
9696{
97   bosco_state *state =  machine.driver_data<bosco_state>();
98
99   UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
97   UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
10098   tileinfo.category = (attr & 0x20) >> 5;
10199   tileinfo.group = attr & 0x3f;
102   SET_TILE_INFO(
100   SET_TILE_INFO_MEMBER(
103101         0,
104         state->m_videoram[ram_offs + tile_index],
102         m_videoram[ram_offs + tile_index],
105103         attr & 0x3f,
106104         TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX);
107105}
108106
109107TILE_GET_INFO_MEMBER(bosco_state::bg_get_tile_info )
110108{
111   get_tile_info_bosco(machine(),tileinfo,tile_index,0x400);
109   get_tile_info_bosco(tileinfo,tile_index,0x400);
112110}
113111
114112TILE_GET_INFO_MEMBER(bosco_state::fg_get_tile_info )
115113{
116   get_tile_info_bosco(machine(),tileinfo,tile_index,0x000);
114   get_tile_info_bosco(tileinfo,tile_index,0x000);
117115}
118116
119117
r20824r20825
188186
189187***************************************************************************/
190188
191static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
189void bosco_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
192190{
193   bosco_state *state =  machine.driver_data<bosco_state>();
194   UINT8 *spriteram = state->m_spriteram;
195   UINT8 *spriteram_2 = state->m_spriteram2;
191   UINT8 *spriteram = m_spriteram;
192   UINT8 *spriteram_2 = m_spriteram2;
196193   int offs;
197194
198   for (offs = 0;offs < state->m_spriteram_size;offs += 2)
195   for (offs = 0;offs < m_spriteram_size;offs += 2)
199196   {
200197      int sx = spriteram[offs + 1] - 1;
201198      int sy = 240 - spriteram_2[offs];
r20824r20825
203200      int flipy = spriteram[offs] & 2;
204201      int color = spriteram_2[offs + 1] & 0x3f;
205202
206      if (state->flip_screen())
203      if (flip_screen())
207204      {
208205         sx += 128-2;
209206         sy += 8;
210207      }
211208
212      drawgfx_transmask(bitmap,cliprect,machine.gfx[1],
209      drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
213210            (spriteram[offs] & 0xfc) >> 2,
214211            color,
215212            flipx,flipy,
216213            sx,sy,
217            colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f));
214            colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f));
218215   }
219216}
220217
221218
222static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
219void bosco_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
223220{
224   bosco_state *state =  machine.driver_data<bosco_state>();
225221   int offs;
226222
227223   for (offs = 4; offs < 0x10;offs++)
228224   {
229      int x = state->m_bosco_radarx[offs] + ((~state->m_bosco_radarattr[offs] & 0x01) << 8);
230      int y = 253 - state->m_bosco_radary[offs];
225      int x = m_bosco_radarx[offs] + ((~m_bosco_radarattr[offs] & 0x01) << 8);
226      int y = 253 - m_bosco_radary[offs];
231227
232      if (state->flip_screen())
228      if (flip_screen())
233229      {
234230         x += 96-2;
235231         y += 8;
236232      }
237233
238      drawgfx_transmask(bitmap,cliprect,machine.gfx[2],
239            ((state->m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07,
234      drawgfx_transmask(bitmap,cliprect,machine().gfx[2],
235            ((m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07,
240236            0,
241237            0,0,
242238            x,y,0xf0);
r20824r20825
244240}
245241
246242
247static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
243void bosco_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
248244{
249   bosco_state *state = machine.driver_data<bosco_state>();
250
251245   if (1)
252246   {
253247      int star_cntr;
254248      int set_a, set_b;
255249
256250      /* two sets of stars controlled by these bits */
257      set_a = (state->m_bosco_starblink[0] & 1);
258      set_b = (state->m_bosco_starblink[1] & 1) | 2;
251      set_a = (m_bosco_starblink[0] & 1);
252      set_b = (m_bosco_starblink[1] & 1) | 2;
259253
260254      for (star_cntr = 0;star_cntr < MAX_STARS;star_cntr++)
261255      {
r20824r20825
263257
264258         if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
265259         {
266            x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256;
267            y = (star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256;
260            x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256;
261            y = (star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
268262
269263            /* dont draw the stars that are off the screen */
270264            if ( x < 224 )
r20824r20825
298292   }
299293
300294   bitmap.fill(get_black_pen(machine()), cliprect);
301   draw_stars(machine(),bitmap,cliprect,flip_screen());
295   draw_stars(bitmap,cliprect,flip_screen());
302296
303297   m_bg_tilemap->draw(bitmap, bg_clip, 0,0);
304298   m_fg_tilemap->draw(bitmap, fg_clip, 0,0);
305299
306   draw_sprites(machine(), bitmap,cliprect);
300   draw_sprites(bitmap,cliprect);
307301
308302   /* draw the high priority characters */
309303   m_bg_tilemap->draw(bitmap, bg_clip, 1,0);
310304   m_fg_tilemap->draw(bitmap, fg_clip, 1,0);
311305
312   draw_bullets(machine(), bitmap,cliprect);
306   draw_bullets(bitmap,cliprect);
313307
314308   return 0;
315309}
trunk/src/mame/video/galaga.c
r20824r20825
470470
471471***************************************************************************/
472472
473static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
473void galaga_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
474474{
475   galaga_state *state =  machine.driver_data<galaga_state>();
476475
477   UINT8 *spriteram = state->m_galaga_ram1 + 0x380;
478   UINT8 *spriteram_2 = state->m_galaga_ram2 + 0x380;
479   UINT8 *spriteram_3 = state->m_galaga_ram3 + 0x380;
476   UINT8 *spriteram = m_galaga_ram1 + 0x380;
477   UINT8 *spriteram_2 = m_galaga_ram2 + 0x380;
478   UINT8 *spriteram_3 = m_galaga_ram3 + 0x380;
480479   int offs;
481480
482481
r20824r20825
500499      sy -= 16 * sizey;
501500      sy = (sy & 0xff) - 32;  // fix wraparound
502501
503      if (state->flip_screen())
502      if (flip_screen())
504503      {
505504         flipx ^= 1;
506505         flipy ^= 1;
r20824r20825
512511      {
513512         for (x = 0;x <= sizex;x++)
514513         {
515            drawgfx_transmask(bitmap,cliprect,machine.gfx[1],
514            drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
516515               sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
517516               color,
518517               flipx,flipy,
519518               sx + 16*x, sy + 16*y,
520               colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f));
519               colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f));
521520         }
522521      }
523522   }
524523}
525524
526525
527static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
526void galaga_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect )
528527{
529   galaga_state *state =  machine.driver_data<galaga_state>();
530528   /* draw the stars */
531529
532530   /* $a005 controls the stars ON/OFF */
533   if ( (state->m_galaga_starcontrol[5] & 1) == 1 )
531   if ( (m_galaga_starcontrol[5] & 1) == 1 )
534532   {
535533      int y_align = 112; /* 112 is a tweak to get alignment about perfect */
536      int x_align = state->flip_screen() ? 112 : 16;
534      int x_align = flip_screen() ? 112 : 16;
537535
538536      int star_cntr;
539537      int set_a, set_b;
540538
541539      /* two sets of stars controlled by these bits */
542      set_a = (state->m_galaga_starcontrol[3] & 1);
543      set_b = (state->m_galaga_starcontrol[4] & 1) | 2;
540      set_a = (m_galaga_starcontrol[3] & 1);
541      set_b = (m_galaga_starcontrol[4] & 1) | 2;
544542
545543      for (star_cntr = 0;star_cntr < MAX_STARS ;star_cntr++)
546544      {
r20824r20825
548546
549547         if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
550548         {
551            x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256 + x_align;
552            y = (y_align + star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256;
549            x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256 + x_align;
550            y = (y_align + star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
553551
554552            if (cliprect.contains(x, y))
555553               bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col;
r20824r20825
562560UINT32 galaga_state::screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
563561{
564562   bitmap.fill(get_black_pen(machine()), cliprect);
565   draw_stars(machine(),bitmap,cliprect);
566   draw_sprites(machine(),bitmap,cliprect);
563   draw_stars(bitmap,cliprect);
564   draw_sprites(bitmap,cliprect);
567565   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
568566   return 0;
569567}
trunk/src/mame/video/galspnbl.c
r20824r20825
1313
1414
1515
16static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
16void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
1717{
18   galspnbl_state *state = machine.driver_data<galspnbl_state>();
1918   offs_t offs;
2019
21//  int screenscroll = 4 - (state->m_scroll[0] & 0xff);
20//  int screenscroll = 4 - (m_scroll[0] & 0xff);
2221
2322   for (offs = 0; offs < 0x20000; offs++)
2423   {
2524      int y = offs >> 9;
2625      int x = offs & 0x1ff;
2726
28      bitmap.pix16(y, x) = 1024 + (state->m_bgvideoram[offs] >> 1);
27      bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1);
2928   }
3029}
3130
r20824r20825
3433{
3534   int offs;
3635
37   draw_background(machine(), bitmap, cliprect);
36   draw_background(bitmap, cliprect);
3837
3938   galspnbl_draw_sprites(machine(), bitmap, cliprect, 0,  m_spriteram, m_spriteram.bytes());
4039
trunk/src/mame/includes/gsword.h
r20824r20825
4747   DECLARE_PALETTE_INIT(josvolly);
4848   UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4949   INTERRUPT_GEN_MEMBER(gsword_snd_interrupt);
50   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
51   int gsword_coins_in(void);
5052};
trunk/src/mame/includes/gaelco2.h
r20824r20825
5656   DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w);
5757   DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w);
5858   DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w);
59   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs);
60   UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index);
61   void gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2);
5962};
trunk/src/mame/includes/galpanic.h
r20824r20825
2929   void screen_eof_galpanic(screen_device &screen, bool state);
3030   TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline);
3131   TIMER_DEVICE_CALLBACK_MEMBER(galhustl_scanline);
32   void comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
33   void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
3234};
3335
3436/*----------- defined in video/galpanic.c -----------*/
trunk/src/mame/includes/goldstar.h
r20824r20825
150150   UINT32 screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
151151   UINT32 screen_update_unkch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
152152   INTERRUPT_GEN_MEMBER(lucky8_irq);
153   void do_blockswaps(UINT8* ROM);
154   void dump_to_file( UINT8* ROM);
155   UINT8 decrypt(UINT8 cipherText, UINT16 address);
156   UINT8 chry10_decrypt(UINT8 cipherText);
153157};
trunk/src/mame/includes/gotcha.h
r20824r20825
4747   virtual void machine_reset();
4848   virtual void video_start();
4949   UINT32 screen_update_gotcha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
50   inline void get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs);
5051};
trunk/src/mame/includes/gberet.h
r20824r20825
5858   UINT32 screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5959   UINT32 screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6060   TIMER_DEVICE_CALLBACK_MEMBER(gberet_interrupt_tick);
61   void gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
62   void gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
6163};
trunk/src/mame/includes/gotya.h
r20824r20825
3838   virtual void video_start();
3939   virtual void palette_init();
4040   UINT32 screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
41   void draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col );
42   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
43   void draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect );
4144};
trunk/src/mame/includes/gyruss.h
r20824r20825
5656   UINT32 screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5757   INTERRUPT_GEN_MEMBER(master_vblank_irq);
5858   INTERRUPT_GEN_MEMBER(slave_vblank_irq);
59   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx );
5960};
trunk/src/mame/includes/gaelco3d.h
r20824r20825
119119   INTERRUPT_GEN_MEMBER(vblank_gen);
120120   TIMER_CALLBACK_MEMBER(delayed_sound_w);
121121   TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq);
122   void gaelco3d_render(screen_device &screen);
122123};
123
124/*----------- defined in video/gaelco3d.c -----------*/
125
126void gaelco3d_render(screen_device &screen);
trunk/src/mame/includes/galaxian.h
r20824r20825
2727#define GALAXIAN_VBEND          (16)
2828#define GALAXIAN_VBSTART        (224+16)
2929
30/* video extension callbacks */
31typedef void (*galaxian_extend_tile_info_func)(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
32typedef void (*galaxian_extend_sprite_info_func)(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
33typedef void (*galaxian_draw_bullet_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
34typedef void (*galaxian_draw_background_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
3530
36
3731class galaxian_state : public driver_device
3832{
3933public:
r20824r20825
7064   int m_tenspot_current_game;
7165   UINT8 m_frogger_adjust;
7266   UINT8 m_sfx_tilemap;
67   
68   /* video extension callbacks */
69   typedef void (galaxian_state::*galaxian_extend_tile_info_func)(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
70   typedef void (galaxian_state::*galaxian_extend_sprite_info_func)(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
71   typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
72   typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect);
73   
7374   galaxian_extend_tile_info_func m_extend_tile_info_ptr;
7475   galaxian_extend_sprite_info_func m_extend_sprite_info_ptr;
7576   galaxian_draw_bullet_func m_draw_bullet_ptr;
7677   galaxian_draw_background_func m_draw_background_ptr;
78   
7779   tilemap_t *m_bg_tilemap;
7880   UINT8 m_flipscreen_x;
7981   UINT8 m_flipscreen_y;
r20824r20825
230232   INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen);
231233   TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen);
232234   TIMER_DEVICE_CALLBACK_MEMBER(galaxian_stars_blink_timer);
235   void state_save_register();
236   void sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase);
237   void bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base);
238   void stars_init();
239   void stars_update_origin();
240   void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask);
241   void galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
242   void background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped);
243   void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx);
244   void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
245   void anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
246   void jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
247   void turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
248   void frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
249   int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect);
250   void amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
251   inline void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color);
252   void galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
253   void mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
254   void scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
255   void theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
256   void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
257   void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
258   void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
259   void frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
260   void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
261   void gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
262   void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
263   void pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
264   void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
265   void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
266   void mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
267   void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
268   void moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
269   void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
270   void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
271   void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
272   void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
273   void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
274   void monsterz_set_latch();
275   void decode_mooncrst(int length, UINT8 *dest);
276   void decode_checkman();
277   void decode_dingoe();
278   void decode_frogger_sound();
279   void decode_frogger_gfx();
280   void decode_anteater_gfx();
281   void decode_losttomb_gfx();
282   void decode_superbon();
283   void unmap_galaxian_sound(offs_t base);
284   void mshuttle_decode(const UINT8 convtable[8][16]);
285   void common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background,
286      galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info);
233287};
234
235
236/*----------- defined in video/galaxian.c -----------*/
237
238/* special purpose background rendering */
239void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
240void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
241//void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
242void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
243void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
244void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
245void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
246
247/* special purpose bullet rendering */
248void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
249void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
250void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
251void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
252
253/* generic extensions */
254void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
255void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
256
257/* Frogger extensions */
258void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
259void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
260
261/* Ghostmuncher Galaxian extensions */
262void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
263void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
264
265/* Pisces extensions */
266void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
267void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
268
269/* Batman Part 2 extensions */
270void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
271
272/* Moon Cresta extensions */
273void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
274void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
275
276/* Moon Quasar extensions */
277void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
278void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
279
280/* Moon Shuttle extensions */
281void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
282void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
283
284/* Calipso extensions */
285void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
286
287/* Jumpbug extensions */
288void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
289void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
trunk/src/mame/includes/gstriker.h
r20824r20825
9999   DECLARE_VIDEO_START(vgoalsoc);
100100   DECLARE_VIDEO_START(twrldc94);
101101   UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102   void VS920A_init(int numchips);
103   tilemap_t* VS920A_get_tilemap(int numchip);
104   void VS920A_set_pal_base(int numchip, int pal_base);
105   void VS920A_set_gfx_region(int numchip, int gfx_region);
106   void VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority);
107   void MB60553_init(int numchips);
108   void MB60553_set_pal_base(int numchip, int pal_base);
109   void MB60553_set_gfx_region(int numchip, int gfx_region);
110   void MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority);
111   tilemap_t* MB60553_get_tilemap(int numchip);
112   void mcu_init(  );
102113};
103114
104115#endif
trunk/src/mame/includes/grchamp.h
r20824r20825
7575   INTERRUPT_GEN_MEMBER(grchamp_cpu0_interrupt);
7676   INTERRUPT_GEN_MEMBER(grchamp_cpu1_interrupt);
7777   TIMER_CALLBACK_MEMBER(main_to_sub_comm_sync_w);
78   void draw_objects(int y, UINT8 *objdata);
7879};
7980
8081/* Discrete Sound Input Nodes */
trunk/src/mame/includes/gijoe.h
r20824r20825
4747   UINT32 screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4848   INTERRUPT_GEN_MEMBER(gijoe_interrupt);
4949   TIMER_CALLBACK_MEMBER(dmaend_callback);
50   void gijoe_objdma(  );
5051};
5152
5253/*----------- defined in video/gijoe.c -----------*/
trunk/src/mame/includes/gameplan.h
r20824r20825
7979   DECLARE_WRITE8_MEMBER(leprechn_video_command_w);
8080   DECLARE_WRITE_LINE_MEMBER(video_command_trigger_w);
8181   DECLARE_READ8_MEMBER(vblank_r);
82   void gameplan_get_pens( pen_t *pens );
83   void leprechn_get_pens( pen_t *pens );
8284};
8385
8486/*----------- defined in video/gameplan.c -----------*/
trunk/src/mame/includes/galastrm.h
r20824r20825
5151   INTERRUPT_GEN_MEMBER(galastrm_interrupt);
5252   TIMER_CALLBACK_MEMBER(galastrm_interrupt6);
5353   void galastrm_exit();
54   void draw_sprites_pre(int x_offs, int y_offs);
55   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority);
56   void tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip);
5457};
trunk/src/mame/includes/galaxold.h
r20824r20825
5454   UINT8 m_color_mask;
5555   tilemap_t *m_dambustr_tilemap2;
5656   UINT8 *m_dambustr_videoram2;
57   void (*m_modify_charcode)(running_machine &machine, UINT16 *code, UINT8 x);     /* function to call to do character banking */
58   void (*m_modify_spritecode)(running_machine &machine, UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */
59   void (*m_modify_color)(UINT8 *color);   /* function to call to do modify how the color codes map to the PROM */
60   void (*m_modify_ypos)(UINT8*);  /* function to call to do modify how vertical positioning bits are connected */
57   void (galaxold_state::*m_modify_charcode)(UINT16 *code, UINT8 x);     /* function to call to do character banking */
58   void (galaxold_state::*m_modify_spritecode)(UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */
59   void (galaxold_state::*m_modify_color)(UINT8 *color);   /* function to call to do modify how the color codes map to the PROM */
60   void (galaxold_state::*m_modify_ypos)(UINT8*);  /* function to call to do modify how vertical positioning bits are connected */
6161
6262   UINT8 m_timer_adjusted;
6363   UINT8 m_darkplnt_bullet_color;
64   void (*m_draw_bullets)(running_machine &,bitmap_ind16 &,const rectangle &, int, int, int);  /* function to call to draw a bullet */
64   void (galaxold_state::*m_draw_bullets)(bitmap_ind16 &,const rectangle &, int, int, int);  /* function to call to draw a bullet */
6565
6666   UINT8 m_background_enable;
6767   UINT8 m_background_red;
6868   UINT8 m_background_green;
6969   UINT8 m_background_blue;
70   void (*m_draw_background)(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);   /* function to call to draw the background */
70   void (galaxold_state::*m_draw_background)(bitmap_ind16 &bitmap, const rectangle &cliprect);   /* function to call to draw the background */
7171   UINT16 m_rockclim_v;
7272   UINT16 m_rockclim_h;
7373   int m_dambustr_bg_split_line;
r20824r20825
7777   int m_dambustr_char_bank;
7878   bitmap_ind16 *m_dambustr_tmpbitmap;
7979
80   void (*m_draw_stars)(running_machine &machine, bitmap_ind16 &, const rectangle &);      /* function to call to draw the star layer */
80   void (galaxold_state::*m_draw_stars)(bitmap_ind16 &, const rectangle &);      /* function to call to draw the star layer */
8181   int m_stars_colors_start;
8282   INT32 m_stars_scrollpos;
8383   UINT8 m_stars_on;
r20824r20825
188188   DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback);
189189   DECLARE_VIDEO_START(bagmanmc);
190190   IRQ_CALLBACK_MEMBER(hunchbkg_irq_callback);
191   void state_save_register();
192   void video_start_common();
193   void pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
194   void theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
195   void mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
196   void batman2_modify_charcode(UINT16 *code, UINT8 x);
197   void rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
198   void rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
199   void harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
200   void mooncrst_modify_charcode(UINT16 *code, UINT8 x);
201   void pisces_modify_charcode(UINT16 *code, UINT8 x);
202   void mimonkey_modify_charcode(UINT16 *code, UINT8 x);
203   void mariner_modify_charcode(UINT16 *code, UINT8 x);
204   void dambustr_modify_charcode(UINT16 *code, UINT8 x);
205   void mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
206   void mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
207   void batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
208   void dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
209   void ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
210   void dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
211   void drivfrcg_modify_color(UINT8 *color);
212   void galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
213   void scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
214   void darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
215   void dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
216   void galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
217   void scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
218   void ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
219   void stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
220   void minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
221   void rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
222   void mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
223   void dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
224   void dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
225   void galaxold_init_stars(int colors_offset);
226   void plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect);
227   void noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
228   void galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
229   void scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
230   void rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
231   void mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
232   void start_stars_blink_timer(double ra, double rb, double c);
233   void start_stars_scroll_timer();
234   void draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect);
235   void draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size);
236   void bagmanmc_modify_charcode(UINT16 *code, UINT8 x);
237   void bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
238   void machine_reset_common(int line);
239   UINT8 decode_mooncrst(UINT8 data,offs_t addr);
191240};
192241
193/*----------- defined in video/galaxold.c -----------*/
194void galaxold_init_stars(running_machine &machine, int colors_offset);
195void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
196
197242#define galaxold_coin_counter_0_w galaxold_coin_counter_w
198243
199244#endif
trunk/src/mame/includes/gng.h
r20824r20825
4343   virtual void machine_reset();
4444   virtual void video_start();
4545   UINT32 screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
46   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4647};
trunk/src/mame/includes/gaplus.h
r20824r20825
5151   INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq);
5252   INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq);
5353   TIMER_CALLBACK_MEMBER(namcoio_run);
54   void starfield_init();
55   void starfield_render(bitmap_ind16 &bitmap);
56   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
5457};
trunk/src/mame/includes/gaiden.h
r20824r20825
8888   UINT32 screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
8989   UINT32 screen_update_drgnbowl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9090   UINT32 screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
91   void drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
92   void descramble_drgnbowl_gfx();
93   void descramble_mastninj_gfx(UINT8* src);
94   void blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
95      int sx,int sy,const rectangle &cliprect);
9196};
trunk/src/mame/includes/gunsmoke.h
r20824r20825
4141   virtual void video_start();
4242   virtual void palette_init();
4343   UINT32 screen_update_gunsmoke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4445};
trunk/src/mame/includes/gcpinbal.h
r20824r20825
6262   INTERRUPT_GEN_MEMBER(gcpinbal_interrupt);
6363   TIMER_CALLBACK_MEMBER(gcpinbal_interrupt1);
6464   TIMER_CALLBACK_MEMBER(gcpinbal_interrupt3);
65   void gcpinbal_core_vh_start(  );
66   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs );
6567};
trunk/src/mame/includes/ginganin.h
r20824r20825
4646   virtual void machine_reset();
4747   virtual void video_start();
4848   UINT32 screen_update_ginganin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
49   void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
4950};
trunk/src/mame/includes/gunbustr.h
r20824r20825
4242   UINT32 screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4343   INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
4444   TIMER_CALLBACK_MEMBER(gunbustr_interrupt5);
45   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
4546};
trunk/src/mame/includes/gridlee.h
r20824r20825
6161   TIMER_CALLBACK_MEMBER(firq_off_tick);
6262   TIMER_CALLBACK_MEMBER(firq_timer_tick);
6363   void expand_pixels();
64   void poly17_init();
6465};
6566
6667
trunk/src/mame/includes/gaelco.h
r20824r20825
4141   DECLARE_VIDEO_START(maniacsq);
4242   UINT32 screen_update_bigkarnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4343   UINT32 screen_update_maniacsq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4445};
trunk/src/mame/includes/galivan.h
r20824r20825
5858   DECLARE_VIDEO_START(ninjemak);
5959   UINT32 screen_update_galivan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6060   UINT32 screen_update_ninjemak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
6162};
6263
6364/*----------- defined in video/galivan.c -----------*/
trunk/src/mame/includes/gottlieb.h
r20824r20825
314314   TIMER_CALLBACK_MEMBER(laserdisc_bit_off_callback);
315315   TIMER_CALLBACK_MEMBER(laserdisc_bit_callback);
316316   TIMER_CALLBACK_MEMBER(nmi_clear);
317   void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
318   inline void audio_end_state();
319   void audio_process_clock(int logit);
320   void audio_handle_zero_crossing(attotime zerotime, int logit);
317321};
318322
319323/*----------- defined in audio/gottlieb.c -----------*/
trunk/src/mame/includes/gladiatr.h
r20824r20825
6666   DECLARE_VIDEO_START(gladiatr);
6767   UINT32 screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6868   UINT32 screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
69   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
70   void swap_block(UINT8 *src1,UINT8 *src2,int len);
6971};
trunk/src/mame/includes/groundfx.h
r20824r20825
4040   UINT32 screen_update_groundfx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4141   INTERRUPT_GEN_MEMBER(groundfx_interrupt);
4242   TIMER_CALLBACK_MEMBER(groundfx_interrupt5);
43   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs);
4344};
trunk/src/mame/includes/goal92.h
r20824r20825
5353   virtual void video_start();
5454   UINT32 screen_update_goal92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5555   void screen_eof_goal92(screen_device &screen, bool state);
56   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
5657};
trunk/src/mame/includes/glass.h
r20824r20825
4848   virtual void video_start();
4949   UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5050   INTERRUPT_GEN_MEMBER(glass_interrupt);
51   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
52   void glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
5153};
trunk/src/mame/includes/galaga.h
r20824r20825
6161   INTERRUPT_GEN_MEMBER(main_vblank_irq);
6262   INTERRUPT_GEN_MEMBER(sub_vblank_irq);
6363   TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback);
64   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
65   void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect );
66   void bosco_latch_reset();
6467};
6568
6669class xevious_state : public galaga_state
r20824r20825
98101   UINT32 screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
99102   INTERRUPT_GEN_MEMBER(battles_interrupt_4);
100103   TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate);
104   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
101105};
102106
103107
r20824r20825
129133   DECLARE_PALETTE_INIT(bosco);
130134   UINT32 screen_update_bosco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
131135   void screen_eof_bosco(screen_device &screen, bool state);
136   
137   inline void get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs);
138   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
139   void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
140   void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip);   
132141};
133142
134143class digdug_state : public galaga_state
r20824r20825
155164   DECLARE_VIDEO_START(digdug);
156165   DECLARE_PALETTE_INIT(digdug);
157166   UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
167   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
158168};
159169
160170/*----------- defined in video/bosco.c -----------*/
trunk/src/mame/includes/galspnbl.h
r20824r20825
3232   virtual void machine_start();
3333   virtual void palette_init();
3434   UINT32 screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
35   void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
3536};
trunk/src/mame/includes/goindol.h
r20824r20825
4848   virtual void machine_reset();
4949   virtual void video_start();
5050   UINT32 screen_update_goindol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram );
5152};
trunk/src/mame/includes/galpani2.h
r20824r20825
5353   UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5454   TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1);
5555   TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2);
56   void galpani2_mcu_nmi1();
57   void galpani2_mcu_nmi2();
5658};
5759
5860

Previous 199869 Revisions Next


© 1997-2024 The MAME Team