Previous 199869 Revisions Next

r21028 Wednesday 13th February, 2013 at 13:43:43 UTC by Miodrag Milanović
Modernization of drivers part 23 (no whatsnew)
[src/mame/drivers]cham24.c clayshoo.c dacholer.c discoboy.c dominob.c dreamwld.c drtomy.c ettrivia.c famibox.c galaxi.c gamecstl.c gpworld.c jollyjgr.c littlerb.c midqslvr.c mirax.c mjsister.c mlanding.c neoprint.c nexus3d.c nyny.c onetwo.c panicr.c savquest.c segald.c sliver.c srmp6.c ssfindo.c taitowlf.c thayers.c voyager.c xtom3d.c

trunk/src/mame/drivers/jollyjgr.c
r21027r21028
142142   UINT32 screen_update_jollyjgr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
143143   UINT32 screen_update_fspider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
144144   INTERRUPT_GEN_MEMBER(jollyjgr_interrupt);
145   void draw_bitmap( bitmap_ind16 &bitmap );
145146};
146147
147148
r21027r21028
456457   m_bg_tilemap->set_scroll_cols(32);
457458}
458459
459static void draw_bitmap( running_machine &machine, bitmap_ind16 &bitmap )
460void jollyjgr_state::draw_bitmap( bitmap_ind16 &bitmap )
460461{
461   jollyjgr_state *state = machine.driver_data<jollyjgr_state>();
462462   int x, y, count;
463463   int i, bit0, bit1, bit2;
464464   int color;
r21027r21028
470470      {
471471         for(i = 0; i < 8; i++)
472472         {
473            bit0 = (state->m_bitmap[count] >> i) & 1;
474            bit1 = (state->m_bitmap[count + 0x2000] >> i) & 1;
475            bit2 = (state->m_bitmap[count + 0x4000] >> i) & 1;
473            bit0 = (m_bitmap[count] >> i) & 1;
474            bit1 = (m_bitmap[count + 0x2000] >> i) & 1;
475            bit2 = (m_bitmap[count + 0x4000] >> i) & 1;
476476            color = bit0 | (bit1 << 1) | (bit2 << 2);
477477
478478            if(color)
479479            {
480               if(state->m_flip_x && state->m_flip_y)
480               if(m_flip_x && m_flip_y)
481481                  bitmap.pix16(y, x * 8 + i) = color + 32;
482               else if(state->m_flip_x && !state->m_flip_y)
482               else if(m_flip_x && !m_flip_y)
483483                  bitmap.pix16(255 - y, x * 8 + i) = color + 32;
484               else if(!state->m_flip_x && state->m_flip_y)
484               else if(!m_flip_x && m_flip_y)
485485                  bitmap.pix16(y, 255 - x * 8 - i) = color + 32;
486486               else
487487                  bitmap.pix16(255 - y, 255 - x * 8 - i) = color + 32;
r21027r21028
503503   if(m_pri) //used in Frog & Spiders level 3
504504   {
505505      if(!(m_bitmap_disable))
506         draw_bitmap(machine(), bitmap);
506         draw_bitmap(bitmap);
507507
508508      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
509509   }
r21027r21028
512512      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
513513
514514      if(!(m_bitmap_disable))
515         draw_bitmap(machine(), bitmap);
515         draw_bitmap(bitmap);
516516   }
517517
518518   /* Sprites are the same as in Galaxian */
trunk/src/mame/drivers/gamecstl.c
r21027r21028
121121   virtual void video_start();
122122   UINT32 screen_update_gamecstl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
123123   IRQ_CALLBACK_MEMBER(irq_callback);
124   void draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y);
125   void intel82439tx_init();
124126};
125127
126128
r21027r21028
139141      palette_set_color(machine(), i, cga_palette[i]);
140142}
141143
142static void draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
144void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
143145{
144146   int i,j;
145147   const UINT8 *dp;
r21027r21028
232234   state->m_mxtc_config_reg[reg] = data;
233235}
234236
235static void intel82439tx_init(running_machine &machine)
237void gamecstl_state::intel82439tx_init()
236238{
237   gamecstl_state *state = machine.driver_data<gamecstl_state>();
238   state->m_mxtc_config_reg[0x60] = 0x02;
239   state->m_mxtc_config_reg[0x61] = 0x02;
240   state->m_mxtc_config_reg[0x62] = 0x02;
241   state->m_mxtc_config_reg[0x63] = 0x02;
242   state->m_mxtc_config_reg[0x64] = 0x02;
243   state->m_mxtc_config_reg[0x65] = 0x02;
239   m_mxtc_config_reg[0x60] = 0x02;
240   m_mxtc_config_reg[0x61] = 0x02;
241   m_mxtc_config_reg[0x62] = 0x02;
242   m_mxtc_config_reg[0x63] = 0x02;
243   m_mxtc_config_reg[0x64] = 0x02;
244   m_mxtc_config_reg[0x65] = 0x02;
244245}
245246
246247static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
759760
760761   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int);
761762
762   intel82439tx_init(machine());
763   intel82439tx_init();
763764
764765   kbdc8042_init(machine(), &at8042);
765766}
trunk/src/mame/drivers/famibox.c
r21027r21028
112112   UINT32 screen_update_famibox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
113113   TIMER_CALLBACK_MEMBER(famicombox_attract_timer_callback);
114114   TIMER_CALLBACK_MEMBER(famicombox_gameplay_timer_callback);
115   void set_mirroring(famibox_state *state, int mirroring);
116   void famicombox_bankswitch(UINT8 bank);
117   void famicombox_reset();
115118};
116119
117120/******************************************************
r21027r21028
121124*******************************************************/
122125
123126#if 0
124static void set_mirroring(famibox_state *state, int mirroring)
127void famibox_state::set_mirroring(famibox_state *state, int mirroring)
125128{
126129   switch(mirroring)
127130   {
128131   case PPU_MIRROR_LOW:
129      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram;
132      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram;
130133      break;
131134   case PPU_MIRROR_HIGH:
132      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram + 0x400;
135      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram + 0x400;
133136      break;
134137   case PPU_MIRROR_HORZ:
135      state->m_nt_page[0] = state->m_nt_ram;
136      state->m_nt_page[1] = state->m_nt_ram;
137      state->m_nt_page[2] = state->m_nt_ram + 0x400;
138      state->m_nt_page[3] = state->m_nt_ram + 0x400;
138      m_nt_page[0] = m_nt_ram;
139      m_nt_page[1] = m_nt_ram;
140      m_nt_page[2] = m_nt_ram + 0x400;
141      m_nt_page[3] = m_nt_ram + 0x400;
139142      break;
140143   case PPU_MIRROR_VERT:
141      state->m_nt_page[0] = state->m_nt_ram;
142      state->m_nt_page[1] = state->m_nt_ram + 0x400;
143      state->m_nt_page[2] = state->m_nt_ram;
144      state->m_nt_page[3] = state->m_nt_ram + 0x400;
144      m_nt_page[0] = m_nt_ram;
145      m_nt_page[1] = m_nt_ram + 0x400;
146      m_nt_page[2] = m_nt_ram;
147      m_nt_page[3] = m_nt_ram + 0x400;
145148      break;
146149   case PPU_MIRROR_NONE:
147150   default:
148      state->m_nt_page[0] = state->m_nt_ram;
149      state->m_nt_page[1] = state->m_nt_ram + 0x400;
150      state->m_nt_page[2] = state->m_nt_ram + 0x800;
151      state->m_nt_page[3] = state->m_nt_ram + 0xc00;
151      m_nt_page[0] = m_nt_ram;
152      m_nt_page[1] = m_nt_ram + 0x400;
153      m_nt_page[2] = m_nt_ram + 0x800;
154      m_nt_page[3] = m_nt_ram + 0xc00;
152155      break;
153156   }
154157}
r21027r21028
234237   System
235238
236239*******************************************************/
237static void famicombox_bankswitch(running_machine &machine, UINT8 bank)
240void famibox_state::famicombox_bankswitch(UINT8 bank)
238241{
239242   struct
240243   {
r21027r21028
263266      { 0x00, "menu",         0, 0x4000, 0x8000 },
264267   };
265268
266//  famibox_state *state = machine.driver_data<famibox_state>();
267269
268270   for (int i = 0; i < sizeof(famicombox_banks)/sizeof(famicombox_banks[0]); i++ )
269271   {
270272      if ( bank == famicombox_banks[i].bank ||
271273            famicombox_banks[i].bank == 0 )
272274      {
273         machine.root_device().membank("cpubank1")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
274         machine.root_device().membank("cpubank2")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
275         machine.root_device().membank("ppubank1")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
275         machine().root_device().membank("cpubank1")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
276         machine().root_device().membank("cpubank2")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
277         machine().root_device().membank("ppubank1")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
276278         break;
277279      }
278280   }
279281}
280282
281static void famicombox_reset(running_machine &machine)
283void famibox_state::famicombox_reset()
282284{
283   famicombox_bankswitch(machine, 0);
284   machine.device("maincpu")->reset();
285   famicombox_bankswitch(0);
286   machine().device("maincpu")->reset();
285287}
286288
287289TIMER_CALLBACK_MEMBER(famibox_state::famicombox_attract_timer_callback)
r21027r21028
290292   if ( BIT(m_exception_mask,1) )
291293   {
292294      m_exception_cause &= ~0x02;
293      famicombox_reset(machine());
295      famicombox_reset();
294296   }
295297}
296298
r21027r21028
305307      if ( BIT(m_exception_mask,4) )
306308      {
307309         m_exception_cause &= ~0x10;
308         famicombox_reset(machine());
310         famicombox_reset();
309311      }
310312   }
311313}
r21027r21028
371373         break;
372374      case 4:
373375         logerror("%s: bankswitch %x\n", machine().describe_context(), data );
374         famicombox_bankswitch(machine(), data & 0x3f);
376         famicombox_bankswitch(data & 0x3f);
375377         break;
376378      default:
377379         logerror("%s: Unhandled famibox_system_w(%x,%02x)\n", machine().describe_context(), offset, data );
r21027r21028
410412   if ( BIT(m_exception_mask, 3) )
411413   {
412414      m_exception_cause &= ~0x08;
413      famicombox_reset(machine());
415      famicombox_reset();
414416   }
415417}
416418
r21027r21028
427429      if ( BIT(m_exception_mask,4) && (m_coins == 1) )
428430      {
429431         m_exception_cause &= ~0x10;
430         famicombox_reset(machine());
432         famicombox_reset();
431433      }
432434   }
433435}
r21027r21028
549551
550552void famibox_state::machine_reset()
551553{
552   famicombox_bankswitch(machine(), 0);
554   famicombox_bankswitch(0);
553555}
554556
555557void famibox_state::machine_start()
r21027r21028
563565   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(famibox_state::famibox_nt_r), this), write8_delegate(FUNC(famibox_state::famibox_nt_w), this));
564566   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "ppubank1");
565567
566   famicombox_bankswitch(machine(), 0);
568   famicombox_bankswitch(0);
567569
568570
569571   m_attract_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_attract_timer_callback),this));
trunk/src/mame/drivers/discoboy.c
r21027r21028
8787   virtual void machine_reset();
8888   virtual void video_start();
8989   UINT32 screen_update_discoboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
90   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
91   void discoboy_setrombank( UINT8 data );
9092};
9193
9294
r21027r21028
9597{
9698}
9799
98static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
100void discoboy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
99101{
100   discoboy_state *state = machine.driver_data<discoboy_state>();
101102   int flipscreen = 0;
102103   int offs, sx, sy;
103104
104105   for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20)
105106   {
106      int code = state->m_ram_4[offs];
107      int attr = state->m_ram_4[offs + 1];
107      int code = m_ram_4[offs];
108      int attr = m_ram_4[offs + 1];
108109      int color = attr & 0x0f;
109      sx = state->m_ram_4[offs + 3] + ((attr & 0x10) << 4);
110      sy = ((state->m_ram_4[offs + 2] + 8) & 0xff) - 8;
110      sx = m_ram_4[offs + 3] + ((attr & 0x10) << 4);
111      sy = ((m_ram_4[offs + 2] + 8) & 0xff) - 8;
111112      code += (attr & 0xe0) << 3;
112113
113114      if (code >= 0x400)
114115      {
115         if ((state->m_gfxbank & 0x30) == 0x00)
116         if ((m_gfxbank & 0x30) == 0x00)
116117         {
117118            code = 0x400 + (code & 0x3ff);
118119         }
119         else if ((state->m_gfxbank & 0x30) == 0x10)
120         else if ((m_gfxbank & 0x30) == 0x10)
120121         {
121122            code = 0x400 + (code & 0x3ff) + 0x400;
122123         }
123         else if ((state->m_gfxbank & 0x30) == 0x20)
124         else if ((m_gfxbank & 0x30) == 0x20)
124125         {
125126            code = 0x400 + (code & 0x3ff) + 0x800;
126127         }
127         else if ((state->m_gfxbank & 0x30) == 0x30)
128         else if ((m_gfxbank & 0x30) == 0x30)
128129         {
129130            code = 0x400 + (code & 0x3ff) + 0xc00;
130131         }
131132         else
132133         {
133            code = machine.rand();
134            code = machine().rand();
134135         }
135136      }
136137
137      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
138      drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
138139               code,
139140               color,
140141               flipscreen,0,
r21027r21028
196197      }
197198   }
198199
199   draw_sprites(machine(), bitmap, cliprect);
200   draw_sprites(bitmap, cliprect);
200201
201202   return 0;
202203}
203204
204205#ifdef UNUSED_FUNCTION
205void discoboy_setrombank( running_machine &machine, UINT8 data )
206void discoboy_state::discoboy_setrombank( UINT8 data )
206207{
207   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
208   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
208209   data &= 0x2f;
209210   space.machine().root_device().membank("bank1")->set_base(&ROM[0x6000 + (data * 0x1000)] );
210211}
trunk/src/mame/drivers/littlerb.c
r21027r21028
8585#include "video/ramdac.h"
8686#include "sound/dac.h"
8787
88static void littlerb_draw_sprites(running_machine &machine);
89
9088class littlerb_state : public driver_device
9189{
9290public:
r21027r21028
173171
174172      }
175173
176      littlerb_draw_sprites(space.machine());
174      littlerb_draw_sprites();
177175
178176
179177      m_listoffset = 0;
r21027r21028
203201   virtual void video_start();
204202   UINT32 screen_update_littlerb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
205203   TIMER_DEVICE_CALLBACK_MEMBER(littlerb_scanline);
204   void littlerb_recalc_regs();
205   UINT16 littlerb_data_read(UINT16 mem_mask);
206   void littlerb_data_write(UINT16 data, UINT16 mem_mask);
207   void littlerb_recalc_address();
208   UINT8 sound_data_shift();
209   void draw_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int xsize,int ysize, UINT32 fulloffs, int xpos, int ypos );
210   void littlerb_draw_sprites();
206211};
207212
208213
r21027r21028
291296/* end VDP device to give us our own memory map */
292297
293298
294static void littlerb_recalc_regs(running_machine &machine)
299void littlerb_state::littlerb_recalc_regs()
295300{
296   littlerb_state *state = machine.driver_data<littlerb_state>();
297   state->m_vdp_address_low = state->m_write_address&0xffff;
298   state->m_vdp_address_high = (state->m_write_address>>16)&0xffff;
301   m_vdp_address_low = m_write_address&0xffff;
302   m_vdp_address_high = (m_write_address>>16)&0xffff;
299303}
300304
301305
302static UINT16 littlerb_data_read(running_machine &machine, UINT16 mem_mask)
306UINT16 littlerb_state::littlerb_data_read(UINT16 mem_mask)
303307{
304   littlerb_state *state = machine.driver_data<littlerb_state>();
305   UINT32 addr = state->m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
306   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
308   UINT32 addr = m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
309   address_space &vdp_space = machine().device<littlerb_vdp_device>("littlerbvdp")->space();
307310
308311   return vdp_space.read_word(addr, mem_mask);
309312}
310313
311static void littlerb_data_write(running_machine &machine, UINT16 data, UINT16 mem_mask)
314void littlerb_state::littlerb_data_write(UINT16 data, UINT16 mem_mask)
312315{
313   littlerb_state *state = machine.driver_data<littlerb_state>();
314   UINT32 addr = state->m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
315   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
316   int mode = state->m_vdp_writemode;
316   UINT32 addr = m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
317   address_space &vdp_space = machine().device<littlerb_vdp_device>("littlerbvdp")->space();
318   int mode = m_vdp_writemode;
317319
318320
319   logerror("mode %04x, data %04x, mem_mask %04x (address %08x)\n", mode,  data, mem_mask, state->m_write_address >> 3);
321   logerror("mode %04x, data %04x, mem_mask %04x (address %08x)\n", mode,  data, mem_mask, m_write_address >> 3);
320322
321323   if ((mode!=0x3800) && (mode !=0x2000) && (mode != 0xe000) && (mode != 0xf800))
322324   {
r21027r21028
327329
328330      // 2000 is used for palette writes which appears to be a RAMDAC, no auto-inc.
329331      //  1ff80806 is our 'spritelist'
330      if (mode!=0x2000 && mode != 0xe000 && addr != 0x1ff80806) state->m_write_address+=0x10;
331      littlerb_recalc_regs(machine);
332      if (mode!=0x2000 && mode != 0xe000 && addr != 0x1ff80806) m_write_address+=0x10;
333      littlerb_recalc_regs();
332334   }
333335
334336
r21027r21028
339341
340342
341343
342static void littlerb_recalc_address(running_machine &machine)
344void littlerb_state::littlerb_recalc_address()
343345{
344   littlerb_state *state = machine.driver_data<littlerb_state>();
345   state->m_write_address = state->m_vdp_address_low | state->m_vdp_address_high<<16;
346   m_write_address = m_vdp_address_low | m_vdp_address_high<<16;
346347}
347348
348349READ16_MEMBER(littlerb_state::littlerb_vdp_r)
r21027r21028
354355   {
355356      case 0: res = m_vdp_address_low; break;
356357      case 1: res = m_vdp_address_high; break;
357      case 2: res = littlerb_data_read(machine(), mem_mask); break;
358      case 2: res = littlerb_data_read(mem_mask); break;
358359      case 3: res = m_vdp_writemode; break;
359360   }
360361
r21027r21028
405406   {
406407      case 0:
407408         COMBINE_DATA(&m_vdp_address_low);
408         littlerb_recalc_address(machine());
409         littlerb_recalc_address();
409410      break;
410411
411412      case 1:
412413         COMBINE_DATA(&m_vdp_address_high);
413         littlerb_recalc_address(machine());
414         littlerb_recalc_address();
414415      break;
415416
416417
417418      case 2:
418      littlerb_data_write(machine(), data, mem_mask);
419      littlerb_data_write(data, mem_mask);
419420      break;
420421
421422      case 3:
r21027r21028
429430}
430431
431432/* could be slightly different (timing wise, directly related to the irqs), but certainly they smoked some bad pot for this messy way ... */
432static UINT8 sound_data_shift(running_machine &machine)
433UINT8 littlerb_state::sound_data_shift()
433434{
434   return ((machine.primary_screen->frame_number() % 16) == 0) ? 8 : 0;
435   return ((machine().primary_screen->frame_number() % 16) == 0) ? 8 : 0;
435436}
436437
437438/* l is SFX, r is BGM (they doesn't seem to share the same data ROM) */
438439WRITE16_MEMBER(littlerb_state::littlerb_l_sound_w)
439440{
440   m_sound_index_l = (data >> sound_data_shift(machine())) & 0xff;
441   m_sound_index_l = (data >> sound_data_shift()) & 0xff;
441442   m_sound_pointer_l = 0;
442443   //popmessage("%04x %04x",m_sound_index_l,m_sound_index_r);
443444}
444445
445446WRITE16_MEMBER(littlerb_state::littlerb_r_sound_w)
446447{
447   m_sound_index_r = (data >> sound_data_shift(machine())) & 0xff;
448   m_sound_index_r = (data >> sound_data_shift()) & 0xff;
448449   m_sound_pointer_r = 0;
449450   //popmessage("%04x %04x",m_sound_index_l,m_sound_index_r);
450451}
r21027r21028
606607
607608
608609
609static void draw_sprite(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int xsize,int ysize, UINT32 fulloffs, int xpos, int ypos )
610void littlerb_state::draw_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, int xsize,int ysize, UINT32 fulloffs, int xpos, int ypos )
610611{
611612   int x,y;
612613   fulloffs >>= 3;
613   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
614   address_space &vdp_space = machine().device<littlerb_vdp_device>("littlerbvdp")->space();
614615
615616   for (y=0;y<ysize;y++)
616617   {
r21027r21028
643644   }
644645}
645646
646static void littlerb_draw_sprites(running_machine &machine)
647void littlerb_state::littlerb_draw_sprites()
647648{
648   littlerb_state *state = machine.driver_data<littlerb_state>();
649649   int x,y,offs;
650650   int xsize,ysize;
651   UINT16* spriteregion = state->m_spritelist;
651   UINT16* spriteregion = m_spritelist;
652652   //littlerb_printf("frame\n");
653653
654654   int layer = 0;
655655   int yoffset = 0;
656656
657   littlerb_printf("m_listoffset %04x\n", state->m_listoffset );
657   littlerb_printf("m_listoffset %04x\n", m_listoffset );
658658
659659   littlerb_printf("%04x %04x %04x %04x\n", spriteregion[0], spriteregion[1], spriteregion[2], spriteregion[3]);
660660
r21027r21028
663663   int minx = 0 , maxx = 0x14f;
664664   int miny = 0 , maxy = 0x11f;
665665
666   for (offs=0;offs<(state->m_listoffset);)
666   for (offs=0;offs<(m_listoffset);)
667667   {
668668      UINT32 read_dword = ((spriteregion[offs+1])<<16)+ (spriteregion[offs+0]);
669669
r21027r21028
694694         if (spriteregion[offs+4]==0x6000)
695695         {
696696            if (spriteregion[offs+3] & 0x1000)
697               state->m_temp_bitmap_sprites_back->fill(0, state->m_temp_bitmap_sprites_back->cliprect());
697               m_temp_bitmap_sprites_back->fill(0, m_temp_bitmap_sprites_back->cliprect());
698698         }
699699         else
700700         {
701            if (spriteregion[offs+1] != 0xffd6) state->m_temp_bitmap_sprites->fill(0, state->m_temp_bitmap_sprites->cliprect());
701            if (spriteregion[offs+1] != 0xffd6) m_temp_bitmap_sprites->fill(0, m_temp_bitmap_sprites->cliprect());
702702         }
703703
704704
r21027r21028
781781         // used between levels, and on boss death to clip sprite at the ground for sinking effect
782782
783783
784         if (clip.min_x > state->m_temp_bitmap_sprites->cliprect().max_x)
785            clip.min_x =  state->m_temp_bitmap_sprites->cliprect().max_x;
784         if (clip.min_x > m_temp_bitmap_sprites->cliprect().max_x)
785            clip.min_x =  m_temp_bitmap_sprites->cliprect().max_x;
786786
787         if (clip.min_x < state->m_temp_bitmap_sprites->cliprect().min_x)
788            clip.min_x =  state->m_temp_bitmap_sprites->cliprect().min_x;
787         if (clip.min_x < m_temp_bitmap_sprites->cliprect().min_x)
788            clip.min_x =  m_temp_bitmap_sprites->cliprect().min_x;
789789
790         if (clip.max_x > state->m_temp_bitmap_sprites->cliprect().max_x)
791            clip.max_x =  state->m_temp_bitmap_sprites->cliprect().max_x;
790         if (clip.max_x > m_temp_bitmap_sprites->cliprect().max_x)
791            clip.max_x =  m_temp_bitmap_sprites->cliprect().max_x;
792792
793         if (clip.max_x < state->m_temp_bitmap_sprites->cliprect().min_x)
794            clip.max_x =  state->m_temp_bitmap_sprites->cliprect().min_x;
793         if (clip.max_x < m_temp_bitmap_sprites->cliprect().min_x)
794            clip.max_x =  m_temp_bitmap_sprites->cliprect().min_x;
795795
796796
797         if (clip.min_y > state->m_temp_bitmap_sprites->cliprect().max_y)
798            clip.min_y =  state->m_temp_bitmap_sprites->cliprect().max_y;
797         if (clip.min_y > m_temp_bitmap_sprites->cliprect().max_y)
798            clip.min_y =  m_temp_bitmap_sprites->cliprect().max_y;
799799
800         if (clip.min_y < state->m_temp_bitmap_sprites->cliprect().min_y)
801            clip.min_y =  state->m_temp_bitmap_sprites->cliprect().min_y;
800         if (clip.min_y < m_temp_bitmap_sprites->cliprect().min_y)
801            clip.min_y =  m_temp_bitmap_sprites->cliprect().min_y;
802802
803         if (clip.max_y > state->m_temp_bitmap_sprites->cliprect().max_y)
804            clip.max_y =  state->m_temp_bitmap_sprites->cliprect().max_y;
803         if (clip.max_y > m_temp_bitmap_sprites->cliprect().max_y)
804            clip.max_y =  m_temp_bitmap_sprites->cliprect().max_y;
805805
806         if (clip.max_y < state->m_temp_bitmap_sprites->cliprect().min_y)
807            clip.max_y =  state->m_temp_bitmap_sprites->cliprect().min_y;
806         if (clip.max_y < m_temp_bitmap_sprites->cliprect().min_y)
807            clip.max_y =  m_temp_bitmap_sprites->cliprect().min_y;
808808
809809
810810         littlerb_alt_printf("%04x %04x %04x %04x %04x %04x\n", spriteregion[offs+0], spriteregion[offs+1], spriteregion[offs+2], spriteregion[offs+3], spriteregion[offs+4], spriteregion[offs+5]);
811811
812         if (layer==0) draw_sprite(machine, *state->m_temp_bitmap_sprites, clip,xsize,ysize,fullcode,x,y);
813         else draw_sprite(machine, *state->m_temp_bitmap_sprites_back, clip,xsize,ysize,fullcode,x,y);
812         if (layer==0) draw_sprite(*m_temp_bitmap_sprites, clip,xsize,ysize,fullcode,x,y);
813         else draw_sprite(*m_temp_bitmap_sprites_back, clip,xsize,ysize,fullcode,x,y);
814814
815815
816816         offs += 6;
trunk/src/mame/drivers/mjsister.c
r21027r21028
6363   UINT32 screen_update_mjsister(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6464   TIMER_CALLBACK_MEMBER(dac_callback);
6565   void mjsister_redraw();
66   void mjsister_plot0( int offset, UINT8 data );
67   void mjsister_plot1( int offset, UINT8 data );
6668};
6769
6870
r21027r21028
8183   save_item(NAME(m_videoram1));
8284}
8385
84static void mjsister_plot0( running_machine &machine, int offset, UINT8 data )
86void mjsister_state::mjsister_plot0( int offset, UINT8 data )
8587{
86   mjsister_state *state = machine.driver_data<mjsister_state>();
8788   int x, y, c1, c2;
8889
8990   x = offset & 0x7f;
9091   y = offset / 0x80;
9192
92   c1 = (data & 0x0f)        + state->m_colorbank * 0x20;
93   c2 = ((data & 0xf0) >> 4) + state->m_colorbank * 0x20;
93   c1 = (data & 0x0f)        + m_colorbank * 0x20;
94   c2 = ((data & 0xf0) >> 4) + m_colorbank * 0x20;
9495
95   state->m_tmpbitmap0->pix16(y, x * 2 + 0) = c1;
96   state->m_tmpbitmap0->pix16(y, x * 2 + 1) = c2;
96   m_tmpbitmap0->pix16(y, x * 2 + 0) = c1;
97   m_tmpbitmap0->pix16(y, x * 2 + 1) = c2;
9798}
9899
99static void mjsister_plot1( running_machine &machine, int offset, UINT8 data )
100void mjsister_state::mjsister_plot1( int offset, UINT8 data )
100101{
101   mjsister_state *state = machine.driver_data<mjsister_state>();
102102   int x, y, c1, c2;
103103
104104   x = offset & 0x7f;
r21027r21028
108108   c2 = (data & 0xf0) >> 4;
109109
110110   if (c1)
111      c1 += state->m_colorbank * 0x20 + 0x10;
111      c1 += m_colorbank * 0x20 + 0x10;
112112   if (c2)
113      c2 += state->m_colorbank * 0x20 + 0x10;
113      c2 += m_colorbank * 0x20 + 0x10;
114114
115   state->m_tmpbitmap1->pix16(y, x * 2 + 0) = c1;
116   state->m_tmpbitmap1->pix16(y, x * 2 + 1) = c2;
115   m_tmpbitmap1->pix16(y, x * 2 + 0) = c1;
116   m_tmpbitmap1->pix16(y, x * 2 + 1) = c2;
117117}
118118
119119WRITE8_MEMBER(mjsister_state::mjsister_videoram_w)
r21027r21028
121121   if (m_vrambank)
122122   {
123123      m_videoram1[offset] = data;
124      mjsister_plot1(machine(), offset, data);
124      mjsister_plot1(offset, data);
125125   }
126126   else
127127   {
128128      m_videoram0[offset] = data;
129      mjsister_plot0(machine(), offset, data);
129      mjsister_plot0(offset, data);
130130   }
131131}
132132
r21027r21028
141141
142142      for (offs = 0; offs < 0x8000; offs++)
143143      {
144         mjsister_plot0(machine(), offs, m_videoram0[offs]);
145         mjsister_plot1(machine(), offs, m_videoram1[offs]);
144         mjsister_plot0(offs, m_videoram0[offs]);
145         mjsister_plot1(offs, m_videoram1[offs]);
146146      }
147147      m_screen_redraw = 0;
148148   }
trunk/src/mame/drivers/onetwo.c
r21027r21028
7676   virtual void machine_start();
7777   virtual void video_start();
7878   UINT32 screen_update_onetwo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79   void set_color(int offset);
7980};
8081
8182
r21027r21028
137138   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
138139}
139140
140static void set_color(running_machine &machine, int offset)
141void onetwo_state::set_color(int offset)
141142{
142   onetwo_state *state = machine.driver_data<onetwo_state>();
143143   int r, g, b;
144144
145   r = state->m_paletteram[offset] & 0x1f;
146   g = state->m_paletteram2[offset] & 0x1f;
147   b = ((state->m_paletteram[offset] & 0x60) >> 2) | ((state->m_paletteram2[offset] & 0xe0) >> 5);
148   palette_set_color_rgb(machine, offset, pal5bit(r), pal5bit(g), pal5bit(b));
145   r = m_paletteram[offset] & 0x1f;
146   g = m_paletteram2[offset] & 0x1f;
147   b = ((m_paletteram[offset] & 0x60) >> 2) | ((m_paletteram2[offset] & 0xe0) >> 5);
148   palette_set_color_rgb(machine(), offset, pal5bit(r), pal5bit(g), pal5bit(b));
149149}
150150
151151WRITE8_MEMBER(onetwo_state::palette1_w)
152152{
153153   m_paletteram[offset] = data;
154   set_color(machine(), offset);
154   set_color(offset);
155155}
156156
157157WRITE8_MEMBER(onetwo_state::palette2_w)
158158{
159159   m_paletteram2[offset] = data;
160   set_color(machine(), offset);
160   set_color(offset);
161161}
162162
163163/*************************************
trunk/src/mame/drivers/thayers.c
r21027r21028
8484   virtual void machine_reset();
8585   TIMER_CALLBACK_MEMBER(intrq_tick);
8686   TIMER_CALLBACK_MEMBER(ssi263_phoneme_tick);
87   void check_interrupt();
8788};
8889
8990
r21027r21028
9596
9697/* Interrupts */
9798
98static void check_interrupt(running_machine &machine)
99void thayers_state::check_interrupt()
99100{
100   thayers_state *state = machine.driver_data<thayers_state>();
101   if (!state->m_timer_int || !state->m_data_rdy_int || !state->m_ssi_data_request)
101   if (!m_timer_int || !m_data_rdy_int || !m_ssi_data_request)
102102   {
103      machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, HOLD_LINE);
103      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, HOLD_LINE);
104104   }
105105   else
106106   {
107      machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
107      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
108108   }
109109}
110110
r21027r21028
146146{
147147   m_timer_int = 1;
148148
149   check_interrupt(machine());
149   check_interrupt();
150150}
151151
152152WRITE8_MEMBER(thayers_state::data_rdy_int_ack_w)
153153{
154154   m_data_rdy_int = 1;
155155
156   check_interrupt(machine());
156   check_interrupt();
157157}
158158
159159WRITE8_MEMBER(thayers_state::cop_d_w)
r21027r21028
179179      m_data_rdy_int = 0;
180180   }
181181
182   check_interrupt(machine());
182   check_interrupt();
183183}
184184
185185/* COP Communication */
r21027r21028
475475TIMER_CALLBACK_MEMBER(thayers_state::ssi263_phoneme_tick)
476476{
477477   m_ssi_data_request = 0;
478   check_interrupt(machine());
478   check_interrupt();
479479}
480480
481481WRITE8_MEMBER(thayers_state::ssi263_register_w)
r21027r21028
493493      ssi263.p = data & 0x3f;
494494
495495      m_ssi_data_request = 1;
496      check_interrupt(machine());
496      check_interrupt();
497497
498498      switch (ssi263.mode)
499499      {
trunk/src/mame/drivers/dominob.c
r21027r21028
8686   DECLARE_READ8_MEMBER(dominob_unk_port02_r);
8787   virtual void video_start();
8888   UINT32 screen_update_dominob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
89   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
8990};
9091
9192void dominob_state::video_start()
r21027r21028
9394   machine().gfx[0]->set_granularity(8);
9495}
9596
96static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
97void dominob_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
9798{
98   dominob_state *state = machine.driver_data<dominob_state>();
9999   int offs;
100100
101   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
101   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
102102   {
103103      int sx, sy, code;
104104
105      sx = state->m_spriteram[offs];
106      sy = 248 - state->m_spriteram[offs + 1];
107      if (state->flip_screen_x()) sx = 248 - sx;
108      if (state->flip_screen_y()) sy = 248 - sy;
105      sx = m_spriteram[offs];
106      sy = 248 - m_spriteram[offs + 1];
107      if (flip_screen_x()) sx = 248 - sx;
108      if (flip_screen_y()) sy = 248 - sy;
109109
110      code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 2] & 0x03) << 8)  ;
110      code = m_spriteram[offs + 3] + ((m_spriteram[offs + 2] & 0x03) << 8)  ;
111111
112      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
112      drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
113113            2 * code,
114            ((state->m_spriteram[offs + 2] & 0xf8) >> 3)  ,
115            state->flip_screen_x(),state->flip_screen_y(),
116            sx,sy + (state->flip_screen_y() ? 8 : -8),0);
117      drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
114            ((m_spriteram[offs + 2] & 0xf8) >> 3)  ,
115            flip_screen_x(),flip_screen_y(),
116            sx,sy + (flip_screen_y() ? 8 : -8),0);
117      drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
118118            2 * code + 1,
119            ((state->m_spriteram[offs + 2] & 0xf8) >> 3)  ,
120            state->flip_screen_x(),state->flip_screen_y(),
119            ((m_spriteram[offs + 2] & 0xf8) >> 3)  ,
120            flip_screen_x(),flip_screen_y(),
121121            sx,sy,0);
122122   }
123123}
r21027r21028
158158      }
159159   }
160160
161   draw_sprites(machine(), bitmap, cliprect);
161   draw_sprites(bitmap, cliprect);
162162
163163   return 0;
164164}
trunk/src/mame/drivers/galaxi.c
r21027r21028
9595   virtual void machine_reset();
9696   virtual void video_start();
9797   UINT32 screen_update_galaxi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
98   void show_out(  );
9899};
99100
100101
r21027r21028
213214                            Memory Maps
214215***************************************************************************/
215216
216static void show_out( running_machine &machine )
217void galaxi_state::show_out(  )
217218{
218//  galaxi_state *state = machine.driver_data<galaxi_state>();
219//  popmessage("%04x %04x %04x", state->m_out[0], state->m_out[1], state->m_out[2]);
219//  popmessage("%04x %04x %04x", m_out[0], m_out[1], m_out[2]);
220220}
221221
222222WRITE16_MEMBER(galaxi_state::galaxi_500000_w)
223223{
224224   COMBINE_DATA(&m_out[0]);
225   show_out(machine());
225   show_out();
226226}
227227
228228WRITE16_MEMBER(galaxi_state::galaxi_500002_w)
229229{
230230   COMBINE_DATA(&m_out[1]);
231   show_out(machine());
231   show_out();
232232}
233233
234234WRITE16_MEMBER(galaxi_state::galaxi_500004_w)
r21027r21028
263263   }
264264
265265   COMBINE_DATA(&m_out[2]);
266   show_out(machine());
266   show_out();
267267}
268268
269269CUSTOM_INPUT_MEMBER(galaxi_state::ticket_r)
trunk/src/mame/drivers/mirax.c
r21027r21028
131131   virtual void palette_init();
132132   UINT32 screen_update_mirax(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
133133   INTERRUPT_GEN_MEMBER(mirax_vblank_irq);
134   void draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 draw_flag);
135   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
134136};
135137
136138
r21027r21028
163165}
164166
165167
166static void draw_tilemap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 draw_flag)
168void mirax_state::draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 draw_flag)
167169{
168   mirax_state *state = machine.driver_data<mirax_state>();
169   gfx_element *gfx = machine.gfx[0];
170   gfx_element *gfx = machine().gfx[0];
170171   int y,x;
171172   int res_x,res_y,wrapy;
172173
r21027r21028
174175   {
175176      for (x=0;x<32;x++)
176177      {
177         int tile = state->m_videoram[32*y+x];
178         int color = (state->m_colorram[x*2]<<8) | (state->m_colorram[(x*2)+1]);
178         int tile = m_videoram[32*y+x];
179         int color = (m_colorram[x*2]<<8) | (m_colorram[(x*2)+1]);
179180         int x_scroll = (color & 0xff00)>>8;
180181         tile |= ((color & 0xe0)<<3);
181182
182         res_x = (state->m_flipscreen_x) ? 248-x*8 : x*8;
183         res_y = (state->m_flipscreen_y) ? 248-y*8+x_scroll : y*8-x_scroll;
184         wrapy = (state->m_flipscreen_y) ? -256 : 256;
183         res_x = (m_flipscreen_x) ? 248-x*8 : x*8;
184         res_y = (m_flipscreen_y) ? 248-y*8+x_scroll : y*8-x_scroll;
185         wrapy = (m_flipscreen_y) ? -256 : 256;
185186
186187         if((x <= 1 || x >= 30) ^ draw_flag)
187188         {
188            drawgfx_opaque(bitmap,cliprect,gfx,tile,color & 7,(state->m_flipscreen_x),(state->m_flipscreen_y),res_x,res_y);
189            drawgfx_opaque(bitmap,cliprect,gfx,tile,color & 7,(m_flipscreen_x),(m_flipscreen_y),res_x,res_y);
189190            /* wrap-around */
190            drawgfx_opaque(bitmap,cliprect,gfx,tile,color & 7,(state->m_flipscreen_x),(state->m_flipscreen_y),res_x,res_y+wrapy);
191            drawgfx_opaque(bitmap,cliprect,gfx,tile,color & 7,(m_flipscreen_x),(m_flipscreen_y),res_x,res_y+wrapy);
191192         }
192193      }
193194   }
194195}
195196
196static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
197void mirax_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
197198{
198   mirax_state *state = machine.driver_data<mirax_state>();
199   UINT8 *spriteram = state->m_spriteram;
199   UINT8 *spriteram = m_spriteram;
200200   int count;
201201
202202   for(count=0;count<0x200;count+=4)
r21027r21028
208208
209209      spr_offs = (spriteram[count+1] & 0x3f);
210210      color = spriteram[count+2] & 0x7;
211      fx = (state->m_flipscreen_x) ^ ((spriteram[count+1] & 0x40) >> 6); //<- guess
212      fy = (state->m_flipscreen_y) ^ ((spriteram[count+1] & 0x80) >> 7);
211      fx = (m_flipscreen_x) ^ ((spriteram[count+1] & 0x40) >> 6); //<- guess
212      fy = (m_flipscreen_y) ^ ((spriteram[count+1] & 0x80) >> 7);
213213
214214      spr_offs += (spriteram[count+2] & 0xe0)<<1;
215215      spr_offs += (spriteram[count+2] & 0x10)<<5;
216216
217      y = (state->m_flipscreen_y) ? spriteram[count] : 0x100 - spriteram[count] - 16;
218      x = (state->m_flipscreen_x) ? 240 - spriteram[count+3] : spriteram[count+3];
217      y = (m_flipscreen_y) ? spriteram[count] : 0x100 - spriteram[count] - 16;
218      x = (m_flipscreen_x) ? 240 - spriteram[count+3] : spriteram[count+3];
219219
220      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],spr_offs,color,fx,fy,x,y,0);
220      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],spr_offs,color,fx,fy,x,y,0);
221221   }
222222}
223223
224224UINT32 mirax_state::screen_update_mirax(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
225225{
226   draw_tilemap(machine(),bitmap,cliprect,1);
227   draw_sprites(machine(),bitmap,cliprect);
228   draw_tilemap(machine(),bitmap,cliprect,0);
226   draw_tilemap(bitmap,cliprect,1);
227   draw_sprites(bitmap,cliprect);
228   draw_tilemap(bitmap,cliprect,0);
229229   return 0;
230230}
231231
trunk/src/mame/drivers/ssfindo.c
r21027r21028
258258   required_device<cpu_device> m_maincpu;
259259   required_memory_region m_region_user2;
260260   required_ioport m_io_ps7500;
261};
262261
262   typedef void (ssfindo_state::*ssfindo_speedup_func)(address_space &space);
263   ssfindo_speedup_func ssfindo_speedup;
263264
264static void PS7500_startTimer0(running_machine &machine);
265static void PS7500_startTimer1(running_machine &machine);
265   void PS7500_startTimer0();
266   void PS7500_startTimer1();
267   void PS7500_reset();
268   void ssfindo_speedups(address_space& space);
269   void ppcar_speedups(address_space& space);
270};
266271
267272
268273UINT32 ssfindo_state::screen_update_ssfindo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
r21027r21028
309314   }
310315}
311316
312static void PS7500_startTimer0(running_machine &machine)
317void ssfindo_state::PS7500_startTimer0()
313318{
314   ssfindo_state *state = machine.driver_data<ssfindo_state>();
315   int val=((state->m_PS7500_IO[T0low]&0xff)|((state->m_PS7500_IO[T0high]&0xff)<<8))>>1;
319   int val=((m_PS7500_IO[T0low]&0xff)|((m_PS7500_IO[T0high]&0xff)<<8))>>1;
316320
317321   if(val==0)
318      state->m_PS7500timer0->adjust(attotime::never);
322      m_PS7500timer0->adjust(attotime::never);
319323   else
320      state->m_PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
324      m_PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
321325}
322326
323327TIMER_CALLBACK_MEMBER(ssfindo_state::PS7500_Timer1_callback)
r21027r21028
329333   }
330334}
331335
332static void PS7500_startTimer1(running_machine &machine)
336void ssfindo_state::PS7500_startTimer1()
333337{
334   ssfindo_state *state = machine.driver_data<ssfindo_state>();
335   int val=((state->m_PS7500_IO[T1low]&0xff)|((state->m_PS7500_IO[T1high]&0xff)<<8))>>1;
338   int val=((m_PS7500_IO[T1low]&0xff)|((m_PS7500_IO[T1high]&0xff)<<8))>>1;
336339   if(val==0)
337      state->m_PS7500timer1->adjust(attotime::never);
340      m_PS7500timer1->adjust(attotime::never);
338341   else
339      state->m_PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
342      m_PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val ));
340343}
341344
342345INTERRUPT_GEN_MEMBER(ssfindo_state::ssfindo_interrupt)
r21027r21028
348351      }
349352}
350353
351static void PS7500_reset(running_machine &machine)
354void ssfindo_state::PS7500_reset()
352355{
353   ssfindo_state *state = machine.driver_data<ssfindo_state>();
354      state->m_PS7500_IO[IOCR]            =   0x3f;
355      state->m_PS7500_IO[VIDCR]       =   0;
356      m_PS7500_IO[IOCR]            =   0x3f;
357      m_PS7500_IO[VIDCR]       =   0;
356358
357      state->m_PS7500timer0->adjust( attotime::never);
358      state->m_PS7500timer1->adjust( attotime::never);
359      m_PS7500timer0->adjust( attotime::never);
360      m_PS7500timer1->adjust( attotime::never);
359361}
360362
361typedef void (*ssfindo_speedup_func)(address_space &space);
362ssfindo_speedup_func ssfindo_speedup;
363363
364static void ssfindo_speedups(address_space& space)
364void ssfindo_state::ssfindo_speedups(address_space& space)
365365{
366366   if (space.device().safe_pc()==0x2d6c8) // ssfindo
367367      space.device().execute().spin_until_time(attotime::from_usec(20));
r21027r21028
369369      space.device().execute().spin_until_time(attotime::from_usec(20));
370370}
371371
372static void ppcar_speedups(address_space& space)
372void ssfindo_state::ppcar_speedups(address_space& space)
373373{
374374   if (space.device().safe_pc()==0x000bc8) // ppcar
375375      space.device().execute().spin_until_time(attotime::from_usec(20));
r21027r21028
402402         return (m_PS7500_IO[IRQSTA] & m_PS7500_IO[IRQMSKA]) | 0x80;
403403
404404      case IOCR: //TODO: nINT1, OD[n] p.81
405         if (ssfindo_speedup) ssfindo_speedup(space);
405         if (ssfindo_speedup) (this->*ssfindo_speedup)(space);
406406
407407         if( m_iocr_hack)
408408         {
r21027r21028
462462      break;
463463
464464      case T1GO:
465            PS7500_startTimer1(machine());
465            PS7500_startTimer1();
466466         break;
467467
468468      case T0GO:
469         PS7500_startTimer0(machine());
469         PS7500_startTimer0();
470470      break;
471471
472472      case VIDEND:
r21027r21028
621621
622622void ssfindo_state::machine_reset()
623623{
624   PS7500_reset(machine());
624   PS7500_reset();
625625}
626626
627627static INPUT_PORTS_START( ssfindo )
r21027r21028
874874{
875875   DRIVER_INIT_CALL(common);
876876   m_flashType=0;
877   ssfindo_speedup = ssfindo_speedups;
877   ssfindo_speedup = &ssfindo_state::ssfindo_speedups;
878878   m_iocr_hack=0;
879879}
880880
r21027r21028
882882{
883883   DRIVER_INIT_CALL(common);
884884   m_flashType=1;
885   ssfindo_speedup = ppcar_speedups;
885   ssfindo_speedup = &ssfindo_state::ppcar_speedups;
886886   m_iocr_hack=0;
887887}
888888
trunk/src/mame/drivers/gpworld.c
r21027r21028
7474   UINT32 screen_update_gpworld(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
7575   INTERRUPT_GEN_MEMBER(vblank_callback_gpworld);
7676   TIMER_CALLBACK_MEMBER(irq_stop);
77   void gpworld_draw_tiles(bitmap_rgb32 &bitmap,const rectangle &cliprect);
78   inline void draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip);
79   void gpworld_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
7780};
7881
7982
r21027r21028
8588
8689
8790/* VIDEO GOODS */
88static void gpworld_draw_tiles(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle &cliprect)
91void gpworld_state::gpworld_draw_tiles(bitmap_rgb32 &bitmap,const rectangle &cliprect)
8992{
90   gpworld_state *state = machine.driver_data<gpworld_state>();
9193   UINT8 characterX, characterY;
9294
9395   /* Temporarily set to 64 wide to accommodate two screens */
r21027r21028
9799      {
98100         int current_screen_character = (characterY*64) + characterX;
99101
100         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_tile_ram[current_screen_character],
102         drawgfx_transpen(bitmap, cliprect, machine().gfx[0], m_tile_ram[current_screen_character],
101103               characterY, 0, 0, characterX*8, characterY*8, 0);
102104      }
103105   }
104106}
105107
106INLINE void draw_pixel(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
108void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip)
107109{
108110   if (flip)
109111   {
r21027r21028
112114   }
113115
114116   if (cliprect.contains(x, y))
115      bitmap.pix32(y, x) = machine.pens[color];
117      bitmap.pix32(y, x) = machine().pens[color];
116118}
117119
118static void gpworld_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
120void gpworld_state::gpworld_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
119121{
120   gpworld_state *state = machine.driver_data<gpworld_state>();
121122   const int SPR_Y_TOP     = 0;
122123   const int SPR_Y_BOTTOM  = 1;
123124   const int SPR_X_LO      = 2;
r21027r21028
126127   const int SPR_SKIP_HI   = 5;
127128   const int SPR_GFXOFS_LO = 6;
128129   const int SPR_GFXOFS_HI = 7;
129   int flip = state->flip_screen();
130   int flip = flip_screen();
130131
131132   int i;
132133
133   UINT8 *GFX = state->memregion("gfx2")->base();
134   UINT8 *GFX = memregion("gfx2")->base();
134135
135136   /* Heisted from Daphne which heisted it from MAME */
136137   for (i = 0; i < 0x800; i += 8)
137138   {
138      UINT8 *spr_reg = state->m_sprite_ram + i;
139      UINT8 *spr_reg = m_sprite_ram + i;
139140
140141      if (spr_reg[SPR_Y_BOTTOM] && spr_reg[SPR_X_LO] != 0xff)
141142      {
r21027r21028
203204               }
204205
205206               /* Daphne says "don't draw the pixel if it's black". */
206               draw_pixel(machine, bitmap,cliprect,x+0,y,palette_get_color(machine, pixel1 + (sprite_color*0x10 + 0x200)),flip);
207               draw_pixel(machine, bitmap,cliprect,x+1,y,palette_get_color(machine, pixel2 + (sprite_color*0x10 + 0x200)),flip);
208               draw_pixel(machine, bitmap,cliprect,x+2,y,palette_get_color(machine, pixel3 + (sprite_color*0x10 + 0x200)),flip);
209               draw_pixel(machine, bitmap,cliprect,x+3,y,palette_get_color(machine, pixel4 + (sprite_color*0x10 + 0x200)),flip);
207               draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(machine(), pixel1 + (sprite_color*0x10 + 0x200)),flip);
208               draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(machine(), pixel2 + (sprite_color*0x10 + 0x200)),flip);
209               draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(machine(), pixel3 + (sprite_color*0x10 + 0x200)),flip);
210               draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(machine(), pixel4 + (sprite_color*0x10 + 0x200)),flip);
210211
211212               x += 4;
212213
r21027r21028
230231{
231232   bitmap.fill(0, cliprect);
232233
233   gpworld_draw_tiles(machine(), bitmap, cliprect);
234   gpworld_draw_sprites(machine(), bitmap, cliprect);
234   gpworld_draw_tiles(bitmap, cliprect);
235   gpworld_draw_sprites(bitmap, cliprect);
235236
236237   return 0;
237238}
trunk/src/mame/drivers/segald.c
r21027r21028
5959   DECLARE_DRIVER_INIT(astron);
6060   virtual void machine_start();
6161   UINT32 screen_update_astron(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
62   void astron_draw_characters(bitmap_rgb32 &bitmap,const rectangle &cliprect);
63   void astron_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
6264};
6365
6466/* VIDEO GOODS */
65static void astron_draw_characters(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle &cliprect)
67void segald_state::astron_draw_characters(bitmap_rgb32 &bitmap,const rectangle &cliprect)
6668{
67   segald_state *state = machine.driver_data<segald_state>();
6869   UINT8 characterX, characterY;
6970
7071   for (characterX = 0; characterX < 32; characterX++)
r21027r21028
7273      for (characterY = 0; characterY < 32; characterY++)
7374      {
7475         int current_screen_character = (characterY*32) + characterX;
75         drawgfx_transpen(bitmap, cliprect, machine.gfx[0], state->m_fix_ram[current_screen_character],
76         drawgfx_transpen(bitmap, cliprect, machine().gfx[0], m_fix_ram[current_screen_character],
7677               1, 0, 0, characterX*8, characterY*8, 0);
7778      }
7879   }
7980}
8081
81static void astron_draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
82void segald_state::astron_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
8283{
8384   /* Heisted from Daphne */
8485   const UINT8 SPR_Y_TOP     = 0;
r21027r21028
9091/*  const UINT8 SPR_GFXOFS_LO = 6;*/
9192/*  const UINT8 SPR_GFXOFS_HI = 7;*/
9293
93   segald_state *state = machine.driver_data<segald_state>();
9494   int sx,sy;
9595   int spr_number;
9696   int spr_base;
r21027r21028
9898   for (spr_number = 0; spr_number < 32; spr_number++)
9999   {
100100      spr_base = 0x10 * spr_number;
101      sy = state->m_obj_ram[spr_base + SPR_Y_TOP];
102      sx = state->m_obj_ram[spr_base + SPR_X_LO];
101      sy = m_obj_ram[spr_base + SPR_Y_TOP];
102      sx = m_obj_ram[spr_base + SPR_X_LO];
103103
104104      if (sx != 0 || sy != 0)
105105         logerror("Hey!  A sprite's not at 0,0 : %d %d", sx, sy);
r21027r21028
111111{
112112   bitmap.fill(0, cliprect);
113113
114   astron_draw_characters(machine(), bitmap, cliprect);
115   astron_draw_sprites(machine(), bitmap, cliprect);
114   astron_draw_characters(bitmap, cliprect);
115   astron_draw_sprites(bitmap, cliprect);
116116
117117   return 0;
118118}
trunk/src/mame/drivers/srmp6.c
r21027r21028
106106   DECLARE_DRIVER_INIT(INIT);
107107   virtual void video_start();
108108   UINT32 screen_update_srmp6(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
109   void update_palette();
110   UINT32 process(UINT8 b,UINT32 dst_offset);
109111};
110112
111113#define VERBOSE 0
r21027r21028
122124   8*64
123125};
124126
125static void update_palette(running_machine &machine)
127void srmp6_state::update_palette()
126128{
127   srmp6_state *state = machine.driver_data<srmp6_state>();
128129   INT8 r, g ,b;
129   int brg = state->m_brightness - 0x60;
130   int brg = m_brightness - 0x60;
130131   int i;
131132
132133   for(i = 0; i < 0x800; i++)
133134   {
134      r = state->m_generic_paletteram_16[i] >>  0 & 0x1F;
135      g = state->m_generic_paletteram_16[i] >>  5 & 0x1F;
136      b = state->m_generic_paletteram_16[i] >> 10 & 0x1F;
135      r = m_generic_paletteram_16[i] >>  0 & 0x1F;
136      g = m_generic_paletteram_16[i] >>  5 & 0x1F;
137      b = m_generic_paletteram_16[i] >> 10 & 0x1F;
137138
138139      if(brg < 0) {
139140         r += (r * brg) >> 5;
r21027r21028
151152         b += ((0x1F - b) * brg) >> 5;
152153         if(b > 0x1F) b = 0x1F;
153154      }
154      palette_set_color(machine, i, MAKE_RGB(r << 3, g << 3, b << 3));
155      palette_set_color(machine(), i, MAKE_RGB(r << 3, g << 3, b << 3));
155156   }
156157}
157158
r21027r21028
339340         data = (!data)?0x60:(data == 0x5e)?0x60:data;
340341         if (m_brightness != data) {
341342            m_brightness = data;
342            update_palette(machine());
343            update_palette();
343344         }
344345         break;
345346
r21027r21028
368369
369370
370371/* DMA RLE stuff - the same as CPS3 */
371static UINT32 process(running_machine &machine,UINT8 b,UINT32 dst_offset)
372UINT32 srmp6_state::process(UINT8 b,UINT32 dst_offset)
372373{
373   srmp6_state *state = machine.driver_data<srmp6_state>();
374374   int l=0;
375375
376   UINT8 *tram=(UINT8*)state->m_tileram;
376   UINT8 *tram=(UINT8*)m_tileram;
377377
378   if (state->m_lastb == state->m_lastb2)  //rle
378   if (m_lastb == m_lastb2)  //rle
379379   {
380380      int i;
381381      int rle=(b+1)&0xff;
382382
383383      for(i=0;i<rle;++i)
384384      {
385         tram[dst_offset + state->m_destl] = state->m_lastb;
386         machine.gfx[0]->mark_dirty((dst_offset + state->m_destl)/0x40);
385         tram[dst_offset + m_destl] = m_lastb;
386         machine().gfx[0]->mark_dirty((dst_offset + m_destl)/0x40);
387387
388388         dst_offset++;
389389         ++l;
390390      }
391      state->m_lastb2 = 0xffff;
391      m_lastb2 = 0xffff;
392392
393393      return l;
394394   }
395395   else
396396   {
397      state->m_lastb2 = state->m_lastb;
398      state->m_lastb = b;
399      tram[dst_offset + state->m_destl] = b;
400      machine.gfx[0]->mark_dirty((dst_offset + state->m_destl)/0x40);
397      m_lastb2 = m_lastb;
398      m_lastb = b;
399      tram[dst_offset + m_destl] = b;
400      machine().gfx[0]->mark_dirty((dst_offset + m_destl)/0x40);
401401
402402      return 1;
403403   }
r21027r21028
453453            {
454454               UINT8 real_byte;
455455               real_byte = rom[srctab+p*2];
456               tempidx+=process(machine(),real_byte,tempidx);
456               tempidx+=process(real_byte,tempidx);
457457               real_byte = rom[srctab+p*2+1];//px[DMA_XOR((current_table_address+p*2+1))];
458               tempidx+=process(machine(),real_byte,tempidx);
458               tempidx+=process(real_byte,tempidx);
459459            }
460460            else
461461            {
462               tempidx+=process(machine(),p,tempidx);
462               tempidx+=process(p,tempidx);
463463            }
464464
465465            ctrl<<=1;
trunk/src/mame/drivers/cham24.c
r21027r21028
8989   virtual void video_start();
9090   virtual void palette_init();
9191   UINT32 screen_update_cham24(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
92   void cham24_set_mirroring( int mirroring );
9293};
9394
9495
9596
96static void cham24_set_mirroring( running_machine &machine, int mirroring )
97void cham24_state::cham24_set_mirroring( int mirroring )
9798{
98   cham24_state *state = machine.driver_data<cham24_state>();
9999   switch(mirroring)
100100   {
101101   case PPU_MIRROR_LOW:
102      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram;
102      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram;
103103      break;
104104   case PPU_MIRROR_HIGH:
105      state->m_nt_page[0] = state->m_nt_page[1] = state->m_nt_page[2] = state->m_nt_page[3] = state->m_nt_ram + 0x400;
105      m_nt_page[0] = m_nt_page[1] = m_nt_page[2] = m_nt_page[3] = m_nt_ram + 0x400;
106106      break;
107107   case PPU_MIRROR_HORZ:
108      state->m_nt_page[0] = state->m_nt_ram;
109      state->m_nt_page[1] = state->m_nt_ram;
110      state->m_nt_page[2] = state->m_nt_ram + 0x400;
111      state->m_nt_page[3] = state->m_nt_ram + 0x400;
108      m_nt_page[0] = m_nt_ram;
109      m_nt_page[1] = m_nt_ram;
110      m_nt_page[2] = m_nt_ram + 0x400;
111      m_nt_page[3] = m_nt_ram + 0x400;
112112      break;
113113   case PPU_MIRROR_VERT:
114      state->m_nt_page[0] = state->m_nt_ram;
115      state->m_nt_page[1] = state->m_nt_ram + 0x400;
116      state->m_nt_page[2] = state->m_nt_ram;
117      state->m_nt_page[3] = state->m_nt_ram + 0x400;
114      m_nt_page[0] = m_nt_ram;
115      m_nt_page[1] = m_nt_ram + 0x400;
116      m_nt_page[2] = m_nt_ram;
117      m_nt_page[3] = m_nt_ram + 0x400;
118118      break;
119119   case PPU_MIRROR_NONE:
120120   default:
121      state->m_nt_page[0] = state->m_nt_ram;
122      state->m_nt_page[1] = state->m_nt_ram + 0x400;
123      state->m_nt_page[2] = state->m_nt_ram + 0x800;
124      state->m_nt_page[3] = state->m_nt_ram + 0xc00;
121      m_nt_page[0] = m_nt_ram;
122      m_nt_page[1] = m_nt_ram + 0x400;
123      m_nt_page[2] = m_nt_ram + 0x800;
124      m_nt_page[3] = m_nt_ram + 0xc00;
125125      break;
126126   }
127127}
r21027r21028
210210   membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * gfx_bank));
211211
212212   // set gfx mirroring
213   cham24_set_mirroring(machine(), gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
213   cham24_set_mirroring(gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
214214
215215   // switch PRG bank
216216   if (prg_bank_page_size == 0)
trunk/src/mame/drivers/savquest.c
r21027r21028
103103   virtual void machine_start();
104104   virtual void machine_reset();
105105   IRQ_CALLBACK_MEMBER(irq_callback);
106   void intel82439tx_init();
106107};
107108
108109// Intel 82439TX System Controller (MXTC)
r21027r21028
185186   state->m_mxtc_config_reg[reg] = data;
186187}
187188
188static void intel82439tx_init(running_machine &machine)
189void savquest_state::intel82439tx_init()
189190{
190   savquest_state *state = machine.driver_data<savquest_state>();
191   state->m_mxtc_config_reg[0x60] = 0x02;
192   state->m_mxtc_config_reg[0x61] = 0x02;
193   state->m_mxtc_config_reg[0x62] = 0x02;
194   state->m_mxtc_config_reg[0x63] = 0x02;
195   state->m_mxtc_config_reg[0x64] = 0x02;
196   state->m_mxtc_config_reg[0x65] = 0x02;
191   m_mxtc_config_reg[0x60] = 0x02;
192   m_mxtc_config_reg[0x61] = 0x02;
193   m_mxtc_config_reg[0x62] = 0x02;
194   m_mxtc_config_reg[0x63] = 0x02;
195   m_mxtc_config_reg[0x64] = 0x02;
196   m_mxtc_config_reg[0x65] = 0x02;
197197}
198198
199199static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
623623   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, savquest_set_keyb_int);
624624
625625   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(savquest_state::irq_callback),this));
626   intel82439tx_init(machine());
626   intel82439tx_init();
627627
628628   kbdc8042_init(machine(), &at8042);
629629}
trunk/src/mame/drivers/nexus3d.c
r21027r21028
5151   virtual void machine_reset();
5252   virtual void video_start();
5353   UINT32 screen_update_nexus3d(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
54   void nexus3d_flash_reset();
5455};
5556
5657
r21027r21028
6162// Flash handling is very similar (but not 100% identical) to the stuff used in cavesh3 (command structure seems very slightly different, probably due to larger size)
6263// this is just a skeleton implementation
6364
64void nexus3d_flash_reset(running_machine& machine)
65void nexus3d_state::nexus3d_flash_reset()
6566{
66   nexus3d_state *state = machine.driver_data<nexus3d_state>();
67   state->m_last_flash_cmd = 0x00;
68   state->m_flash_addr_seq = 0;
69   state->m_flash_addr = 0;
67   m_last_flash_cmd = 0x00;
68   m_flash_addr_seq = 0;
69   m_flash_addr = 0;
7070
71   state->m_flash_page_addr = 0;
71   m_flash_page_addr = 0;
7272}
7373
7474READ8_MEMBER(nexus3d_state::n3d_flash_r)
r21027r21028
189189
190190void nexus3d_state::machine_reset()
191191{
192   nexus3d_flash_reset(machine());
192   nexus3d_flash_reset();
193193}
194194
195195static MACHINE_CONFIG_START( nexus3d, nexus3d_state )
trunk/src/mame/drivers/midqslvr.c
r21027r21028
9999   virtual void machine_start();
100100   virtual void machine_reset();
101101   IRQ_CALLBACK_MEMBER(irq_callback);
102   void intel82439tx_init();
102103};
103104
104105
r21027r21028
197198   state->m_mxtc_config_reg[reg] = data;
198199}
199200
200static void intel82439tx_init(running_machine &machine)
201void midqslvr_state::intel82439tx_init()
201202{
202   midqslvr_state *state = machine.driver_data<midqslvr_state>();
203   state->m_mxtc_config_reg[0x60] = 0x02;
204   state->m_mxtc_config_reg[0x61] = 0x02;
205   state->m_mxtc_config_reg[0x62] = 0x02;
206   state->m_mxtc_config_reg[0x63] = 0x02;
207   state->m_mxtc_config_reg[0x64] = 0x02;
208   state->m_mxtc_config_reg[0x65] = 0x02;
203   m_mxtc_config_reg[0x60] = 0x02;
204   m_mxtc_config_reg[0x61] = 0x02;
205   m_mxtc_config_reg[0x62] = 0x02;
206   m_mxtc_config_reg[0x63] = 0x02;
207   m_mxtc_config_reg[0x64] = 0x02;
208   m_mxtc_config_reg[0x65] = 0x02;
209209}
210210
211211static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
662662   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, midqslvr_set_keyb_int);
663663
664664   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(midqslvr_state::irq_callback),this));
665   intel82439tx_init(machine());
665   intel82439tx_init();
666666
667667   kbdc8042_init(machine(), &at8042);
668668}
trunk/src/mame/drivers/xtom3d.c
r21027r21028
116116   virtual void machine_start();
117117   virtual void machine_reset();
118118   IRQ_CALLBACK_MEMBER(irq_callback);
119   void intel82439tx_init();
119120};
120121
121122// Intel 82439TX System Controller (MXTC)
r21027r21028
210211   state->m_mxtc_config_reg[reg] = data;
211212}
212213
213static void intel82439tx_init(running_machine &machine)
214void xtom3d_state::intel82439tx_init()
214215{
215   xtom3d_state *state = machine.driver_data<xtom3d_state>();
216   state->m_mxtc_config_reg[0x60] = 0x02;
217   state->m_mxtc_config_reg[0x61] = 0x02;
218   state->m_mxtc_config_reg[0x62] = 0x02;
219   state->m_mxtc_config_reg[0x63] = 0x02;
220   state->m_mxtc_config_reg[0x64] = 0x02;
221   state->m_mxtc_config_reg[0x65] = 0x02;
216   m_mxtc_config_reg[0x60] = 0x02;
217   m_mxtc_config_reg[0x61] = 0x02;
218   m_mxtc_config_reg[0x62] = 0x02;
219   m_mxtc_config_reg[0x63] = 0x02;
220   m_mxtc_config_reg[0x64] = 0x02;
221   m_mxtc_config_reg[0x65] = 0x02;
222222}
223223
224224static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
654654   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, xtom3d_set_keyb_int);
655655
656656   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(xtom3d_state::irq_callback),this));
657   intel82439tx_init(machine());
657   intel82439tx_init();
658658
659659   kbdc8042_init(machine(), &at8042);
660660}
trunk/src/mame/drivers/nyny.c
r21027r21028
131131   virtual void machine_reset();
132132   INTERRUPT_GEN_MEMBER(update_pia_1);
133133   DECLARE_WRITE8_MEMBER(ic48_1_74123_output_changed);
134   inline void shift_star_generator(  );
134135};
135136
136137
r21027r21028
371372}
372373
373374
374INLINE void shift_star_generator( running_machine &machine )
375void nyny_state::shift_star_generator(  )
375376{
376   nyny_state *state = machine.driver_data<nyny_state>();
377   state->m_star_shift_reg = (state->m_star_shift_reg << 1) | (((~state->m_star_shift_reg >> 15) & 0x01) ^ ((state->m_star_shift_reg >> 2) & 0x01));
377   m_star_shift_reg = (m_star_shift_reg << 1) | (((~m_star_shift_reg >> 15) & 0x01) ^ ((m_star_shift_reg >> 2) & 0x01));
378378}
379379
380380
r21027r21028
408408         }
409409
410410         if (delay_counter == 0)
411            shift_star_generator(device->machine());
411            state->shift_star_generator();
412412         else
413413            delay_counter = delay_counter - 1;
414414      }
trunk/src/mame/drivers/drtomy.c
r21027r21028
4141   virtual void machine_reset();
4242   virtual void video_start();
4343   UINT32 screen_update_drtomy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4445};
4546
4647
r21027r21028
7879      3  | xxxxxxxx xxxxxx-- | sprite code
7980*/
8081
81static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
82void drtomy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
8283{
83   drtomy_state *state = machine.driver_data<drtomy_state>();
8484   int i, x, y, ex, ey;
85   gfx_element *gfx = machine.gfx[0];
85   gfx_element *gfx = machine().gfx[0];
8686
8787   static const int x_offset[2] = {0x0, 0x2};
8888   static const int y_offset[2] = {0x0, 0x1};
8989
9090   for (i = 3; i < 0x1000 / 2; i += 4)
9191   {
92      int sx = state->m_spriteram[i + 2] & 0x01ff;
93      int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff;
94      int number = state->m_spriteram[i + 3];
95      int color = (state->m_spriteram[i + 2] & 0x1e00) >> 9;
96      int attr = (state->m_spriteram[i] & 0xfe00) >> 9;
92      int sx = m_spriteram[i + 2] & 0x01ff;
93      int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
94      int number = m_spriteram[i + 3];
95      int color = (m_spriteram[i + 2] & 0x1e00) >> 9;
96      int attr = (m_spriteram[i] & 0xfe00) >> 9;
9797
9898      int xflip = attr & 0x20;
9999      int yflip = attr & 0x40;
r21027r21028
134134{
135135   m_tilemap_bg->draw(bitmap, cliprect, 0, 0);
136136   m_tilemap_fg->draw(bitmap, cliprect, 0, 0);
137   draw_sprites(machine(), bitmap, cliprect);
137   draw_sprites(bitmap, cliprect);
138138   return 0;
139139}
140140
trunk/src/mame/drivers/dacholer.c
r21027r21028
9191   virtual void palette_init();
9292   UINT32 screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9393   INTERRUPT_GEN_MEMBER(sound_irq);
94   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
9495};
9596
9697TILE_GET_INFO_MEMBER(dacholer_state::get_bg_tile_info)
r21027r21028
121122   m_scroll_y = data;
122123}
123124
124static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
125void dacholer_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
125126{
126   dacholer_state *state = machine.driver_data<dacholer_state>();
127127   int offs, code, attr, sx, sy, flipx, flipy;
128128
129   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
129   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
130130   {
131      code = state->m_spriteram[offs + 1];
132      attr = state->m_spriteram[offs + 2];
131      code = m_spriteram[offs + 1];
132      attr = m_spriteram[offs + 2];
133133
134134      flipx = attr & 0x10;
135135      flipy = attr & 0x20;
136136
137      sx = (state->m_spriteram[offs + 3] - 128) + 256 * (attr & 0x01);
138      sy = 255 - state->m_spriteram[offs];
137      sx = (m_spriteram[offs + 3] - 128) + 256 * (attr & 0x01);
138      sy = 255 - m_spriteram[offs];
139139
140      if (state->flip_screen())
140      if (flip_screen())
141141      {
142142         sx = 240 - sx;
143143         sy = 240 - sy;
r21027r21028
145145         flipy = !flipy;
146146      }
147147
148      drawgfx_transpen(bitmap, cliprect, machine.gfx[2],
148      drawgfx_transpen(bitmap, cliprect, machine().gfx[2],
149149            code,
150150            0,
151151            flipx,flipy,
r21027r21028
167167   }
168168
169169   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
170   draw_sprites(machine(), bitmap, cliprect);
170   draw_sprites(bitmap, cliprect);
171171   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
172172   return 0;
173173}
trunk/src/mame/drivers/sliver.c
r21027r21028
114114   DECLARE_WRITE8_MEMBER(oki_setbank);
115115   virtual void video_start();
116116   UINT32 screen_update_sliver(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
117   void plot_pixel_rgb(int x, int y, UINT32 r, UINT32 g, UINT32 b);
118   void plot_pixel_pal(int x, int y, int addr);
119   void blit_gfx();
120   void render_jpeg();
117121};
118122
119static void plot_pixel_rgb(sliver_state *state, int x, int y, UINT32 r, UINT32 g, UINT32 b)
123void sliver_state::plot_pixel_rgb(int x, int y, UINT32 r, UINT32 g, UINT32 b)
120124{
121125//  printf("plot %d %d %d\n", r,g,b);
122126
123127   if (y < 0 || x < 0 || x > 383 || y > 255)
124128      return;
125129
126   state->m_bitmap_bg.pix32(y, x) = r | (g<<8) | (b<<16);
130   m_bitmap_bg.pix32(y, x) = r | (g<<8) | (b<<16);
127131}
128132
129static void plot_pixel_pal(running_machine &machine, int x, int y, int addr)
133void sliver_state::plot_pixel_pal(int x, int y, int addr)
130134{
131   sliver_state *state = machine.driver_data<sliver_state>();
132135   UINT32 r,g,b;
133136
134137   if (y < 0 || x < 0 || x > 383 || y > 255)
135138      return;
136139
137   b=(state->m_colorram[addr] << 2) | (state->m_colorram[addr] & 0x3);
138   g=(state->m_colorram[addr+0x100] << 2) | (state->m_colorram[addr+0x100] & 3);
139   r=(state->m_colorram[addr+0x200] << 2) | (state->m_colorram[addr+0x200] & 3);
140   b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3);
141   g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3);
142   r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3);
140143
141   state->m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16);
144   m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16);
142145}
143146
144147WRITE16_MEMBER(sliver_state::fifo_data_w)
r21027r21028
162165   }
163166}
164167
165static void blit_gfx(running_machine &machine)
168void sliver_state::blit_gfx()
166169{
167   sliver_state *state = machine.driver_data<sliver_state>();
168170   int tmpptr=0;
169   const UINT8 *rom = state->memregion("user1")->base();
171   const UINT8 *rom = memregion("user1")->base();
170172
171   while (tmpptr < state->m_fptr)
173   while (tmpptr < m_fptr)
172174   {
173175      int x,y,romdata;
174176      int w,h;
175      int romoffs=state->m_fifo[tmpptr+0]+(state->m_fifo[tmpptr+1] << 8)+(state->m_fifo[tmpptr+2] << 16);
177      int romoffs=m_fifo[tmpptr+0]+(m_fifo[tmpptr+1] << 8)+(m_fifo[tmpptr+2] << 16);
176178
177      w=state->m_fifo[tmpptr+3]+1;
178      h=state->m_fifo[tmpptr+4]+1;
179      w=m_fifo[tmpptr+3]+1;
180      h=m_fifo[tmpptr+4]+1;
179181
180      if (state->m_fifo[tmpptr+7] == 0)
182      if (m_fifo[tmpptr+7] == 0)
181183      {
182184         for (y=0; y < h; y++)
183185         {
r21027r21028
186188               romdata = rom[romoffs&0x1fffff];
187189               if (romdata)
188190               {
189                  plot_pixel_pal(machine, state->m_fifo[tmpptr+5]+state->m_fifo[tmpptr+3]-x, state->m_fifo[tmpptr+6]+state->m_fifo[tmpptr+4]-y, romdata);
191                  plot_pixel_pal(m_fifo[tmpptr+5]+m_fifo[tmpptr+3]-x, m_fifo[tmpptr+6]+m_fifo[tmpptr+4]-y, romdata);
190192               }
191193               romoffs++;
192194            }
r21027r21028
205207
206208WRITE16_MEMBER(sliver_state::fifo_flush_w)
207209{
208   blit_gfx(machine());
210   blit_gfx();
209211}
210212
211213
r21027r21028
214216   COMBINE_DATA(&m_jpeg1);
215217}
216218
217static void render_jpeg(running_machine &machine)
219void sliver_state::render_jpeg()
218220{
219   sliver_state *state = machine.driver_data<sliver_state>();
220221   int x;
221   int addr = (int)state->m_jpeg2 + (((int)state->m_jpeg1) << 16);
222   int addr = (int)m_jpeg2 + (((int)m_jpeg1) << 16);
222223
223   state->m_bitmap_bg.fill(0);
224   m_bitmap_bg.fill(0);
224225   if (addr < 0)
225226   {
226227      return;
r21027r21028
237238      cinfo.err = jpeg_std_error(&jerr);
238239      jpeg_create_decompress(&cinfo);
239240
240      jpeg_mem_src(&cinfo, machine.root_device().memregion("user2")->base()+addr, machine.root_device().memregion("user2")->bytes()-addr);
241      jpeg_mem_src(&cinfo, machine().root_device().memregion("user2")->base()+addr, machine().root_device().memregion("user2")->bytes()-addr);
241242
242243      jpeg_read_header(&cinfo, TRUE);
243244      jpeg_start_decompress(&cinfo);
r21027r21028
256257            UINT8 b = buffer[0][(x*3)];
257258            UINT8 g = buffer[0][(x*3)+1];
258259            UINT8 r = buffer[0][(x*3)+2];
259            plot_pixel_rgb(state, x - x_offset + state->m_jpeg_x, y - y_offset - state->m_jpeg_y, r, g, b);
260            plot_pixel_rgb(x - x_offset + m_jpeg_x, y - y_offset - m_jpeg_y, r, g, b);
260261
261262         }
262263
r21027r21028
274275{
275276   COMBINE_DATA(&m_jpeg2);
276277
277   render_jpeg(machine());
278   render_jpeg();
278279
279280}
280281
r21027r21028
297298      {
298299         m_jpeg_x = tmpx;
299300         m_jpeg_y = tmpy;
300         render_jpeg(machine());
301         render_jpeg();
301302      }
302303   }
303304   else
trunk/src/mame/drivers/mlanding.c
r21027r21028
7979   virtual void video_start();
8080   UINT32 screen_update_mlanding(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8181   TIMER_CALLBACK_MEMBER(dma_complete);
82   int start_dma();
8283};
8384
8485
r21027r21028
113114}
114115
115116/* Return the number of pixels processed for timing purposes? */
116static int start_dma(running_machine &machine)
117int mlanding_state::start_dma()
117118{
118   mlanding_state *state = machine.driver_data<mlanding_state>();
119119   /* Traverse the DMA RAM list */
120120   int offs;
121121
r21027r21028
130130
131131      int j, k;
132132
133      UINT16 attr = state->m_dma_ram[offs];
133      UINT16 attr = m_dma_ram[offs];
134134
135135      if (attr == 0)
136136         continue;
137137
138      x = state->m_dma_ram[offs + 1];
139      y = state->m_dma_ram[offs + 2];
140      colour = state->m_dma_ram[offs + 3];
138      x = m_dma_ram[offs + 1];
139      y = m_dma_ram[offs + 2];
140      colour = m_dma_ram[offs + 3];
141141
142142      dx = x >> 11;
143143      dy = y >> 11;
r21027r21028
172172               // Draw the 8x8 chunk
173173               for (y1 = 0; y1 < 8; ++y1)
174174               {
175                  UINT16 *src = &state->m_ml_tileram[(code * 2 * 8) + y1*2];
176                  UINT16 *dst = &state->m_g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
175                  UINT16 *src = &m_ml_tileram[(code * 2 * 8) + y1*2];
176                  UINT16 *dst = &m_g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
177177
178178                  UINT8 p2 = *src & 0xff;
179179                  UINT8 p1 = *src++ >> 8;
r21027r21028
220220         for(y1 = 0; y1 < dy*8; y1++)
221221         {
222222            int x1;
223            UINT16 *dst = &state->m_g_ram[((y + y1) * 512/2) + x/2];
223            UINT16 *dst = &m_g_ram[((y + y1) * 512/2) + x/2];
224224
225225            for(x1 = 0; x1 < dx*8; x1+=2)
226226            {
r21027r21028
324324   int pixels;
325325
326326   // Return the number of pixels drawn?
327   pixels = start_dma(machine());
327   pixels = start_dma();
328328
329329   if (pixels)
330330   {
trunk/src/mame/drivers/neoprint.c
r21027r21028
5757   DECLARE_MACHINE_RESET(nprsp);
5858   UINT32 screen_update_neoprint(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5959   UINT32 screen_update_nprsp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
60   void draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect,int layer,int data_shift);
61   void audio_cpu_assert_nmi();
6062};
6163
6264
r21027r21028
7375---- ---- --?? ??xx [6] map register
7476*/
7577
76static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int layer,int data_shift)
78void neoprint_state::draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect,int layer,int data_shift)
7779{
78   neoprint_state *state = machine.driver_data<neoprint_state>();
7980   int i, y, x;
80   gfx_element *gfx = machine.gfx[0];
81   gfx_element *gfx = machine().gfx[0];
8182   INT16 scrollx, scrolly;
8283
83   i = (state->m_npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4;
84   scrollx = ((state->m_npvidregs[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff);
85   scrolly = ((state->m_npvidregs[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff);
84   i = (m_npvidregs[((layer*8)+0x06)/2] & 7) * 0x1000/4;
85   scrollx = ((m_npvidregs[((layer*8)+0x00)/2] - (0xd8 + layer*4)) & 0x03ff);
86   scrolly = ((m_npvidregs[((layer*8)+0x02)/2] - 0xffeb) & 0x03ff);
8687
8788   scrollx/=2;
8889   scrolly/=2;
r21027r21028
9192   {
9293      for (x=0;x<32;x++)
9394      {
94         UINT16 dat = state->m_npvidram[i*2] >> data_shift; // a video register?
95         UINT16 dat = m_npvidram[i*2] >> data_shift; // a video register?
9596         UINT16 color;
96         if(state->m_npvidram[i*2+1] & 0x0020) // TODO: 8bpp switch?
97            color = ((state->m_npvidram[i*2+1] & 0x8000) << 1) | 0x200 | ((state->m_npvidram[i*2+1] & 0xff00) >> 7);
97         if(m_npvidram[i*2+1] & 0x0020) // TODO: 8bpp switch?
98            color = ((m_npvidram[i*2+1] & 0x8000) << 1) | 0x200 | ((m_npvidram[i*2+1] & 0xff00) >> 7);
9899         else
99            color = ((state->m_npvidram[i*2+1] & 0xff00) >> 8) | ((state->m_npvidram[i*2+1] & 0x0010) << 4);
100         UINT8 fx = (state->m_npvidram[i*2+1] & 0x0040);
101         UINT8 fy = (state->m_npvidram[i*2+1] & 0x0080);
100            color = ((m_npvidram[i*2+1] & 0xff00) >> 8) | ((m_npvidram[i*2+1] & 0x0010) << 4);
101         UINT8 fx = (m_npvidram[i*2+1] & 0x0040);
102         UINT8 fy = (m_npvidram[i*2+1] & 0x0080);
102103
103104         drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx,y*16-scrolly,0);
104105         drawgfx_transpen(bitmap,cliprect,gfx,dat,color,fx,fy,x*16+scrollx-512,y*16-scrolly,0);
r21027r21028
115116{
116117   bitmap.fill(0, cliprect);
117118
118   draw_layer(machine(),bitmap,cliprect,1,2);
119   draw_layer(machine(),bitmap,cliprect,0,2);
119   draw_layer(bitmap,cliprect,1,2);
120   draw_layer(bitmap,cliprect,0,2);
120121
121122   return 0;
122123}
r21027r21028
125126{
126127   bitmap.fill(0, cliprect);
127128
128   draw_layer(machine(),bitmap,cliprect,1,0);
129   draw_layer(machine(),bitmap,cliprect,2,0);
130   draw_layer(machine(),bitmap,cliprect,0,0);
129   draw_layer(bitmap,cliprect,1,0);
130   draw_layer(bitmap,cliprect,2,0);
131   draw_layer(bitmap,cliprect,0,0);
131132
132133   return 0;
133134}
r21027r21028
165166   return (m_audio_result << 8) | 0x00;
166167}
167168
168static void audio_cpu_assert_nmi(running_machine &machine)
169void neoprint_state::audio_cpu_assert_nmi()
169170{
170   machine.device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
171   machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
171172}
172173
173174
r21027r21028
183184   {
184185      soundlatch_byte_w(space, 0, data >> 8);
185186
186      audio_cpu_assert_nmi(machine());
187      audio_cpu_assert_nmi();
187188
188189      /* boost the interleave to let the audio CPU read the command */
189190      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
trunk/src/mame/drivers/voyager.c
r21027r21028
7070   virtual void machine_start();
7171   virtual void machine_reset();
7272   IRQ_CALLBACK_MEMBER(irq_callback);
73   void intel82439tx_init();
7374};
7475
7576
r21027r21028
263264   state->m_mxtc_config_reg[reg] = data;
264265}
265266
266static void intel82439tx_init(running_machine &machine)
267void voyager_state::intel82439tx_init()
267268{
268   voyager_state *state = machine.driver_data<voyager_state>();
269   state->m_mxtc_config_reg[0x60] = 0x02;
270   state->m_mxtc_config_reg[0x61] = 0x02;
271   state->m_mxtc_config_reg[0x62] = 0x02;
272   state->m_mxtc_config_reg[0x63] = 0x02;
273   state->m_mxtc_config_reg[0x64] = 0x02;
274   state->m_mxtc_config_reg[0x65] = 0x02;
269   m_mxtc_config_reg[0x60] = 0x02;
270   m_mxtc_config_reg[0x61] = 0x02;
271   m_mxtc_config_reg[0x62] = 0x02;
272   m_mxtc_config_reg[0x63] = 0x02;
273   m_mxtc_config_reg[0x64] = 0x02;
274   m_mxtc_config_reg[0x65] = 0x02;
275275}
276276
277277static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
788788
789789   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, voyager_set_keyb_int);
790790
791   intel82439tx_init(machine());
791   intel82439tx_init();
792792
793793   kbdc8042_init(machine(), &at8042);
794794}
trunk/src/mame/drivers/clayshoo.c
r21027r21028
4242   virtual void machine_reset();
4343   UINT32 screen_update_clayshoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4444   TIMER_CALLBACK_MEMBER(reset_analog_bit);
45   UINT8 difficulty_input_port_r( int bit );
46   void create_analog_timers(  );
4547};
4648
4749
r21027r21028
5759}
5860
5961
60static UINT8 difficulty_input_port_r( running_machine &machine, int bit )
62UINT8 clayshoo_state::difficulty_input_port_r( int bit )
6163{
6264   UINT8 ret = 0;
6365
6466   /* read fake port and remap the buttons to 2 bits */
65   UINT8   raw = machine.root_device().ioport("FAKE")->read();
67   UINT8   raw = machine().root_device().ioport("FAKE")->read();
6668
6769   if (raw & (1 << (bit + 1)))
6870      ret = 0x03;     /* expert */
r21027r21028
8385   {
8486   case 0x01:  ret = ioport("IN0")->read(); break;
8587   case 0x02:  ret = ioport("IN1")->read(); break;
86   case 0x04:  ret = (ioport("IN2")->read() & 0xf0) | difficulty_input_port_r(machine(), 0) |
87                  (difficulty_input_port_r(machine(), 3) << 2); break;
88   case 0x04:  ret = (ioport("IN2")->read() & 0xf0) | difficulty_input_port_r(0) |
89                  (difficulty_input_port_r(3) << 2); break;
8890   case 0x08:  ret = ioport("IN3")->read(); break;
8991   case 0x10:
9092   case 0x20:  break;  /* these two are not really used */
r21027r21028
134136}
135137
136138
137static void create_analog_timers( running_machine &machine )
139void clayshoo_state::create_analog_timers(  )
138140{
139   clayshoo_state *state = machine.driver_data<clayshoo_state>();
140   state->m_analog_timer_1 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state));
141   state->m_analog_timer_2 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state));
141   m_analog_timer_1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),this));
142   m_analog_timer_2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),this));
142143}
143144
144145
r21027r21028
171172
172173void clayshoo_state::machine_start()
173174{
174   create_analog_timers(machine());
175   create_analog_timers();
175176
176177   /* register for state saving */
177178   save_item(NAME(m_input_port_select));
trunk/src/mame/drivers/dreamwld.c
r21027r21028
165165   virtual void video_start();
166166   UINT32 screen_update_dreamwld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
167167   void screen_eof_dreamwld(screen_device &screen, bool state);
168   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
168169};
169170
170171
171172
172static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
173void dreamwld_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
173174{
174   dreamwld_state *state = machine.driver_data<dreamwld_state>();
175   gfx_element *gfx = machine.gfx[0];
176   UINT32 *source = state->m_spritebuf1;
177   UINT32 *finish = state->m_spritebuf1 + 0x1000 / 4;
178   UINT16 *redirect = (UINT16 *)state->memregion("spritelut")->base();
175   gfx_element *gfx = machine().gfx[0];
176   UINT32 *source = m_spritebuf1;
177   UINT32 *finish = m_spritebuf1 + 0x1000 / 4;
178   UINT16 *redirect = (UINT16 *)memregion("spritelut")->base();
179179
180180   while (source < finish)
181181   {
r21027r21028
394394   tmptilemap0->draw(bitmap, cliprect, 0, 0);
395395   tmptilemap1->draw(bitmap, cliprect, 0, 0);
396396
397   draw_sprites(machine(), bitmap, cliprect);
397   draw_sprites(bitmap, cliprect);
398398
399399   return 0;
400400}
trunk/src/mame/drivers/panicr.c
r21027r21028
100100   virtual void palette_init();
101101   UINT32 screen_update_panicr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102102   TIMER_DEVICE_CALLBACK_MEMBER(panicr_scanline);
103   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect );
103104};
104105
105106
r21027r21028
224225   colortable_configure_tilemap_groups(machine().colortable, m_txttilemap, machine().gfx[0], 0);
225226}
226227
227static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
228void panicr_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect )
228229{
229   panicr_state *state = machine.driver_data<panicr_state>();
230   UINT8 *spriteram = state->m_spriteram;
230   UINT8 *spriteram = m_spriteram;
231231   int offs,flipx,flipy,x,y,color,sprite;
232232
233233   for (offs = 0; offs<0x1000; offs+=16)
r21027r21028
239239      if (spriteram[offs+1] & 0x40) x -= 0x100;
240240
241241      color = spriteram[offs+1] & 0x0f;
242      sprite = spriteram[offs+0] | (*state->m_spritebank << 8);
242      sprite = spriteram[offs+0] | (*m_spritebank << 8);
243243
244      drawgfx_transmask(bitmap,cliprect,machine.gfx[3],
244      drawgfx_transmask(bitmap,cliprect,machine().gfx[3],
245245            sprite,
246246            color,flipx,flipy,x,y,
247            colortable_get_transpen_mask(machine.colortable, machine.gfx[3], color, 0));
247            colortable_get_transpen_mask(machine().colortable, machine().gfx[3], color, 0));
248248   }
249249}
250250
r21027r21028
254254   m_txttilemap->mark_all_dirty();
255255   m_bgtilemap->set_scrollx(0, m_scrollx);
256256   m_bgtilemap->draw(bitmap, cliprect, 0,0);
257   draw_sprites(machine(),bitmap,cliprect);
257   draw_sprites(bitmap,cliprect);
258258   m_txttilemap->draw(bitmap, cliprect, 0,0);
259259
260260   return 0;
trunk/src/mame/drivers/ettrivia.c
r21027r21028
6262   virtual void palette_init();
6363   UINT32 screen_update_ettrivia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6464   INTERRUPT_GEN_MEMBER(ettrivia_interrupt);
65   inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT8 *vidram, int gfx_code);
6566};
6667
6768
r21027r21028
196197   GFXDECODE_ENTRY( "gfx2", 0, charlayout, 32*4, 32 )
197198GFXDECODE_END
198199
199INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, int tile_index, UINT8 *vidram, int gfx_code)
200void ettrivia_state::get_tile_info(tile_data &tileinfo, int tile_index, UINT8 *vidram, int gfx_code)
200201{
201   ettrivia_state *state = machine.driver_data<ettrivia_state>();
202202   int code = vidram[tile_index];
203   int color = (code >> 5) + 8 * state->m_palreg;
203   int color = (code >> 5) + 8 * m_palreg;
204204
205   code += state->m_gfx_bank * 0x100;
205   code += m_gfx_bank * 0x100;
206206
207   SET_TILE_INFO(gfx_code,code,color,0);
207   SET_TILE_INFO_MEMBER(gfx_code,code,color,0);
208208}
209209
210210TILE_GET_INFO_MEMBER(ettrivia_state::get_tile_info_bg)
211211{
212   get_tile_info(machine(), tileinfo, tile_index, m_bg_videoram, 0);
212   get_tile_info(tileinfo, tile_index, m_bg_videoram, 0);
213213}
214214
215215TILE_GET_INFO_MEMBER(ettrivia_state::get_tile_info_fg)
216216{
217   get_tile_info(machine(), tileinfo, tile_index, m_fg_videoram, 1);
217   get_tile_info(tileinfo, tile_index, m_fg_videoram, 1);
218218}
219219
220220void ettrivia_state::palette_init()
trunk/src/mame/drivers/taitowlf.c
r21027r21028
9898   virtual void palette_init();
9999   UINT32 screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
100100   IRQ_CALLBACK_MEMBER(irq_callback);
101   void intel82439tx_init();
101102};
102103
103104#if !ENABLE_VGA
r21027r21028
174175   state->m_mxtc_config_reg[reg] = data;
175176}
176177
177static void intel82439tx_init(running_machine &machine)
178void taitowlf_state::intel82439tx_init()
178179{
179   taitowlf_state *state = machine.driver_data<taitowlf_state>();
180   state->m_mxtc_config_reg[0x60] = 0x02;
181   state->m_mxtc_config_reg[0x61] = 0x02;
182   state->m_mxtc_config_reg[0x62] = 0x02;
183   state->m_mxtc_config_reg[0x63] = 0x02;
184   state->m_mxtc_config_reg[0x64] = 0x02;
185   state->m_mxtc_config_reg[0x65] = 0x02;
180   m_mxtc_config_reg[0x60] = 0x02;
181   m_mxtc_config_reg[0x61] = 0x02;
182   m_mxtc_config_reg[0x62] = 0x02;
183   m_mxtc_config_reg[0x63] = 0x02;
184   m_mxtc_config_reg[0x64] = 0x02;
185   m_mxtc_config_reg[0x65] = 0x02;
186186}
187187
188188static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
r21027r21028
703703
704704   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int);
705705
706   intel82439tx_init(machine());
706   intel82439tx_init();
707707
708708   kbdc8042_init(machine(), &at8042);
709709}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team