Previous 199869 Revisions Next

r32462 Monday 29th September, 2014 at 17:03:32 UTC by Osso
Moved misc functions into driver classes and small cleanups(nw)
[src/mame/audio]n8080.c
[src/mame/drivers]avt.c cave.c cobra.c coolpool.c galaxian.c midzeus.c segas32.c taitotz.c
[src/mame/includes]cave.h coolpool.h cosmic.h galaxian.h midzeus.h segas32.h
[src/mame/video]cosmic.c

trunk/src/mame/drivers/taitotz.c
r32461r32462
608608   DECLARE_READ16_MEMBER(tlcs_ide1_r);
609609   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
610610   void taitotz_exit();
611   void draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile);
612   UINT32 video_mem_r(taitotz_state *state, UINT32 address);
613   void video_mem_w(taitotz_state *state, UINT32 address, UINT32 data);
614   UINT32 video_reg_r(taitotz_state *state, UINT32 reg);
615   void video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data);
611   void draw_tile(UINT32 pos, UINT32 tile);
612   UINT32 video_mem_r(UINT32 address);
613   void video_mem_w(UINT32 address, UINT32 data);
614   UINT32 video_reg_r(UINT32 reg);
615   void video_reg_w(UINT32 reg, UINT32 data);
616616   void init_taitotz_152();
617617   void init_taitotz_111a();
618618};
r32461r32462
634634   }
635635
636636   void set_fb(bitmap_rgb32 *fb) { m_fb = fb; }
637   void render_displaylist(running_machine &machine, const rectangle &cliprect);
638   void draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha);
637   void render_displaylist(const rectangle &cliprect);
638   void draw_object(UINT32 address, float scale, UINT8 alpha);
639639   float line_plane_intersection(const vertex_t *v1, const vertex_t *v2, PLANE cp);
640640   int clip_polygon(const vertex_t *v, int num_vertices, PLANE cp, vertex_t *vout);
641641   void setup_viewport(int x, int y, int width, int height, int center_x, int center_y);
r32461r32462
11521152   return clip_verts;
11531153}
11541154
1155void taitotz_renderer::draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha)
1155void taitotz_renderer::draw_object(UINT32 address, float scale, UINT8 alpha)
11561156{
11571157   const rectangle& visarea = m_state.m_screen->visible_area();
11581158
r32461r32462
13361336   m_clip_plane[4].d = 0.1f;
13371337}
13381338
1339void taitotz_renderer::render_displaylist(running_machine &machine, const rectangle &cliprect)
1339void taitotz_renderer::render_displaylist(const rectangle &cliprect)
13401340{
13411341   float zvalue = 0;//ZBUFFER_MAX;
13421342   m_zbuffer->fill(*(int*)&zvalue, cliprect);
r32461r32462
14051405
14061406         UINT32 alpha = w[2];
14071407
1408         draw_object(machine, w[0] & 0x1fffff, scale, alpha);
1408         draw_object(w[0] & 0x1fffff, scale, alpha);
14091409
14101410#if LOG_DISPLAY_LIST
14111411         printf("0xffff0011:   %08X, %08X, %08X, %08X\n", w[0], w[1], w[2], w[3]);
r32461r32462
15941594{
15951595   bitmap.fill(0x000000, cliprect);
15961596   m_renderer->set_fb(&bitmap);
1597   m_renderer->render_displaylist(machine(), cliprect);
1597   m_renderer->render_displaylist(cliprect);
15981598
15991599
16001600   UINT16 *screen_src = (UINT16*)&m_screen_ram[m_scr_base];
r32461r32462
16181618   return 0;
16191619}
16201620
1621void taitotz_state::draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile)
1621void taitotz_state::draw_tile(UINT32 pos, UINT32 tile)
16221622{
16231623   int tileu = (tile & 0x1f) * 16;
16241624   int tilev = ((tile >> 5)) * 16;
r32461r32462
16601660    batlgr2 into 0x9e0000
16611661*/
16621662
1663UINT32 taitotz_state::video_mem_r(taitotz_state *state, UINT32 address)
1663UINT32 taitotz_state::video_mem_r(UINT32 address)
16641664{
16651665   if (address >= 0x800000 && address < 0x1000000)
16661666   {
r32461r32462
16811681   }
16821682}
16831683
1684void taitotz_state::video_mem_w(taitotz_state *state, UINT32 address, UINT32 data)
1684void taitotz_state::video_mem_w(UINT32 address, UINT32 data)
16851685{
16861686   if (address >= 0x800000 && address < 0x1000000)
16871687   {
r32461r32462
17011701   }
17021702}
17031703
1704UINT32 taitotz_state::video_reg_r(taitotz_state *state, UINT32 reg)
1704UINT32 taitotz_state::video_reg_r(UINT32 reg)
17051705{
17061706   switch ((reg >> 28) & 0xf)
17071707   {
r32461r32462
17311731      }
17321732      case 0xb:
17331733      {
1734         return video_mem_r(state, reg & 0xfffffff);
1734         return video_mem_r(reg & 0xfffffff);
17351735      }
17361736      default:
17371737      {
r32461r32462
17641764video_reg_w: r: 20000004 d: 00000000
17651765*/
17661766
1767void taitotz_state::video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data)
1767void taitotz_state::video_reg_w(UINT32 reg, UINT32 data)
17681768{
17691769   switch ((reg >> 28) & 0xf)
17701770   {
r32461r32462
17941794      {
17951795         UINT32 pos = (data >> 12) & 0xfff;
17961796         UINT32 tile = data & 0xfff;
1797         draw_tile(state, pos, tile);
1797         draw_tile(pos, tile);
17981798         break;
17991799      }
18001800   case 0xb:       // RAM write?
18011801      {
1802         video_mem_w(state, m_video_ram_ptr, data);
1802         video_mem_w(m_video_ram_ptr, data);
18031803         m_video_ram_ptr++;
18041804         break;
18051805      }
r32461r32462
18391839      {
18401840         case 0x0:
18411841            {
1842               r |= (UINT64)(video_reg_r(this, m_video_reg)) << 32;
1842               r |= (UINT64)(video_reg_r(m_video_reg)) << 32;
18431843               break;
18441844            }
18451845
r32461r32462
18851885      {
18861886         case 0:
18871887         {
1888            video_reg_w(this, m_video_reg, regdata);
1888            video_reg_w(m_video_reg, regdata);
18891889            break;
18901890         }
18911891         case 0x8:
r32461r32462
19401940   UINT64 r = 0;
19411941   if (ACCESSING_BITS_32_63)
19421942   {
1943      r |= (UINT64)(video_mem_r(this, m_video_ram_ptr)) << 32;
1943      r |= (UINT64)(video_mem_r(m_video_ram_ptr)) << 32;
19441944      m_video_ram_ptr++;
19451945   }
19461946   if (ACCESSING_BITS_0_31)
19471947   {
1948      r |= (UINT64)(video_mem_r(this, m_video_ram_ptr));
1948      r |= (UINT64)(video_mem_r(m_video_ram_ptr));
19491949      m_video_ram_ptr++;
19501950   }
19511951
r32461r32462
19631963      {
19641964         if (m_video_fifo_ptr >= 8)
19651965         {
1966            video_mem_w(this, m_video_ram_ptr, (UINT32)(data >> 32));
1966            video_mem_w(m_video_ram_ptr, (UINT32)(data >> 32));
19671967            m_video_ram_ptr++;
19681968         }
19691969         m_video_fifo_ptr++;
r32461r32462
19721972      {
19731973         if (m_video_fifo_ptr >= 8)
19741974         {
1975            video_mem_w(this, m_video_ram_ptr, (UINT32)(data));
1975            video_mem_w(m_video_ram_ptr, (UINT32)(data));
19761976            m_video_ram_ptr++;
19771977         }
19781978         m_video_fifo_ptr++;
trunk/src/mame/drivers/segas32.c
r32461r32462
531531
532532/*************************************
533533 *
534 *  Prototypes
535 *
536 *************************************/
537
538static void signal_sound_irq(running_machine &machine, int which);
539
540
541
542/*************************************
543 *
544534 *  Machine init
545535 *
546536 *************************************/
r32461r32462
659649      case 13:
660650      case 14:
661651      case 15:        /* signal IRQ to sound CPU */
662         signal_sound_irq(machine(),SOUND_IRQ_V60);
652         signal_sound_irq(SOUND_IRQ_V60);
663653         break;
664654   }
665655}
r32461r32462
12161206}
12171207
12181208
1219static void signal_sound_irq(running_machine &machine, int which)
1209void segas32_state::signal_sound_irq(int which)
12201210{
1221   segas32_state *state = machine.driver_data<segas32_state>();
1222   int i;
1223
12241211   /* see if this interrupt input is mapped to any vectors; if so, mark them */
1225   for (i = 0; i < 3; i++)
1226      if (state->m_sound_irq_control[i] == which)
1227         state->m_sound_irq_input |= 1 << i;
1228   state->update_sound_irq_state();
1212   for (int i = 0; i < 3; i++)
1213      if (m_sound_irq_control[i] == which)
1214         m_sound_irq_input |= 1 << i;
1215   update_sound_irq_state();
12291216}
12301217
12311218
1232static void clear_sound_irq(running_machine &machine, int which)
1219void segas32_state::clear_sound_irq(int which)
12331220{
1234   segas32_state *state = machine.driver_data<segas32_state>();
1235   int i;
1236   for (i = 0; i < 3; i++)
1237      if (state->m_sound_irq_control[i] == which)
1238         state->m_sound_irq_input &= ~(1 << i);
1239   state->update_sound_irq_state();
1221   for (int i = 0; i < 3; i++)
1222      if (m_sound_irq_control[i] == which)
1223         m_sound_irq_input &= ~(1 << i);
1224   update_sound_irq_state();
12401225}
12411226
12421227
r32461r32462
12651250WRITE_LINE_MEMBER(segas32_state::ym3438_irq_handler)
12661251{
12671252   if (state)
1268      signal_sound_irq(machine(), SOUND_IRQ_YM3438);
1253      signal_sound_irq(SOUND_IRQ_YM3438);
12691254   else
1270      clear_sound_irq(machine(), SOUND_IRQ_YM3438);
1255      clear_sound_irq(SOUND_IRQ_YM3438);
12711256}
12721257
12731258
trunk/src/mame/drivers/avt.c
r32461r32462
452452   INTERRUPT_GEN_MEMBER(avt_vblank_irq);
453453};
454454
455#define mc6845_h_char_total     (state->m_crtc_vreg[0])
455#define mc6845_h_char_total     (m_crtc_vreg[0])
456456#define mc6845_h_display        (m_crtc_vreg[1])
457#define mc6845_h_sync_pos       (state->m_crtc_vreg[2])
458#define mc6845_sync_width       (state->m_crtc_vreg[3])
459#define mc6845_v_char_total     (state->m_crtc_vreg[4])
460#define mc6845_v_total_adj      (state->m_crtc_vreg[5])
457#define mc6845_h_sync_pos       (m_crtc_vreg[2])
458#define mc6845_sync_width       (m_crtc_vreg[3])
459#define mc6845_v_char_total     (m_crtc_vreg[4])
460#define mc6845_v_total_adj      (m_crtc_vreg[5])
461461#define mc6845_v_display        (m_crtc_vreg[6])
462#define mc6845_v_sync_pos       (state->m_crtc_vreg[7])
463#define mc6845_mode_ctrl        (state->m_crtc_vreg[8])
464#define mc6845_tile_height      (state->m_crtc_vreg[9]+1)
465#define mc6845_cursor_y_start   (state->m_crtc_vreg[0x0a])
466#define mc6845_cursor_y_end     (state->m_crtc_vreg[0x0b])
467#define mc6845_start_addr       (((state->m_crtc_vreg[0x0c]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0d] & 0xff))
468#define mc6845_cursor_addr      (((state->m_crtc_vreg[0x0e]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0f] & 0xff))
469#define mc6845_light_pen_addr   (((state->m_crtc_vreg[0x10]<<8) & 0x3f00) | (state->m_crtc_vreg[0x11] & 0xff))
470#define mc6845_update_addr      (((state->m_crtc_vreg[0x12]<<8) & 0x3f00) | (state->m_crtc_vreg[0x13] & 0xff))
462#define mc6845_v_sync_pos       (m_crtc_vreg[7])
463#define mc6845_mode_ctrl        (m_crtc_vreg[8])
464#define mc6845_tile_height      (m_crtc_vreg[9]+1)
465#define mc6845_cursor_y_start   (m_crtc_vreg[0x0a])
466#define mc6845_cursor_y_end     (m_crtc_vreg[0x0b])
467#define mc6845_start_addr       (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff))
468#define mc6845_cursor_addr      (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff))
469#define mc6845_light_pen_addr   (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff))
470#define mc6845_update_addr      (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff))
471471
472472
473473/*********************************************
trunk/src/mame/drivers/cave.c
r32461r32462
638638                               Koro Koro Quest
639639***************************************************************************/
640640
641static void show_leds(running_machine &machine)
641void cave_state::show_leds()
642642{
643643#ifdef MAME_DEBUG
644//  cave_state *state = machine.driver_data<cave_state>();
645//  popmessage("led %04X eep %02X", state->m_leds[0], (state->m_leds[1] >> 8) & ~0x70);
644//  popmessage("led %04X eep %02X", m_leds[0], (m_leds[1] >> 8) & ~0x70);
646645#endif
647646}
648647
r32461r32462
666665   set_led_status(machine(), 7, data & 0x0002);
667666   set_led_status(machine(), 8, data & 0x0001);
668667
669   show_leds(machine());
668   show_leds();
670669}
671670
672671
r32461r32462
676675   {
677676      logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data);
678677      COMBINE_DATA(&m_leds[1]);
679      show_leds(machine());
678      show_leds();
680679   }
681680
682681   if (ACCESSING_BITS_8_15)  // even address
r32461r32462
924923   return ~8 + ((m_eeprom->do_read() & 1) ? 8 : 0);
925924}
926925
927INLINE void vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX)
926inline void cave_state::vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX)
928927{
929   cave_state *state = space.machine().driver_data<cave_state>();
930   UINT16 *VCTRL = state->m_vctrl[GFX];
928   UINT16 *VCTRL = m_vctrl[GFX];
931929   if (offset == 4 / 2)
932930   {
933931      switch (data & 0x000f)
r32461r32462
46654663
46664664/* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other.
46674665   Expand the 2 bit part into a 4 bit layout, so we can decode it */
4668static void sailormn_unpack_tiles( running_machine &machine, const char *region )
4666void cave_state::sailormn_unpack_tiles( const char *region )
46694667{
4670   const UINT32 len    =   machine.root_device().memregion(region)->bytes();
4671   UINT8 *rgn      =   machine.root_device().memregion(region)->base();
4668   const UINT32 len    =   memregion(region)->bytes();
4669   UINT8 *rgn      =   memregion(region)->base();
46724670   UINT8 *src      =   rgn + (len/4)*3 - 1;
46734671   UINT8 *dst      =   rgn + (len/4)*4 - 2;
46744672
r32461r32462
46844682   }
46854683}
46864684
4687static void init_cave(running_machine &machine)
4685void cave_state::init_cave()
46884686{
4689   cave_state *state = machine.driver_data<cave_state>();
4687   m_spritetype[0] = 0; // Normal sprites
4688   m_kludge = 0;
4689   m_time_vblank_irq = 100;
46904690
4691   state->m_spritetype[0] = 0; // Normal sprites
4692   state->m_kludge = 0;
4693   state->m_time_vblank_irq = 100;
4694
4695   state->m_irq_level = 1;
4691   m_irq_level = 1;
46964692}
46974693
46984694
46994695DRIVER_INIT_MEMBER(cave_state,agallet)
47004696{
47014697   UINT8 *ROM = memregion("audiocpu")->base();
4702   init_cave(machine());
4698   init_cave();
47034699
47044700   membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000);
47054701
r32461r32462
47114707   membank("oki2bank1")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
47124708   membank("oki2bank2")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
47134709
4714   sailormn_unpack_tiles(machine(), "layer2");
4710   sailormn_unpack_tiles("layer2");
47154711
47164712   unpack_sprites("sprites0");
47174713}
47184714
47194715DRIVER_INIT_MEMBER(cave_state,dfeveron)
47204716{
4721   init_cave(machine());
4717   init_cave();
47224718
47234719   unpack_sprites("sprites0");
47244720   m_kludge = 2;
r32461r32462
47264722
47274723DRIVER_INIT_MEMBER(cave_state,feversos)
47284724{
4729   init_cave(machine());
4725   init_cave();
47304726
47314727   unpack_sprites("sprites0");
47324728   m_kludge = 2;
r32461r32462
47344730
47354731DRIVER_INIT_MEMBER(cave_state,ddonpach)
47364732{
4737   init_cave(machine());
4733   init_cave();
47384734
47394735   ddonpach_unpack_sprites("sprites0");
47404736   m_spritetype[0] = 1;    // "different" sprites (no zooming?)
r32461r32462
47434739
47444740DRIVER_INIT_MEMBER(cave_state,donpachi)
47454741{
4746   init_cave(machine());
4742   init_cave();
47474743
47484744   ddonpach_unpack_sprites("sprites0");
47494745   m_spritetype[0] = 1;    // "different" sprites (no zooming?)
r32461r32462
47534749
47544750DRIVER_INIT_MEMBER(cave_state,esprade)
47554751{
4756   init_cave(machine());
4752   init_cave();
47574753
47584754   esprade_unpack_sprites("sprites0");
47594755   m_time_vblank_irq = 2000;   /**/
r32461r32462
47684764
47694765DRIVER_INIT_MEMBER(cave_state,gaia)
47704766{
4771   init_cave(machine());
4767   init_cave();
47724768
47734769   /* No EEPROM */
47744770
r32461r32462
47794775
47804776DRIVER_INIT_MEMBER(cave_state,guwange)
47814777{
4782   init_cave(machine());
4778   init_cave();
47834779
47844780   esprade_unpack_sprites("sprites0");
47854781   m_time_vblank_irq = 2000;   /**/
r32461r32462
47894785{
47904786   UINT8 *ROM = memregion("audiocpu")->base();
47914787
4792   init_cave(machine());
4788   init_cave();
47934789
47944790   membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000);
47954791
r32461r32462
48084804   UINT8 *src = memregion("sprites0")->base();
48094805   int len = memregion("sprites0")->bytes();
48104806
4811   init_cave(machine());
4807   init_cave();
48124808
48134809   membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000);
48144810
r32461r32462
48354831{
48364832   UINT8 *ROM = memregion("audiocpu")->base();
48374833
4838   init_cave(machine());
4834   init_cave();
48394835
48404836   membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000);
48414837
r32461r32462
48554851
48564852DRIVER_INIT_MEMBER(cave_state,ppsatan)
48574853{
4858   init_cave(machine());
4854   init_cave();
48594855
48604856   unpack_sprites("sprites0");
48614857   unpack_sprites("sprites1");
r32461r32462
48754871   int len = memregion("sprites0")->bytes();
48764872   int i, j;
48774873
4878   init_cave(machine());
4874   init_cave();
48794875
48804876   membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000);
48814877
r32461r32462
49194915   UINT8 *src = memregion("sprites0")->base();
49204916   int len = memregion("sprites0")->bytes();
49214917
4922   init_cave(machine());
4918   init_cave();
49234919
49244920   membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000);
49254921
r32461r32462
49404936      memcpy(src, buffer, len);
49414937   }
49424938
4943   sailormn_unpack_tiles( machine(), "layer2" );
4939   sailormn_unpack_tiles("layer2");
49444940
49454941   unpack_sprites("sprites0");
49464942   m_spritetype[0] = 2;    // Normal sprites with different position handling
r32461r32462
49534949
49544950DRIVER_INIT_MEMBER(cave_state,tjumpman)
49554951{
4956   init_cave(machine());
4952   init_cave();
49574953
49584954   unpack_sprites("sprites0");
49594955   m_spritetype[0] = 2;    // Normal sprites with different position handling
r32461r32462
49664962
49674963DRIVER_INIT_MEMBER(cave_state,uopoko)
49684964{
4969   init_cave(machine());
4965   init_cave();
49704966
49714967   unpack_sprites("sprites0");
49724968   m_kludge = 2;
r32461r32462
49754971
49764972DRIVER_INIT_MEMBER(cave_state,korokoro)
49774973{
4978   init_cave(machine());
4974   init_cave();
49794975
49804976   m_irq_level = 2;
49814977
trunk/src/mame/drivers/coolpool.c
r32461r32462
11061106 *
11071107 *************************************/
11081108
1109static void register_state_save(running_machine &machine)
1109void coolpool_state::register_state_save()
11101110{
1111   coolpool_state *state = machine.driver_data<coolpool_state>();
1111   save_item(NAME(m_oldx));
1112   save_item(NAME(m_oldy));
1113   save_item(NAME(m_result));
1114   save_item(NAME(m_lastresult));
11121115
1113   state->save_item(NAME(state->m_oldx));
1114   state->save_item(NAME(state->m_oldy));
1115   state->save_item(NAME(state->m_result));
1116   state->save_item(NAME(state->m_lastresult));
1117
1118   state->save_item(NAME(state->m_cmd_pending));
1119   state->save_item(NAME(state->m_iop_cmd));
1120   state->save_item(NAME(state->m_iop_answer));
1121   state->save_item(NAME(state->m_iop_romaddr));
1116   save_item(NAME(m_cmd_pending));
1117   save_item(NAME(m_iop_cmd));
1118   save_item(NAME(m_iop_answer));
1119   save_item(NAME(m_iop_romaddr));
11221120}
11231121
11241122
r32461r32462
11271125{
11281126   m_lastresult = 0xffff;
11291127
1130   register_state_save(machine());
1128   register_state_save();
11311129}
11321130
11331131DRIVER_INIT_MEMBER(coolpool_state,coolpool)
11341132{
11351133   m_dsp->space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this));
11361134
1137   register_state_save(machine());
1135   register_state_save();
11381136}
11391137
11401138
r32461r32462
11781176      rom[a+1] = tmp;
11791177   }
11801178
1181   register_state_save(machine());
1179   register_state_save();
11821180}
11831181
11841182
trunk/src/mame/drivers/galaxian.c
r32461r32462
446446   {
447447      m_tenspot_current_game++;
448448      m_tenspot_current_game%=10;
449      tenspot_set_game_bank(machine(), m_tenspot_current_game, 1);
449      tenspot_set_game_bank(m_tenspot_current_game, 1);
450450      m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
451451   }
452452}
r32461r32462
59725972}
59735973
59745974
5975void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, int from_game)
5975void galaxian_state::tenspot_set_game_bank(int bank, int from_game)
59765976{
59775977   char tmp[64];
59785978   UINT8* srcregion;
r32461r32462
59805980   int x;
59815981
59825982   sprintf(tmp,"game_%d_cpu", bank);
5983   srcregion = machine.root_device().memregion(tmp)->base();
5984   dstregion = machine.root_device().memregion("maincpu")->base();
5983   srcregion = memregion(tmp)->base();
5984   dstregion = memregion("maincpu")->base();
59855985   memcpy(dstregion, srcregion, 0x4000);
59865986
59875987   sprintf(tmp,"game_%d_temp", bank);
5988   srcregion = machine.root_device().memregion(tmp)->base();
5989   dstregion = machine.root_device().memregion("gfx1")->base();
5988   srcregion = memregion(tmp)->base();
5989   dstregion = memregion("gfx1")->base();
59905990   memcpy(dstregion, srcregion, 0x2000);
5991   dstregion = machine.root_device().memregion("gfx2")->base();
5991   dstregion = memregion("gfx2")->base();
59925992   memcpy(dstregion, srcregion, 0x2000);
59935993
59945994   if (from_game)
r32461r32462
60056005   }
60066006
60076007   sprintf(tmp,"game_%d_prom", bank);
6008   srcregion = machine.root_device().memregion(tmp)->base();
6009   dstregion = machine.root_device().memregion("proms")->base();
6008   srcregion = memregion(tmp)->base();
6009   dstregion = memregion("proms")->base();
60106010   memcpy(dstregion, srcregion, 0x20);
60116011
60126012   PALETTE_INIT_NAME(galaxian)(m_palette);
r32461r32462
60326032
60336033   m_tenspot_current_game = 0;
60346034
6035   tenspot_set_game_bank(machine(), m_tenspot_current_game, 0);
6035   tenspot_set_game_bank(m_tenspot_current_game, 0);
60366036
60376037   space.install_read_handler(0x7000, 0x7000, read8_delegate(FUNC(galaxian_state::tenspot_dsw_read),this));
60386038}
trunk/src/mame/drivers/midzeus.c
r32461r32462
472472 *
473473 *************************************/
474474
475static void update_gun_irq(running_machine &machine)
475void midzeus_state::update_gun_irq()
476476{
477   midzeus_state *state = machine.driver_data<midzeus_state>();
478477   /* low 2 bits of gun_control seem to enable IRQs */
479478   if (gun_irq_state & gun_control & 0x03)
480      state->m_maincpu->set_input_line(3, ASSERT_LINE);
479      m_maincpu->set_input_line(3, ASSERT_LINE);
481480   else
482      state->m_maincpu->set_input_line(3, CLEAR_LINE);
481      m_maincpu->set_input_line(3, CLEAR_LINE);
483482}
484483
485484
r32461r32462
490489
491490   /* set the appropriate IRQ in the internal gun control and update */
492491   gun_irq_state |= 0x01 << player;
493   update_gun_irq(machine());
492   update_gun_irq();
494493
495494   /* generate another interrupt on the next scanline while we are within the BEAM_DY */
496495   beamy++;
r32461r32462
509508   /* bits 0-1 enable IRQs (?) */
510509   /* bits 2-3 reset IRQ states */
511510   gun_irq_state &= ~((gun_control >> 2) & 3);
512   update_gun_irq(machine());
511   update_gun_irq();
513512
514513   for (player = 0; player < 2; player++)
515514   {
trunk/src/mame/drivers/cobra.c
r32461r32462
387387   void draw_line(const rectangle &visarea, vertex_t &v1, vertex_t &v2);
388388
389389   void gfx_init();
390   void gfx_exit(running_machine &machine);
391   void gfx_reset(running_machine &machine);
392   void gfx_fifo_exec(running_machine &machine);
390   void gfx_exit();
391   void gfx_reset();
392   void gfx_fifo_exec();
393393   UINT32 gfx_read_gram(UINT32 address);
394394   void gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data);
395   UINT64 gfx_read_reg(running_machine &machine);
396   void gfx_write_reg(running_machine &machine, UINT64 data);
395   UINT64 gfx_read_reg();
396   void gfx_write_reg(UINT64 data);
397397
398398   void display(bitmap_rgb32 *bitmap, const rectangle &cliprect);
399399   inline rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format);
r32461r32462
998998
999999void cobra_state::cobra_video_exit()
10001000{
1001   m_renderer->gfx_exit(machine());
1001   m_renderer->gfx_exit();
10021002}
10031003
10041004void cobra_state::video_start()
r32461r32462
20322032   m_zbuffer->fill(*(int*)&zvalue, visarea);
20332033}
20342034
2035void cobra_renderer::gfx_exit(running_machine &machine)
2035void cobra_renderer::gfx_exit()
20362036{
20372037   /*
20382038   FILE *file;
r32461r32462
20482048   */
20492049}
20502050
2051void cobra_renderer::gfx_reset(running_machine &machine)
2051void cobra_renderer::gfx_reset()
20522052{
2053   cobra_state *cobra = machine.driver_data<cobra_state>();
2053   cobra_state *cobra = machine().driver_data<cobra_state>();
20542054
20552055   cobra->m_gfx_re_status = RE_STATUS_IDLE;
20562056}
r32461r32462
21252125   m_gfx_gram[address/4] |= data & mask;
21262126}
21272127
2128UINT64 cobra_renderer::gfx_read_reg(running_machine &machine)
2128UINT64 cobra_renderer::gfx_read_reg()
21292129{
21302130   return m_gfx_register[m_gfx_register_select];
21312131}
21322132
2133void cobra_renderer::gfx_write_reg(running_machine &machine, UINT64 data)
2133void cobra_renderer::gfx_write_reg(UINT64 data)
21342134{
21352135   switch (m_gfx_register_select)
21362136   {
r32461r32462
21502150   m_gfx_register[m_gfx_register_select] = data;
21512151}
21522152
2153void cobra_renderer::gfx_fifo_exec(running_machine &machine)
2153void cobra_renderer::gfx_fifo_exec()
21542154{
2155   cobra_state *cobra = machine.driver_data<cobra_state>();
2155   cobra_state *cobra = machine().driver_data<cobra_state>();
21562156
21572157   if (cobra->m_gfx_fifo_loopback != 0)
21582158      return;
r32461r32462
22302230               // 64-bit registers, top 32-bits in word 2, low 32-bit in word 3
22312231               printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]);
22322232
2233               gfx_write_reg(machine, ((UINT64)(w[2]) << 32) | w[3]);
2233               gfx_write_reg(((UINT64)(w[2]) << 32) | w[3]);
22342234            }
22352235            else if (w2 == 0x10521000)
22362236            {
r32461r32462
28322832{
28332833   UINT64 r = 0;
28342834
2835   m_renderer->gfx_fifo_exec(space.machine());
2835   m_renderer->gfx_fifo_exec();
28362836
28372837   if (ACCESSING_BITS_32_63)
28382838   {
r32461r32462
29582958
29592959//  printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), activecpu_get_pc());
29602960
2961   m_renderer->gfx_fifo_exec(space.machine());
2961   m_renderer->gfx_fifo_exec();
29622962
29632963   if (data == U64(0x00a0000110500018))
29642964   {
r32461r32462
29662966
29672967      // reads back the register selected by gfx register select
29682968
2969      UINT64 regdata = m_renderer->gfx_read_reg(space.machine());
2969      UINT64 regdata = m_renderer->gfx_read_reg();
29702970
29712971      m_gfxfifo_out->push(&space.device(), (UINT32)(regdata >> 32));
29722972      m_gfxfifo_out->push(&space.device(), (UINT32)(regdata));
r32461r32462
30123012      fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 32) | i);
30133013      fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >>  0) | i);
30143014
3015      cobra->m_renderer->gfx_fifo_exec(device->machine());
3015      cobra->m_renderer->gfx_fifo_exec();
30163016   }
30173017   else
30183018   {
r32461r32462
31503150   identify_device[51] = 0x0200;        /* 51: PIO data transfer cycle timing mode */
31513151   identify_device[67] = 0x01e0;        /* 67: minimum PIO transfer cycle time without flow control */
31523152
3153   m_renderer->gfx_reset(machine());
3153   m_renderer->gfx_reset();
31543154
31553155   m_sound_dma_ptr = 0;
31563156
trunk/src/mame/audio/n8080.c
r32461r32462
213213{
214214   UINT16 changes = ~m_curr_sound_pins & m_prev_sound_pins;
215215
216   /* ((state->m_curr_sound_pins >> 0xa) & 1) not emulated */
217   /* ((state->m_curr_sound_pins >> 0xb) & 1) not emulated */
218   /* ((state->m_curr_sound_pins >> 0xc) & 1) not emulated */
216   /* ((m_curr_sound_pins >> 0xa) & 1) not emulated */
217   /* ((m_curr_sound_pins >> 0xb) & 1) not emulated */
218   /* ((m_curr_sound_pins >> 0xc) & 1) not emulated */
219219
220220   if (changes & (1 << 6))
221221   {
trunk/src/mame/includes/midzeus.h
r32461r32462
8383
8484   void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
8585   void log_waveram(UINT32 length_and_base);
86   void update_gun_irq();
8687};
8788
8889
trunk/src/mame/includes/cave.h
r32461r32462
127127   required_device<timer_device> m_int_timer;
128128   optional_device<timer_device> m_int_timer_left;
129129   optional_device<timer_device> m_int_timer_right;
130   optional_device<eeprom_serial_93cxx_device> m_eeprom;
131   required_device<gfxdecode_device> m_gfxdecode;
132   required_device<screen_device> m_screen;
133   required_device<palette_device> m_palette;
130134   int m_rasflag;
131135   int m_old_rasflag;
132136   DECLARE_READ16_MEMBER(cave_irq_cause_r);
r32461r32462
237241   void sailormn_tilebank_w(int bank);
238242   DECLARE_WRITE_LINE_MEMBER(irqhandler);
239243   DECLARE_WRITE_LINE_MEMBER(sound_irq_gen);
240   optional_device<eeprom_serial_93cxx_device> m_eeprom;
241   required_device<gfxdecode_device> m_gfxdecode;
242   required_device<screen_device> m_screen;
243   required_device<palette_device> m_palette;
244244   void update_irq_state();
245245   void unpack_sprites(const char *region);
246246   void ddonpach_unpack_sprites(const char *region);
247247   void esprade_unpack_sprites(const char *region);
248   void sailormn_unpack_tiles(const char *region);
248249
249250private:
250251   inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX );
251252   inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 priority, UINT32 priority2, int GFX );
252253   inline void vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX );
253254   inline void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX );
255   inline void vctrl_w( address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX );
254256   void set_pens(int chip);
255257   void cave_vh_start( int num );
256258   void get_sprite_info_cave(int chip);
r32461r32462
265267   void sprite_draw_cave_zbuf( int chip, int priority );
266268   void sprite_draw_donpachi( int chip, int priority );
267269   void sprite_draw_donpachi_zbuf( int chip, int priority );
270   void init_cave();
271   void show_leds();
268272};
trunk/src/mame/includes/cosmic.h
r32461r32462
1818      : driver_device(mconfig, type, tag),
1919      m_videoram(*this, "videoram"),
2020      m_spriteram(*this, "spriteram"),
21      m_maincpu(*this, "maincpu"),
2122      m_samples(*this, "samples"),
2223      m_dac(*this, "dac"),
23      m_maincpu(*this, "maincpu"),
2424      m_gfxdecode(*this, "gfxdecode"),
2525      m_screen(*this, "screen"),
2626      m_palette(*this, "palette") { }
r32461r32462
3030   optional_shared_ptr<UINT8> m_spriteram;
3131
3232   /* video-related */
33   pen_t          (*m_map_color)(running_machine &machine, UINT8 x, UINT8 y);
33   typedef pen_t (cosmic_state::*color_func)(UINT8 x, UINT8 y);
34   color_func       m_map_color;
3435   int            m_color_registers[3];
3536   int            m_background_enable;
3637   int            m_magspot_pen_mask;
r32461r32462
4748   DECLARE_READ8_MEMBER( interrupt_level );
4849
4950   /* devices */
51   required_device<cpu_device> m_maincpu;
5052   optional_device<samples_device> m_samples;
5153   required_device<dac_device> m_dac;
54   optional_device<gfxdecode_device> m_gfxdecode;
55   required_device<screen_device> m_screen;
56   required_device<palette_device> m_palette;
57   
5258   DECLARE_WRITE8_MEMBER(panic_sound_output_w);
5359   DECLARE_WRITE8_MEMBER(panic_sound_output2_w);
5460   DECLARE_WRITE8_MEMBER(cosmicg_output_w);
r32461r32462
8591   UINT32 screen_update_devzone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8692   UINT32 screen_update_nomnlnd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8793   TIMER_DEVICE_CALLBACK_MEMBER(panic_scanline);
88   void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect );
89   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites );
90   void cosmica_draw_starfield( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
91   void devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect );
92   void nomnlnd_draw_background( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
93   required_device<cpu_device> m_maincpu;
94   optional_device<gfxdecode_device> m_gfxdecode;
95   required_device<screen_device> m_screen;
96   required_device<palette_device> m_palette;
94   void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
95   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites);
96   void cosmica_draw_starfield(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
97   void devzone_draw_grid(bitmap_ind16 &bitmap, const rectangle &cliprect);
98   void nomnlnd_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
99   pen_t panic_map_color(UINT8 x, UINT8 y);
100   pen_t cosmica_map_color(UINT8 x, UINT8 y);
101   pen_t cosmicg_map_color(UINT8 x, UINT8 y);
102   pen_t magspot_map_color(UINT8 x, UINT8 y);
97103};
trunk/src/mame/includes/segas32.h
r32461r32462
267267   void update_bitmap(screen_device &screen, struct layer_info *layer, const rectangle &cliprect);
268268   void update_background(struct layer_info *layer, const rectangle &cliprect);
269269   DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler);
270   void signal_sound_irq(int which);
271   void clear_sound_irq(int which);
270272};
271273
272274/*----------- defined in machine/segas32.c -----------*/
trunk/src/mame/includes/coolpool.h
r32461r32462
88public:
99   coolpool_state(const machine_config &mconfig, device_type type, const char *tag)
1010      : driver_device(mconfig, type, tag),
11      m_maincpu(*this, "maincpu"),
12      m_dsp(*this, "dsp"),
13      m_dac(*this, "dac"),
1114      m_tlc34076(*this, "tlc34076"),
1215      m_vram_base(*this, "vram_base"),
13      m_nvram(*this, "nvram"),
14      m_maincpu(*this, "maincpu"),
15      m_dsp(*this, "dsp"),
16      m_dac(*this, "dac"){ }
16      m_nvram(*this, "nvram") { }
1717
18   required_device<cpu_device> m_maincpu;
19   required_device<cpu_device> m_dsp;
20   required_device<dac_device> m_dac;
1821   optional_device<tlc34076_device> m_tlc34076;
22   
1923   required_shared_ptr<UINT16> m_vram_base;
2024   required_shared_ptr<UINT16> m_nvram;
2125
r32461r32462
3337
3438   UINT16 m_result;
3539   UINT16 m_lastresult;
36
37   required_device<cpu_device> m_maincpu;
38   required_device<cpu_device> m_dsp;
40   
3941   UINT16 m_nvram_write_seq[NVRAM_UNLOCK_SEQ_LEN];
4042   UINT8 m_nvram_write_enable;
4143   UINT8 m_old_cmd;
r32461r32462
7375   TIMER_CALLBACK_MEMBER(deferred_iop_w);
7476   TIMER_DEVICE_CALLBACK_MEMBER(nvram_write_timeout);
7577   TIMER_DEVICE_CALLBACK_MEMBER(amerdart_audio_int_gen);
76   required_device<dac_device> m_dac;
78   void register_state_save();
7779};
trunk/src/mame/includes/galaxian.h
r32461r32462
258258   virtual void video_start();
259259   DECLARE_PALETTE_INIT(galaxian);
260260   DECLARE_PALETTE_INIT(moonwar);
261   void tenspot_set_game_bank(running_machine& machine, int bank, int from_game);
261   void tenspot_set_game_bank(int bank, int from_game);
262262   UINT32 screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
263263   INTERRUPT_GEN_MEMBER(interrupt_gen);
264264   INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen);
trunk/src/mame/video/cosmic.c
r32461r32462
1616}
1717
1818
19static pen_t panic_map_color( running_machine &machine, UINT8 x, UINT8 y )
19pen_t cosmic_state::panic_map_color( UINT8 x, UINT8 y )
2020{
21   cosmic_state *state = machine.driver_data<cosmic_state>();
22   offs_t offs = (state->m_color_registers[0] << 9) | (state->m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
23   pen_t pen = state->memregion("user1")->base()[offs];
21   offs_t offs = (m_color_registers[0] << 9) | (m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
22   pen_t pen = memregion("user1")->base()[offs];
2423
25   if (state->m_color_registers[1])
24   if (m_color_registers[1])
2625      pen >>= 4;
2726
2827   return pen & 0x0f;
2928}
3029
31static pen_t cosmica_map_color( running_machine &machine, UINT8 x, UINT8 y )
30pen_t cosmic_state::cosmica_map_color( UINT8 x, UINT8 y )
3231{
33   cosmic_state *state = machine.driver_data<cosmic_state>();
34   offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
35   pen_t pen = state->memregion("user1")->base()[offs];
32   offs_t offs = (m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
33   pen_t pen = memregion("user1")->base()[offs];
3634
37   if (state->m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors
35   if (m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors
3836      pen >>= 4;
3937
4038   return pen & 0x07;
4139}
4240
43static pen_t cosmicg_map_color( running_machine &machine, UINT8 x, UINT8 y )
41pen_t cosmic_state::cosmicg_map_color( UINT8 x, UINT8 y )
4442{
45   cosmic_state *state = machine.driver_data<cosmic_state>();
46   offs_t offs = (state->m_color_registers[0] << 8) | (state->m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
47   pen_t pen = state->memregion("user1")->base()[offs];
43   offs_t offs = (m_color_registers[0] << 8) | (m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
44   pen_t pen = memregion("user1")->base()[offs];
4845
4946   /* the upper 4 bits are for cocktail mode support */
5047   return pen & 0x0f;
5148}
5249
53static pen_t magspot_map_color( running_machine &machine, UINT8 x, UINT8 y )
50pen_t cosmic_state::magspot_map_color( UINT8 x, UINT8 y )
5451{
55   cosmic_state *state = machine.driver_data<cosmic_state>();
56   offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
57   pen_t pen = state->memregion("user1")->base()[offs];
52   offs_t offs = (m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
53   pen_t pen = memregion("user1")->base()[offs];
5854
59   if (state->m_color_registers[1])
55   if (m_color_registers[1])
6056      pen >>= 4;
6157
62   return pen & state->m_magspot_pen_mask;
58   return pen & m_magspot_pen_mask;
6359}
6460
6561
r32461r32462
10197      palette.set_pen_indirect(i, ctabentry);
10298   }
10399
104   m_map_color = panic_map_color;
100   m_map_color = &cosmic_state::panic_map_color;
105101}
106102
107103
r32461r32462
141137      palette.set_pen_indirect(i + 0x20, ctabentry);
142138   }
143139
144   m_map_color = cosmica_map_color;
140   m_map_color = &cosmic_state::cosmica_map_color;
145141}
146142
147143
r32461r32462
167163      palette.set_pen_color(i, rgb_t(r, g, b));
168164   }
169165
170   m_map_color = cosmicg_map_color;
166   m_map_color = &cosmic_state::cosmicg_map_color;
171167}
172168
173169
r32461r32462
197193      palette.set_pen_indirect(i, ctabentry);
198194   }
199195
200   m_map_color = magspot_map_color;
196   m_map_color = &cosmic_state::magspot_map_color;
201197   m_magspot_pen_mask = 0x0f;
202198}
203199
r32461r32462
225221      palette.set_pen_indirect(i, ctabentry);
226222   }
227223
228   m_map_color = magspot_map_color;
224   m_map_color = &cosmic_state::magspot_map_color;
229225   m_magspot_pen_mask = 0x07;
230226}
231227
r32461r32462
248244      UINT8 x = offs << 3;
249245      UINT8 y = offs >> 5;
250246
251      pen_t pen = m_map_color(machine(), x, y);
247      pen_t pen = (this->*m_map_color)(x, y);
252248
253249      for (i = 0; i < 8; i++)
254250      {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team