Previous 199869 Revisions Next

r18600 Friday 19th October, 2012 at 12:29:27 UTC by Miodrag Milanović
modernized some static calls in various drivers (no whatsnew)
[src/mame/drivers]1945kiii.c 20pacgal.c 2mindril.c 39in1.c ace.c acefruit.c aces1.c acommand.c albazc.c
[src/mame/includes]20pacgal.h

trunk/src/mame/drivers/ace.c
r18599r18600
7171   virtual void video_start();
7272   virtual void palette_init();
7373   UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
74   void ace_postload();
7475};
7576
7677
r18599r18600
319320   GFXDECODE_ENTRY( NULL          , 0x8000, scorelayout, 0, 2 )    /* the game dynamically modifies this */
320321GFXDECODE_END
321322
322static void ace_postload(running_machine &machine)
323void aceal_state::ace_postload()
323324{
324   machine.gfx[1]->mark_dirty(0);
325   machine.gfx[2]->mark_dirty(0);
326   machine.gfx[3]->mark_dirty(0);
327   machine.gfx[4]->mark_dirty(0);
325   machine().gfx[1]->mark_dirty(0);
326   machine().gfx[2]->mark_dirty(0);
327   machine().gfx[3]->mark_dirty(0);
328   machine().gfx[4]->mark_dirty(0);
328329}
329330
330331void aceal_state::machine_start()
331332{
332333   save_item(NAME(m_objpos));
333   machine().save().register_postload(save_prepost_delegate(FUNC(ace_postload), &machine()));
334   machine().save().register_postload(save_prepost_delegate(FUNC(aceal_state::ace_postload), this));
334335}
335336
336337void aceal_state::machine_reset()
trunk/src/mame/drivers/aces1.c
r18599r18600
168168   aces1_reset_nmi_timer();
169169}
170170
171static void aces1_create_timers(running_machine &machine)
172{
173   aces1_state *state = machine.driver_data<aces1_state>();
174
175   state->m_aces1_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_irq_timer_callback),state), 0);
176   state->m_aces1_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_nmi_timer_callback),state), 0);
177}
178
179171void aces1_state::machine_start()
180172{
181   aces1_create_timers(machine());
173   m_aces1_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_irq_timer_callback),this), 0);
174   m_aces1_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_nmi_timer_callback),this), 0);
182175}
183176
184177void aces1_state::machine_reset()
trunk/src/mame/drivers/2mindril.c
r18599r18600
6767   //INTERRUPT_GEN_MEMBER(drill_device_irq);
6868   TIMER_CALLBACK_MEMBER(shutter_req);
6969   TIMER_CALLBACK_MEMBER(defender_req);
70   void tile_decode();
7071};
7172
7273
r18599r18600
494495   ROM_RELOAD(              0x600000, 0x200000 )
495496ROM_END
496497
497static void tile_decode(running_machine &machine)
498void _2mindril_state::tile_decode()
498499{
499500   UINT8 lsb,msb;
500501   UINT32 offset,i;
501   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
502   int size=machine.root_device().memregion("gfx2")->bytes();
502   UINT8 *gfx = machine().root_device().memregion("gfx2")->base();
503   int size=machine().root_device().memregion("gfx2")->bytes();
503504   int data;
504505
505506   /* Setup ROM formats:
r18599r18600
531532      offset+=4;
532533   }
533534
534   gfx = machine.root_device().memregion("gfx1")->base();
535   size=machine.root_device().memregion("gfx1")->bytes();
535   gfx = machine().root_device().memregion("gfx1")->base();
536   size=machine().root_device().memregion("gfx1")->bytes();
536537
537538   offset = size/2;
538539   for (i = size/2+size/4; i<size; i++)
r18599r18600
557558DRIVER_INIT_MEMBER(_2mindril_state,drill)
558559{
559560   m_f3_game=TMDRILL;
560   tile_decode(machine());
561   tile_decode();
561562}
562563
563564GAME( 1993, 2mindril,    0,        drill,    drill, _2mindril_state,    drill, ROT0,  "Taito", "Two Minute Drill", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE | GAME_MECHANICAL)
trunk/src/mame/drivers/albazc.c
r18599r18600
3535   virtual void video_start();
3636   virtual void palette_init();
3737   UINT32 screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
38   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
3839};
3940
4041
r18599r18600
6263{
6364}
6465
65static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
66void albazc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
6667{
67   albazc_state *state = machine.driver_data<albazc_state>();
6868   int i;
6969
7070   for (i = 511; i >= 0; i--)
7171   {
72      int code = state->m_spriteram1[i] | (state->m_spriteram2[i] << 8);
73      int color = (state->m_spriteram2[i + 0x200] & 0xf8) >> 3;
72      int code = m_spriteram1[i] | (m_spriteram2[i] << 8);
73      int color = (m_spriteram2[i + 0x200] & 0xf8) >> 3;
7474      int flipx = 0;
7575      int flipy = 0;
76      int sx = state->m_spriteram1[i + 0x200] | ((state->m_spriteram2[i + 0x200] & 0x07) << 8);
77      int sy = 242 - state->m_spriteram3[i];
76      int sx = m_spriteram1[i + 0x200] | ((m_spriteram2[i + 0x200] & 0x07) << 8);
77      int sy = 242 - m_spriteram3[i];
7878
79      if (state->m_flip_bit)
79      if (m_flip_bit)
8080      {
8181         sy = 242 - sy;
8282         flipx = !flipx;
8383         flipy = !flipy;
8484      }
8585
86      drawgfx_transpen(bitmap, cliprect, machine.gfx[0], code, color, flipx, flipy,
86      drawgfx_transpen(bitmap, cliprect, machine().gfx[0], code, color, flipx, flipy,
8787         sx, sy, 0);
8888   }
8989}
r18599r18600
9191UINT32 albazc_state::screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
9292{
9393   bitmap.fill(0x1f0, cliprect);   // ???
94   draw_sprites(machine(), bitmap, cliprect);
94   draw_sprites(bitmap, cliprect);
9595   return 0;
9696}
9797
trunk/src/mame/drivers/1945kiii.c
r18599r18600
7777   TILE_GET_INFO_MEMBER(get_k3_bg_tile_info);
7878   virtual void machine_start();
7979   virtual void video_start();
80   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
8081   UINT32 screen_update_k3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8182};
8283
r18599r18600
9899   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(k3_state::get_k3_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 64);
99100}
100101
101static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
102void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
102103{
103   k3_state *state = machine.driver_data<k3_state>();
104   gfx_element *gfx = machine.gfx[0];
105   UINT16 *source = state->m_spriteram_1;
106   UINT16 *source2 = state->m_spriteram_2;
104   gfx_element *gfx = machine().gfx[0];
105   UINT16 *source = m_spriteram_1;
106   UINT16 *source2 = m_spriteram_2;
107107   UINT16 *finish = source + 0x1000 / 2;
108108
109109   while (source < finish)
r18599r18600
127127UINT32 k3_state::screen_update_k3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
128128{
129129   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
130   draw_sprites(machine(), bitmap, cliprect);
130   draw_sprites(bitmap, cliprect);
131131   return 0;
132132}
133133
trunk/src/mame/drivers/acommand.c
r18599r18600
9494   virtual void video_start();
9595   UINT32 screen_update_acommand(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9696   TIMER_DEVICE_CALLBACK_MEMBER(acommand_scanline);
97   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int pri_mask);
98   void draw_led(bitmap_ind16 &bitmap, int x, int y,UINT8 value);
9799};
98100
99101
r18599r18600
124126         0);
125127}
126128
127static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int pri_mask)
129void acommand_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int pri_mask)
128130{
129   acommand_state *state = machine.driver_data<acommand_state>();
130   UINT16 *spriteram16 = state->m_spriteram;
131   UINT16 *spriteram16 = m_spriteram;
131132   int offs;
132133
133   for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 8)
134   for (offs = 0;offs < m_spriteram.bytes()/2;offs += 8)
134135   {
135136      if (!(spriteram16[offs+0] & 0x1000))
136137      {
r18599r18600
147148         int xx,yy,x;
148149         int delta = 16;
149150
150         flipx ^= state->flip_screen();
151         flipy ^= state->flip_screen();
151         flipx ^= flip_screen();
152         flipy ^= flip_screen();
152153
153154         if ((pri&pri_mask)!=priority) continue;
154155
155         if (state->flip_screen())
156         if (flip_screen())
156157         {
157158            sx = 368 - sx;
158159            sy = 240 - sy;
r18599r18600
166167            xx = w;
167168            do
168169            {
169               drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
170               drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
170171                     code,
171172                     color,
172173                     flipx, flipy,
r18599r18600
216217/*                                    0    1    2    3    4    5    6    7    8    9    a    b    c    d    e    f*/
217218static const UINT8 led_fill[0x10] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x00,0x00,0x00,0x00,0x00};
218219
219static void draw_led(bitmap_ind16 &bitmap, int x, int y,UINT8 value)
220void acommand_state::draw_led(bitmap_ind16 &bitmap, int x, int y,UINT8 value)
220221{
221222   bitmap.plot_box(x, y, 6, 10, 0x00000000);
222223
r18599r18600
254255UINT32 acommand_state::screen_update_acommand(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
255256{
256257   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
257   draw_sprites(machine(),bitmap,cliprect,0,0);
258   draw_sprites(bitmap,cliprect,0,0);
258259   m_tx_tilemap->draw(bitmap, cliprect, 0,0);
259260
260261   /*Order might be wrong,but these for sure are the led numbers tested*/
trunk/src/mame/drivers/39in1.c
r18599r18600
7979   TIMER_CALLBACK_MEMBER(pxa255_dma_dma_end);
8080   TIMER_CALLBACK_MEMBER(pxa255_ostimer_match);
8181   TIMER_CALLBACK_MEMBER(pxa255_lcd_dma_eof);
82   void pxa255_dma_irq_check();
83   void pxa255_dma_load_descriptor_and_start(int channel);
84   void pxa255_ostimer_irq_check();
85   void pxa255_update_interrupts();
86   void pxa255_set_irq_line(UINT32 line, int state);
87   void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel);
88   void pxa255_lcd_irq_check();
89   void pxa255_lcd_dma_kickoff(int channel);
90   void pxa255_lcd_check_load_next_branch(int channel);
91   void pxa255_start();
8292};
8393
8494
85static void pxa255_dma_irq_check(running_machine& machine);
86
87
88
89
90
91
92static void pxa255_ostimer_irq_check(running_machine& machine);
93
94
95
96
97static void pxa255_update_interrupts(running_machine& machine);
98static void pxa255_set_irq_line(running_machine& machine, UINT32 line, int state);
99
100
101
102
103
104
105static void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel);
106static void pxa255_lcd_irq_check(running_machine& machine);
107static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel);
108static void pxa255_lcd_check_load_next_branch(running_machine& machine, int channel);
109
110
111
11295#define VERBOSE_LEVEL ( 3 )
11396
11497INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char* s_fmt, ... )
r18599r18600
245228
246229*/
247230
248static void pxa255_dma_irq_check(running_machine& machine)
231void _39in1_state::pxa255_dma_irq_check()
249232{
250   _39in1_state *state = machine.driver_data<_39in1_state>();
251   PXA255_DMA_Regs *dma_regs = &state->m_dma_regs;
233   PXA255_DMA_Regs *dma_regs = &m_dma_regs;
252234   int channel = 0;
253235   int set_intr = 0;
254236
r18599r18600
265247      }
266248   }
267249
268   pxa255_set_irq_line(machine, PXA255_INT_DMA, set_intr);
250   pxa255_set_irq_line(PXA255_INT_DMA, set_intr);
269251}
270252
271static void pxa255_dma_load_descriptor_and_start(running_machine& machine, int channel)
253void _39in1_state::pxa255_dma_load_descriptor_and_start(int channel)
272254{
273   _39in1_state *state = machine.driver_data<_39in1_state>();
274   PXA255_DMA_Regs *dma_regs = &state->m_dma_regs;
255   PXA255_DMA_Regs *dma_regs = &m_dma_regs;
275256   attotime period;
276257
277258   // Shut down any transfers that are currently going on, software should be smart enough to check if a
r18599r18600
283264
284265   // Load the next descriptor
285266
286   address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
267   address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
287268   dma_regs->dsadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x4);
288269   dma_regs->dtadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x8);
289270   dma_regs->dcmd[channel]  = space.read_dword(dma_regs->ddadr[channel] + 0xc);
r18599r18600
293274   switch(channel)
294275   {
295276      case 3:
296         period = attotime::from_hz((147600000 / state->m_i2s_regs.sadiv) / (4 * 64)) * (dma_regs->dcmd[channel] & 0x00001fff);
277         period = attotime::from_hz((147600000 / m_i2s_regs.sadiv) / (4 * 64)) * (dma_regs->dcmd[channel] & 0x00001fff);
297278         break;
298279      default:
299280         period = attotime::from_hz(100000000) * (dma_regs->dcmd[channel] & 0x00001fff);
r18599r18600
405386   {
406387      if(dma_regs->dcsr[param] & PXA255_DCSR_RUN)
407388      {
408         pxa255_dma_load_descriptor_and_start(machine(), param);
389         pxa255_dma_load_descriptor_and_start(param);
409390      }
410391      else
411392      {
r18599r18600
418399      dma_regs->dcsr[param] &= ~PXA255_DCSR_RUN;
419400      dma_regs->dcsr[param] |= PXA255_DCSR_STOPSTATE;
420401   }
421   pxa255_dma_irq_check(machine());
402   pxa255_dma_irq_check();
422403}
423404
424405READ32_MEMBER(_39in1_state::pxa255_dma_r)
r18599r18600
502483               break;
503484            }
504485
505            pxa255_dma_load_descriptor_and_start(machine(), offset);
486            pxa255_dma_load_descriptor_and_start(offset);
506487         }
507488         else if(!(data & PXA255_DCSR_RUN))
508489         {
509490            dma_regs->dcsr[offset] &= ~PXA255_DCSR_RUN;
510491         }
511492
512         pxa255_dma_irq_check(machine());
493         pxa255_dma_irq_check();
513494         break;
514495      case PXA255_DINT:
515496         verboselog( machine(), 3, "pxa255_dma_w: DMA Interrupt Register: %08x & %08x\n", data, mem_mask );
r18599r18600
570551
571552*/
572553
573static void pxa255_ostimer_irq_check(running_machine& machine)
554void _39in1_state::pxa255_ostimer_irq_check()
574555{
575   _39in1_state *state = machine.driver_data<_39in1_state>();
576   PXA255_OSTMR_Regs *ostimer_regs = &state->m_ostimer_regs;
556   PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs;
577557
578   pxa255_set_irq_line(machine, PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0);
579   //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0);
580   //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0);
581   //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0);
558   pxa255_set_irq_line(PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0);
559   //pxa255_set_irq_line(PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0);
560   //pxa255_set_irq_line(PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0);
561   //pxa255_set_irq_line(PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0);
582562}
583563
584564TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_ostimer_match)
r18599r18600
588568   if (0) verboselog(machine(), 3, "pxa255_ostimer_match channel %d\n", param);
589569   ostimer_regs->ossr |= (1 << param);
590570   ostimer_regs->oscr = ostimer_regs->osmr[param];
591   pxa255_ostimer_irq_check(machine());
571   pxa255_ostimer_irq_check();
592572}
593573
594574READ32_MEMBER(_39in1_state::pxa255_ostimer_r)
r18599r18600
684664      case PXA255_OSSR:
685665         if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Status Register: %08x & %08x\n", data, mem_mask );
686666         ostimer_regs->ossr &= ~data;
687         pxa255_ostimer_irq_check(machine());
667         pxa255_ostimer_irq_check();
688668         break;
689669      case PXA255_OWER:
690670         if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Watchdog Enable Register: %08x & %08x\n", data, mem_mask );
r18599r18600
721701
722702*/
723703
724static void pxa255_update_interrupts(running_machine& machine)
704void _39in1_state::pxa255_update_interrupts()
725705{
726   _39in1_state *state = machine.driver_data<_39in1_state>();
727   PXA255_INTC_Regs *intc_regs = &state->m_intc_regs;
706   PXA255_INTC_Regs *intc_regs = &m_intc_regs;
728707
729708   intc_regs->icfp = (intc_regs->icpr & intc_regs->icmr) & intc_regs->iclr;
730709   intc_regs->icip = (intc_regs->icpr & intc_regs->icmr) & (~intc_regs->iclr);
731   machine.device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE);
732   machine.device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE,  intc_regs->icip ? ASSERT_LINE : CLEAR_LINE);
710   machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE);
711   machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE,  intc_regs->icip ? ASSERT_LINE : CLEAR_LINE);
733712}
734713
735static void pxa255_set_irq_line(running_machine& machine, UINT32 line, int irq_state)
714void _39in1_state::pxa255_set_irq_line(UINT32 line, int irq_state)
736715{
737   _39in1_state *state = machine.driver_data<_39in1_state>();
738   PXA255_INTC_Regs *intc_regs = &state->m_intc_regs;
716   PXA255_INTC_Regs *intc_regs = &m_intc_regs;
739717
740718   intc_regs->icpr &= ~line;
741719   intc_regs->icpr |= irq_state ? line : 0;
742720   //printf( "Setting IRQ line %08x to %d\n", line, irq_state );
743   pxa255_update_interrupts(machine);
721   pxa255_update_interrupts();
744722}
745723
746724READ32_MEMBER(_39in1_state::pxa255_intc_r)
r18599r18600
10611039
10621040*/
10631041
1064static void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel)
1042void _39in1_state::pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel)
10651043{
1066   _39in1_state *state = space.machine().driver_data<_39in1_state>();
1067   PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs;
1044   PXA255_LCD_Regs *lcd_regs = &m_lcd_regs;
10681045
10691046   lcd_regs->dma[channel].fdadr = space.read_dword(address);
10701047   lcd_regs->dma[channel].fsadr = space.read_dword(address + 0x04);
r18599r18600
10771054   verboselog( space.machine(), 4, "    DMA Command: %08x\n", lcd_regs->dma[channel].ldcmd );
10781055}
10791056
1080static void pxa255_lcd_irq_check(running_machine& machine)
1057void _39in1_state::pxa255_lcd_irq_check()
10811058{
1082   _39in1_state *state = machine.driver_data<_39in1_state>();
1083   PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs;
1059   PXA255_LCD_Regs *lcd_regs = &m_lcd_regs;
10841060
10851061   if(((lcd_regs->lcsr & PXA255_LCSR_BS)  != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_BM)  == 0) ||
10861062      ((lcd_regs->lcsr & PXA255_LCSR_EOF) != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_EFM) == 0) ||
10871063      ((lcd_regs->lcsr & PXA255_LCSR_SOF) != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_SFM) == 0))
10881064   {
1089      pxa255_set_irq_line(machine, PXA255_INT_LCD, 1);
1065      pxa255_set_irq_line(PXA255_INT_LCD, 1);
10901066   }
10911067   else
10921068   {
1093      pxa255_set_irq_line(machine, PXA255_INT_LCD, 0);
1069      pxa255_set_irq_line(PXA255_INT_LCD, 0);
10941070   }
10951071}
10961072
1097static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel)
1073void _39in1_state::pxa255_lcd_dma_kickoff(int channel)
10981074{
1099   _39in1_state *state = machine.driver_data<_39in1_state>();
1100   PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs;
1075   PXA255_LCD_Regs *lcd_regs = &m_lcd_regs;
11011076
11021077   if(lcd_regs->dma[channel].fdadr != 0)
11031078   {
r18599r18600
11091084      {
11101085         lcd_regs->liidr = lcd_regs->dma[channel].fidr;
11111086         lcd_regs->lcsr |= PXA255_LCSR_SOF;
1112         pxa255_lcd_irq_check(machine);
1087         pxa255_lcd_irq_check();
11131088      }
11141089
11151090      if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_PAL)
11161091      {
1117         address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1092         address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11181093         int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
11191094         int index = 0;
11201095         for(index = 0; index < length; index += 2)
11211096         {
11221097            UINT16 color = space.read_word((lcd_regs->dma[channel].fsadr &~ 1) + index);
1123            state->m_pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7));
1124            palette_set_color_rgb(machine, index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7));
1098            m_pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7));
1099            palette_set_color_rgb(machine(), index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7));
11251100         }
11261101      }
11271102      else
11281103      {
1129         address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1104         address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11301105         int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
11311106         int index = 0;
11321107         for(index = 0; index < length; index++)
11331108         {
1134            state->m_pxa255_lcd_framebuffer[index] = space.read_byte(lcd_regs->dma[channel].fsadr + index);
1109            m_pxa255_lcd_framebuffer[index] = space.read_byte(lcd_regs->dma[channel].fsadr + index);
11351110         }
11361111      }
11371112   }
11381113}
11391114
1140static void pxa255_lcd_check_load_next_branch(running_machine& machine, int channel)
1115void _39in1_state::pxa255_lcd_check_load_next_branch(int channel)
11411116{
1142   _39in1_state *state = machine.driver_data<_39in1_state>();
1143   PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs;
1117   PXA255_LCD_Regs *lcd_regs = &m_lcd_regs;
11441118
11451119   if(lcd_regs->fbr[channel] & 1)
11461120   {
1147      verboselog( machine, 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" );
1121      verboselog( machine(), 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" );
11481122      lcd_regs->fbr[channel] &= ~1;
1149      address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1123      address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11501124      //lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
11511125      //printf( "%08x\n", lcd_regs->fbr[channel] );
11521126      pxa255_lcd_load_dma_descriptor(space, lcd_regs->fbr[channel] & 0xfffffff0, 0);
11531127      lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
1154      pxa255_lcd_dma_kickoff(machine, 0);
1128      pxa255_lcd_dma_kickoff(0);
11551129      if(lcd_regs->fbr[channel] & 2)
11561130      {
11571131         lcd_regs->fbr[channel] &= ~2;
r18599r18600
11631137   }
11641138   else
11651139   {
1166      if (0) verboselog( machine, 3, "pxa255_lcd_check_load_next_branch: Not taking branch\n" );
1140      if (0) verboselog( machine(), 3, "pxa255_lcd_check_load_next_branch: Not taking branch\n" );
11671141   }
11681142}
11691143
r18599r18600
11771151      lcd_regs->liidr = lcd_regs->dma[param].fidr;
11781152      lcd_regs->lcsr |= PXA255_LCSR_EOF;
11791153   }
1180   pxa255_lcd_check_load_next_branch(machine(), param);
1181   pxa255_lcd_irq_check(machine());
1154   pxa255_lcd_check_load_next_branch(param);
1155   pxa255_lcd_irq_check();
11821156}
11831157
11841158READ32_MEMBER(_39in1_state::pxa255_lcd_r)
r18599r18600
12761250         if(!lcd_regs->dma[0].eof->enabled())
12771251         {
12781252            if (0) verboselog( machine(), 3, "ch0 EOF timer is not enabled, taking branch now\n" );
1279            pxa255_lcd_check_load_next_branch(machine(), 0);
1280            pxa255_lcd_irq_check(machine());
1253            pxa255_lcd_check_load_next_branch(0);
1254            pxa255_lcd_irq_check();
12811255         }
12821256         break;
12831257      case PXA255_FBR1:      // 0x44000024
r18599r18600
12861260         if(!lcd_regs->dma[1].eof->enabled())
12871261         {
12881262            verboselog( machine(), 3, "ch1 EOF timer is not enabled, taking branch now\n" );
1289            pxa255_lcd_check_load_next_branch(machine(), 1);
1290            pxa255_lcd_irq_check(machine());
1263            pxa255_lcd_check_load_next_branch(1);
1264            pxa255_lcd_irq_check();
12911265         }
12921266         break;
12931267      case PXA255_LCSR:      // 0x44000038
12941268         verboselog( machine(), 4, "pxa255_lcd_w: LCD Controller Status Register: %08x & %08x\n", data, mem_mask );
12951269         lcd_regs->lcsr &= ~data;
1296         pxa255_lcd_irq_check(machine());
1270         pxa255_lcd_irq_check();
12971271         break;
12981272      case PXA255_LIIDR:      // 0x4400003c
12991273         verboselog( machine(), 3, "pxa255_lcd_w: LCD Controller Interrupt ID Register: %08x & %08x\n", data, mem_mask );
r18599r18600
15361510}
15371511
15381512/* To be moved to DEVICE_START( pxa255 ) upon completion */
1539static void pxa255_start(running_machine& machine)
1513void _39in1_state::pxa255_start()
15401514{
1541   _39in1_state *state = machine.driver_data<_39in1_state>();
15421515   int index = 0;
15431516
15441517   //pxa255_t* pxa255 = pxa255_get_safe_token( device );
r18599r18600
15471520
15481521   for(index = 0; index < 16; index++)
15491522   {
1550      state->m_dma_regs.dcsr[index] = 0x00000008;
1551      state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),state));
1523      m_dma_regs.dcsr[index] = 0x00000008;
1524      m_dma_regs.timer[index] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),this));
15521525   }
15531526
1554   memset(&state->m_ostimer_regs, 0, sizeof(state->m_ostimer_regs));
1527   memset(&m_ostimer_regs, 0, sizeof(m_ostimer_regs));
15551528   for(index = 0; index < 4; index++)
15561529   {
1557      state->m_ostimer_regs.osmr[index] = 0;
1558      state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),state));
1530      m_ostimer_regs.osmr[index] = 0;
1531      m_ostimer_regs.timer[index] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),this));
15591532   }
15601533
1561   memset(&state->m_intc_regs, 0, sizeof(state->m_intc_regs));
1534   memset(&m_intc_regs, 0, sizeof(m_intc_regs));
15621535
1563   memset(&state->m_lcd_regs, 0, sizeof(state->m_lcd_regs));
1564   state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state));
1565   state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state));
1566   state->m_lcd_regs.trgbr = 0x00aa5500;
1567   state->m_lcd_regs.tcr = 0x0000754f;
1536   memset(&m_lcd_regs, 0, sizeof(m_lcd_regs));
1537   m_lcd_regs.dma[0].eof = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),this));
1538   m_lcd_regs.dma[1].eof = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),this));
1539   m_lcd_regs.trgbr = 0x00aa5500;
1540   m_lcd_regs.tcr = 0x0000754f;
15681541
15691542   //pxa255_register_state_save(device);
15701543}
r18599r18600
15851558//          }
15861559   }
15871560
1588   pxa255_start(machine());
1561   pxa255_start();
15891562}
15901563
15911564static MACHINE_CONFIG_START( 39in1, _39in1_state )
trunk/src/mame/drivers/acefruit.c
r18599r18600
4242   UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4343   INTERRUPT_GEN_MEMBER(acefruit_vblank);
4444   TIMER_CALLBACK_MEMBER(acefruit_refresh);
45   void acefruit_update_irq(int vpos);
4546};
4647
4748
4849
49static void acefruit_update_irq(running_machine &machine, int vpos )
50void acefruit_state::acefruit_update_irq(int vpos)
5051{
51   acefruit_state *state = machine.driver_data<acefruit_state>();
5252   int col;
5353   int row = vpos / 8;
5454
5555   for( col = 0; col < 32; col++ )
5656   {
5757      int tile_index = ( col * 32 ) + row;
58      int color = state->m_colorram[ tile_index ];
58      int color = m_colorram[ tile_index ];
5959
6060      switch( color )
6161      {
6262      case 0x0c:
63         machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE );
63         machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE );
6464         break;
6565      }
6666   }
r18599r18600
7272   int vpos = machine().primary_screen->vpos();
7373
7474   machine().primary_screen->update_partial(vpos );
75   acefruit_update_irq(machine(), vpos );
75   acefruit_update_irq(vpos);
7676
7777   vpos = ( ( vpos / 8 ) + 1 ) * 8;
7878
trunk/src/mame/drivers/20pacgal.c
r18599r18600
172172 *
173173 *************************************/
174174
175static void set_bankptr(running_machine &machine)
175void _20pacgal_state::set_bankptr()
176176{
177   _20pacgal_state *state =  machine.driver_data<_20pacgal_state>();
178   if (state->m_game_selected == 0)
177   if (m_game_selected == 0)
179178   {
180      UINT8 *rom = state->memregion("maincpu")->base();
181      state->membank("bank1")->set_base(rom + 0x08000);
179      UINT8 *rom = memregion("maincpu")->base();
180      membank("bank1")->set_base(rom + 0x08000);
182181   }
183182   else
184      state->membank("bank1")->set_base(state->m_ram_48000);
183      membank("bank1")->set_base(m_ram_48000);
185184}
186185
187186WRITE8_MEMBER(_20pacgal_state::ram_bank_select_w)
188187{
189
190188   m_game_selected = data & 1;
191   set_bankptr(machine());
189   set_bankptr();
192190}
193191
194192WRITE8_MEMBER(_20pacgal_state::ram_48000_w)
r18599r18600
351349   save_item(NAME(m_ram_48000));
352350   save_item(NAME(m_irq_mask));
353351
354   machine().save().register_postload(save_prepost_delegate(FUNC(set_bankptr), &machine()));
352   machine().save().register_postload(save_prepost_delegate(FUNC(_20pacgal_state::set_bankptr), this));
355353}
356354
357355void _20pacgal_state::machine_reset()
trunk/src/mame/includes/20pacgal.h
r18599r18600
5656   virtual void machine_reset();
5757   UINT32 screen_update_20pacgal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
5858   INTERRUPT_GEN_MEMBER(vblank_irq);
59   void set_bankptr();
5960};
6061
6162

Previous 199869 Revisions Next


© 1997-2024 The MAME Team