Previous 199869 Revisions Next

r29439 Tuesday 8th April, 2014 at 09:28:25 UTC by Fabio Priuli
nes ppu: converted to use inline config + removed some unused config values. nw.
vsnes/playch10: reduce tagmap lookups at runtime. nw.
[src/mame/drivers]cham24.c famibox.c multigam.c playch10.c vsnes.c
[src/mame/includes]playch10.h vsnes.h
[src/mame/machine]playch10.c vsnes.c
[src/mame/video]playch10.c ppu2c0x.c ppu2c0x.h vsnes.c
[src/mess/drivers]nes.c

trunk/src/mess/drivers/nes.c
r29438r29439
652652}
653653
654654
655static const ppu2c0x_interface nes_ppu_interface =
656{
657   "maincpu",
658   0,
659   0,
660   PPU_MIRROR_NONE
661};
662
663655static const floppy_interface nes_floppy_interface =
664656{
665657   DEVCB_NULL,
r29438r29439
710702   MCFG_PALETTE_ADD("palette", 4*16*8)
711703   MCFG_PALETTE_INIT_OWNER(nes_state, nes)
712704
713   MCFG_PPU2C02_ADD("ppu", nes_ppu_interface)
705   MCFG_PPU2C02_ADD("ppu")
706   MCFG_PPU2C0X_CPU("maincpu")
714707   MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi)
715708
716709   /* sound hardware */
r29438r29439
734727   MCFG_CPU_CLOCK(PAL_CLOCK)
735728
736729   MCFG_DEVICE_REMOVE("ppu")
737   MCFG_PPU2C07_ADD("ppu", nes_ppu_interface)
730   MCFG_PPU2C07_ADD("ppu")
731   MCFG_PPU2C0X_CPU("maincpu")
738732   MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi)
739733
740734   /* video hardware */
r29438r29439
757751   MCFG_CPU_CLOCK( 26601712/15 ) /* 26.601712MHz / 15 == 1.77344746666... MHz */
758752
759753   MCFG_DEVICE_REMOVE("ppu")
760   MCFG_PPU2C07_ADD("ppu", nes_ppu_interface)
754   MCFG_PPU2C07_ADD("ppu")
755   MCFG_PPU2C0X_CPU("maincpu")
761756   MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi)
762757
763758   /* video hardware */
trunk/src/mame/includes/vsnes.h
r29438r29439
128128
129129   DECLARE_READ8_MEMBER( vsnes_bootleg_z80_latch_r );
130130};
131
132/*----------- defined in video/vsnes.c -----------*/
133extern const ppu2c0x_interface vsnes_ppu_interface_1;
134extern const ppu2c0x_interface vsnes_ppu_interface_2;
trunk/src/mame/includes/playch10.h
r29438r29439
142142   void ppu_irq(int *ppu_regs);
143143   void mapper9_latch(offs_t offset);
144144};
145
146/*----------- defined in video/playch10.c -----------*/
147extern const ppu2c0x_interface playch10_ppu_interface;
trunk/src/mame/video/ppu2c0x.c
r29438r29439
111111
112112void ppu2c0x_device::device_config_complete()
113113{
114   const ppu2c0x_interface *config = reinterpret_cast<const ppu2c0x_interface *>(static_config());
115   assert(config);
116
117114   /* reset the callbacks */
118115   m_latch = ppu2c0x_latch_delegate();
119116   m_scanline_callback_proc = ppu2c0x_scanline_delegate();
120117   m_hblank_callback_proc = ppu2c0x_hblank_delegate();
121118   m_vidaccess_callback_proc = ppu2c0x_vidaccess_delegate();
122
123   m_color_base = config->color_base;
124
125   m_cpu_tag = config->cpu_tag;
126119}
127120
128121ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
r29438r29439
130123               device_memory_interface(mconfig, *this),
131124               device_video_interface(mconfig, *this),
132125               m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(ppu2c0x)),
126               m_cpu(*this),
133127               m_scanline(0),  // reset the scanline count
134128               m_refresh_data(0),
135129               m_refresh_latch(0),
r29438r29439
142136               m_tile_page(0),
143137               m_sprite_page(0),
144138               m_back_color(0),
139               m_color_base(0),
145140               m_scan_scale(1), // set the scan scale (this is for dual monitor vertical setups)
146141               m_tilecount(0),
147142               m_draw_phase(0)
r29438r29439
210205
211206void ppu2c0x_device::device_start()
212207{
213   m_cpu = machine().device<cpu_device>( m_cpu_tag );
214
215   assert(m_cpu);
216
217208   // bind our handler
218209   m_nmi_callback_proc.bind_relative_to(*owner());
219210
trunk/src/mame/video/ppu2c0x.h
r29438r29439
8383//  INTERFACE CONFIGURATION MACROS
8484///*************************************************************************
8585
86#define MCFG_PPU2C0X_ADD(_tag, _type, _intrf)   \
87   MCFG_DEVICE_ADD(_tag, _type, 0) \
88   MCFG_DEVICE_CONFIG(_intrf)
86#define MCFG_PPU2C0X_ADD(_tag, _type)   \
87   MCFG_DEVICE_ADD(_tag, _type, 0)
8988
90#define MCFG_PPU2C02_ADD(_tag, _intrf)   \
91   MCFG_PPU2C0X_ADD(_tag, PPU_2C02, _intrf)
92#define MCFG_PPU2C03B_ADD(_tag, _intrf)   \
93   MCFG_PPU2C0X_ADD(_tag, PPU_2C03B, _intrf)
94#define MCFG_PPU2C04_ADD(_tag, _intrf)   \
95   MCFG_PPU2C0X_ADD(_tag, PPU_2C04, _intrf)
96#define MCFG_PPU2C07_ADD(_tag, _intrf)   \
97   MCFG_PPU2C0X_ADD(_tag, PPU_2C07, _intrf)
98#define MCFG_PPU2C05_01_ADD(_tag, _intrf)   \
99   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_01, _intrf)
100#define MCFG_PPU2C05_02_ADD(_tag, _intrf)   \
101   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_02, _intrf)
102#define MCFG_PPU2C05_03_ADD(_tag, _intrf)   \
103   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_03, _intrf)
104#define MCFG_PPU2C05_04_ADD(_tag, _intrf)   \
105   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_04, _intrf)
89#define MCFG_PPU2C02_ADD(_tag)   \
90   MCFG_PPU2C0X_ADD(_tag, PPU_2C02)
91#define MCFG_PPU2C03B_ADD(_tag)   \
92   MCFG_PPU2C0X_ADD(_tag, PPU_2C03B)
93#define MCFG_PPU2C04_ADD(_tag)   \
94   MCFG_PPU2C0X_ADD(_tag, PPU_2C04)
95#define MCFG_PPU2C07_ADD(_tag)   \
96   MCFG_PPU2C0X_ADD(_tag, PPU_2C07)
97#define MCFG_PPU2C05_01_ADD(_tag)   \
98   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_01)
99#define MCFG_PPU2C05_02_ADD(_tag)   \
100   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_02)
101#define MCFG_PPU2C05_03_ADD(_tag)   \
102   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_03)
103#define MCFG_PPU2C05_04_ADD(_tag)   \
104   MCFG_PPU2C0X_ADD(_tag, PPU_2C05_04)
106105
107106#define MCFG_PPU2C0X_SET_SCREEN MCFG_VIDEO_SET_SCREEN
108107
109#define MCFG_PPU2C0X_SET_NMI( _class, _method) \
108#define MCFG_PPU2C0X_CPU(_tag) \
109   ppu2c0x_device::set_cpu_tag(*device, "^"_tag);
110
111#define MCFG_PPU2C0X_COLORBASE(_color) \
112   ppu2c0x_device::set_color_base(*device, _color);
113
114#define MCFG_PPU2C0X_SET_NMI(_class, _method) \
110115   ppu2c0x_device::set_nmi_delegate(*device, ppu2c0x_nmi_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
111116
117
112118///*************************************************************************
113119//  TYPE DEFINITIONS
114120///*************************************************************************
r29438r29439
119125typedef device_delegate<void (offs_t offset)> ppu2c0x_latch_delegate;
120126
121127
122// ======================> ppu2c0x_interface
123
124struct ppu2c0x_interface
125{
126   const char        *cpu_tag;
127   int               gfx_layout_number;        /* gfx layout number used by each chip */
128   int               color_base;               /* color base to use per ppu */
129   int               mirroring;                /* mirroring options (PPU_MIRROR_* flag) */
130};
131
132
133128// ======================> ppu2c0x_device
134129
135130class ppu2c0x_device :  public device_t,
136131                  public device_memory_interface,
137                  public device_video_interface,
138                  public ppu2c0x_interface
132                  public device_video_interface
139133{
140134public:
141135   // construction/destruction
r29438r29439
154148   // address space configurations
155149   const address_space_config      m_space_config;
156150
151   static void set_cpu_tag(device_t &device, const char *tag) { downcast<ppu2c0x_device &>(device).m_cpu.set_tag(tag); }
152   static void set_color_base(device_t &device, int colorbase) { downcast<ppu2c0x_device &>(device).m_color_base = colorbase; }
153   static void set_nmi_delegate(device_t &device, ppu2c0x_nmi_delegate cb);
157154
158155   /* routines */
159156   void init_palette( palette_device &palette, int first_entry );
r29438r29439
173170   void set_scanline_callback( ppu2c0x_scanline_delegate cb ) { m_scanline_callback_proc = cb; m_scanline_callback_proc.bind_relative_to(*owner()); };
174171   void set_hblank_callback( ppu2c0x_hblank_delegate cb ) { m_hblank_callback_proc = cb; m_hblank_callback_proc.bind_relative_to(*owner()); };
175172   void set_vidaccess_callback( ppu2c0x_vidaccess_delegate cb ) { m_vidaccess_callback_proc = cb; m_vidaccess_callback_proc.bind_relative_to(*owner()); };
176   static void set_nmi_delegate(device_t &device,ppu2c0x_nmi_delegate cb);
177173   void set_scanlines_per_frame( int scanlines ) { m_scanlines_per_frame = scanlines; };
178174
179175   // MMC5 has to be able to check this
r29438r29439
186182
187183   //  void update_screen(bitmap_t &bitmap, const rectangle &cliprect);
188184
189   cpu_device                  *m_cpu;
185   required_device<cpu_device> m_cpu;
186
190187   bitmap_ind16                *m_bitmap;          /* target bitmap */
191188   UINT8                       *m_spriteram;           /* sprite ram */
192189   pen_t                       *m_colortable;          /* color table modified at run time */
r29438r29439
222219   emu_timer                   *m_nmi_timer;           /* NMI timer */
223220   emu_timer                   *m_scanline_timer;      /* scanline timer */
224221
225   const char        *m_cpu_tag;
226
227222private:
228223   static const device_timer_id TIMER_HBLANK = 0;
229224   static const device_timer_id TIMER_NMI = 1;
trunk/src/mame/video/playch10.c
r29438r29439
1717PALETTE_INIT_MEMBER(playch10_state, playch10)
1818{
1919   const UINT8 *color_prom = memregion("proms")->base();
20   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
21   int i;
2220
23   for (i = 0; i < 256; i++)
21   for (int i = 0; i < 256; i++)
2422   {
2523      int bit0, bit1, bit2, bit3, r, g, b;
2624
r29438r29439
5553      color_prom++;
5654   }
5755
58   ppu->init_palette_rgb(palette, 256);
56   m_ppu->init_palette_rgb(palette, 256);
5957}
6058
6159void playch10_state::ppu_irq(int *ppu_regs)
r29438r29439
6462   m_pc10_int_detect = 1;
6563}
6664
67/* our ppu interface                                           */
68/* things like mirroring and whether to use vrom or vram       */
69/* can be set by calling 'ppu2c0x_override_hardware_options'   */
70
71const ppu2c0x_interface playch10_ppu_interface =
72{
73   "cart",
74   1,                  /* gfxlayout num */
75   256,                /* color base */
76   PPU_MIRROR_NONE     /* mirroring */
77};
78
7965TILE_GET_INFO_MEMBER(playch10_state::get_bg_tile_info)
8066{
8167   UINT8 *videoram = m_videoram;
r29438r29439
11298
11399UINT32 playch10_state::screen_update_playch10_single(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
114100{
115   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
116
117101   rectangle top_monitor = screen.visible_area();
118102
119   top_monitor.max_y = ( top_monitor.max_y - top_monitor.min_y ) / 2;
103   top_monitor.max_y = (top_monitor.max_y - top_monitor.min_y) / 2;
120104
121   if(m_pc10_dispmask_old != m_pc10_dispmask)
105   if (m_pc10_dispmask_old != m_pc10_dispmask)
122106   {
123107      m_pc10_dispmask_old = m_pc10_dispmask;
124108
125      if(m_pc10_dispmask)
109      if (m_pc10_dispmask)
126110         m_pc10_game_mode ^= 1;
127111   }
128112
129   if ( m_pc10_game_mode )
113   if (m_pc10_game_mode)
130114      /* render the ppu */
131      ppu->render(bitmap, 0, 0, 0, 0 );
115      m_ppu->render(bitmap, 0, 0, 0, 0);
132116   else
133117   {
134118      /* When the bios is accessing vram, the video circuitry can't access it */
135      if ( !m_pc10_sdcs )
119      if (!m_pc10_sdcs)
136120         m_bg_tilemap->draw(screen, bitmap, top_monitor, 0, 0);
137121   }
138122   return 0;
r29438r29439
140124
141125UINT32 playch10_state::screen_update_playch10_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
142126{
143   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
144
145127   /* Single Monitor version */
146128   if (m_pc10_bios != 1)
147129      return screen_update_playch10_single(screen, bitmap, cliprect);
148130
149131   if (!m_pc10_dispmask)
150132      /* render the ppu */
151      ppu->render(bitmap, 0, 0, 0, 0);
133      m_ppu->render(bitmap, 0, 0, 0, 0);
152134   else
153135      bitmap.fill(0, cliprect);
154136
r29438r29439
162144      return screen_update_playch10_single(screen, bitmap, cliprect);
163145
164146   /* When the bios is accessing vram, the video circuitry can't access it */
165
166   if ( !m_pc10_sdcs )
147   if (!m_pc10_sdcs)
167148      m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
168149   else
169150      bitmap.fill(0, cliprect);
trunk/src/mame/video/vsnes.c
r29438r29439
55
66PALETTE_INIT_MEMBER(vsnes_state,vsnes)
77{
8   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu1");
9   ppu->init_palette_rgb(palette, 0 );
8   m_ppu1->init_palette_rgb(palette, 0);
109}
1110
1211PALETTE_INIT_MEMBER(vsnes_state,vsdual)
1312{
14   ppu2c0x_device *ppu1 = machine().device<ppu2c0x_device>("ppu1");
15   ppu2c0x_device *ppu2 = machine().device<ppu2c0x_device>("ppu2");
16   ppu1->init_palette_rgb(palette, 0 );
17   ppu2->init_palette_rgb(palette, 8*4*16 );
13   m_ppu1->init_palette_rgb(palette, 0);
14   m_ppu2->init_palette_rgb(palette, 8 * 4 * 16);
1815}
1916
2017void vsnes_state::ppu_irq_1(int *ppu_regs)
2118{
22   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
19   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
2320}
2421
2522void vsnes_state::ppu_irq_2(int *ppu_regs)
2623{
27   m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
24   m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
2825}
2926
30/* our ppu interface                                            */
31const ppu2c0x_interface vsnes_ppu_interface_1 =
32{
33   "maincpu",
34   0,                  /* gfxlayout num */
35   0,                  /* color base */
36   PPU_MIRROR_NONE     /* mirroring */
37};
38
39/* our ppu interface for dual games                             */
40const ppu2c0x_interface vsnes_ppu_interface_2 =
41{
42   "sub",
43   1,                  /* gfxlayout num */
44   512,                /* color base */
45   PPU_MIRROR_NONE     /* mirroring */
46};
47
4827VIDEO_START_MEMBER(vsnes_state,vsnes )
4928{
5029}
r29438r29439
5837  Display refresh
5938
6039***************************************************************************/
40
6141UINT32 vsnes_state::screen_update_vsnes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6242{
6343   /* render the ppu */
64   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu1");
65   ppu->render(bitmap, 0, 0, 0, 0);
44   m_ppu1->render(bitmap, 0, 0, 0, 0);
6645   return 0;
6746}
6847
6948UINT32 vsnes_state::screen_update_vsnes_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
7049{
71   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu2");
72   ppu->render(bitmap, 0, 0, 0, 0);
50   m_ppu2->render(bitmap, 0, 0, 0, 0);
7351   return 0;
7452}
trunk/src/mame/drivers/cham24.c
r29438r29439
291291   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
292292}
293293
294/* our ppu interface                                            */
295static const ppu2c0x_interface ppu_interface =
296{
297   "maincpu",
298   0,                  /* gfxlayout num */
299   0,                  /* color base */
300   PPU_MIRROR_NONE     /* mirroring */
301};
302
303294void cham24_state::video_start()
304295{
305296}
r29438r29439
362353   MCFG_PALETTE_ADD("palette", 8*4*16)
363354   MCFG_PALETTE_INIT_OWNER(cham24_state, cham24)
364355
365   MCFG_PPU2C04_ADD("ppu", ppu_interface)
356   MCFG_PPU2C04_ADD("ppu")
357   MCFG_PPU2C0X_CPU("maincpu")
366358   MCFG_PPU2C0X_SET_NMI(cham24_state, ppu_irq)
367359
368360   /* sound hardware */
trunk/src/mame/drivers/famibox.c
r29438r29439
526526   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
527527}
528528
529/* our ppu interface                                            */
530static const ppu2c0x_interface ppu_interface =
531{
532   "maincpu",
533   0,                  /* gfxlayout num */
534   0,                  /* color base */
535   PPU_MIRROR_NONE     /* mirroring */
536};
537
538529void famibox_state::video_start()
539530{
540531}
r29438r29439
596587   MCFG_PALETTE_ADD("palette", 8*4*16)
597588   MCFG_PALETTE_INIT_OWNER(famibox_state, famibox)
598589
599
600   MCFG_PPU2C04_ADD("ppu", ppu_interface)
590   MCFG_PPU2C04_ADD("ppu")
591   MCFG_PPU2C0X_CPU("maincpu")
601592   MCFG_PPU2C0X_SET_NMI(famibox_state, ppu_irq)
602593
603594   /* sound hardware */
trunk/src/mame/drivers/playch10.c
r29438r29439
665665   "cart"
666666};
667667
668
669668static MACHINE_CONFIG_START( playch10, playch10_state )
670669   // basic machine hardware
671670   MCFG_CPU_ADD("maincpu", Z80, 8000000/2) // 4 MHz
r29438r29439
697696   MCFG_SCREEN_UPDATE_DRIVER(playch10_state, screen_update_playch10_bottom)
698697   MCFG_SCREEN_PALETTE("palette")
699698
700
701   MCFG_PPU2C03B_ADD("ppu", playch10_ppu_interface)
699   MCFG_PPU2C03B_ADD("ppu")
702700   MCFG_PPU2C0X_SET_SCREEN("bottom")
701   MCFG_PPU2C0X_CPU("cart")
702   MCFG_PPU2C0X_COLORBASE(256)
703703   MCFG_PPU2C0X_SET_NMI(playch10_state, ppu_irq)
704704
705705   // sound hardware
trunk/src/mame/drivers/vsnes.c
r29438r29439
17281728   MCFG_PALETTE_INIT_OWNER(vsnes_state,vsnes)
17291729   MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsnes)
17301730
1731   MCFG_PPU2C04_ADD("ppu1", vsnes_ppu_interface_1)
1731   MCFG_PPU2C04_ADD("ppu1")
17321732   MCFG_PPU2C0X_SET_SCREEN("screen1")
1733   MCFG_PPU2C0X_CPU("maincpu")
17331734   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
17341735
17351736   /* sound hardware */
r29438r29439
17461747static MACHINE_CONFIG_DERIVED( jajamaru, vsnes )
17471748
17481749   MCFG_DEVICE_REMOVE( "ppu1" )
1749   MCFG_PPU2C05_01_ADD("ppu1", vsnes_ppu_interface_1)
1750   MCFG_PPU2C05_01_ADD("ppu1")
17501751   MCFG_PPU2C0X_SET_SCREEN("screen1")
1752   MCFG_PPU2C0X_CPU("maincpu")
17511753   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
17521754MACHINE_CONFIG_END
17531755
17541756static MACHINE_CONFIG_DERIVED( mightybj, vsnes )
17551757
17561758   MCFG_DEVICE_REMOVE( "ppu1" )
1757   MCFG_PPU2C05_02_ADD("ppu1", vsnes_ppu_interface_1)
1759   MCFG_PPU2C05_02_ADD("ppu1")
17581760   MCFG_PPU2C0X_SET_SCREEN("screen1")
1761   MCFG_PPU2C0X_CPU("maincpu")
17591762   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
17601763MACHINE_CONFIG_END
17611764
17621765static MACHINE_CONFIG_DERIVED( vsgshoe, vsnes )
17631766
17641767   MCFG_DEVICE_REMOVE( "ppu1" )
1765   MCFG_PPU2C05_03_ADD("ppu1", vsnes_ppu_interface_1)
1768   MCFG_PPU2C05_03_ADD("ppu1")
17661769   MCFG_PPU2C0X_SET_SCREEN("screen1")
1770   MCFG_PPU2C0X_CPU("maincpu")
17671771   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
17681772MACHINE_CONFIG_END
17691773
17701774static MACHINE_CONFIG_DERIVED( topgun, vsnes )
17711775
17721776   MCFG_DEVICE_REMOVE( "ppu1" )
1773   MCFG_PPU2C05_04_ADD("ppu1", vsnes_ppu_interface_1)
1777   MCFG_PPU2C05_04_ADD("ppu1")
17741778   MCFG_PPU2C0X_SET_SCREEN("screen1")
1779   MCFG_PPU2C0X_CPU("maincpu")
17751780   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
17761781MACHINE_CONFIG_END
17771782
r29438r29439
18091814
18101815   MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsdual)
18111816
1812   MCFG_PPU2C04_ADD("ppu1", vsnes_ppu_interface_1)
1817   MCFG_PPU2C04_ADD("ppu1")
18131818   MCFG_PPU2C0X_SET_SCREEN("screen1")
1819   MCFG_PPU2C0X_CPU("maincpu")
18141820   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
1815   MCFG_PPU2C04_ADD("ppu2", vsnes_ppu_interface_2)
1821
1822   MCFG_PPU2C04_ADD("ppu2")
18161823   MCFG_PPU2C0X_SET_SCREEN("screen2")
1824   MCFG_PPU2C0X_CPU("sub")
1825   MCFG_PPU2C0X_COLORBASE(512)
18171826   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_2)
18181827
18191828   /* sound hardware */
r29438r29439
18481857   MCFG_CPU_PROGRAM_MAP(vsnes_bootleg_z80_map)
18491858   MCFG_CPU_VBLANK_INT_DRIVER("screen1", vsnes_state,  irq0_line_hold)
18501859
1851
1852
18531860   /* video hardware */
18541861   MCFG_SCREEN_ADD("screen1", RASTER)
18551862   MCFG_SCREEN_REFRESH_RATE(60)
r29438r29439
18631870   MCFG_PALETTE_INIT_OWNER(vsnes_state,vsnes)
18641871   MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsnes)
18651872
1866   MCFG_PPU2C04_ADD("ppu1", vsnes_ppu_interface_1)
1873   MCFG_PPU2C04_ADD("ppu1")
1874   MCFG_PPU2C0X_CPU("maincpu")
18671875   MCFG_PPU2C0X_SET_SCREEN("screen1")
18681876   MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_1)
18691877
trunk/src/mame/drivers/multigam.c
r29438r29439
11551155   m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
11561156}
11571157
1158/* our ppu interface                                            */
1159static const ppu2c0x_interface ppu_interface =
1160{
1161   "maincpu",
1162   0,                  /* gfxlayout num */
1163   0,                  /* color base */
1164   PPU_MIRROR_NONE     /* mirroring */
1165};
1166
11671158void multigam_state::video_start()
11681159{
11691160}
r29438r29439
12631254   MCFG_PALETTE_ADD("palette", 8*4*16)
12641255   MCFG_PALETTE_INIT_OWNER(multigam_state, multigam)
12651256
1266   MCFG_PPU2C04_ADD("ppu", ppu_interface)
1257   MCFG_PPU2C04_ADD("ppu")
1258   MCFG_PPU2C0X_CPU("maincpu")
12671259   MCFG_PPU2C0X_SET_NMI(multigam_state, ppu_irq)
12681260
12691261   /* sound hardware */
trunk/src/mame/machine/playch10.c
r29438r29439
237237   /* do the gun thing */
238238   if (m_pc10_gun_controller)
239239   {
240      ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
241240      int trigger = ioport("P1")->read();
242241      int x = ioport("GUNX")->read();
243242      int y = ioport("GUNY")->read();
r29438r29439
247246      ret |= 0x08;
248247
249248      /* get the pixel at the gun position */
250      pix = ppu->get_pixel(x, y);
249      pix = m_ppu->get_pixel(x, y);
251250
252251      /* get the color base from the ppu */
253      color_base = ppu->get_colorbase();
252      color_base = m_ppu->get_colorbase();
254253
255254      /* look at the screen and see if the cursor is over a bright pixel */
256255      if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
trunk/src/mame/machine/vsnes.c
r29438r29439
343343
344344WRITE8_MEMBER(vsnes_state::gun_in0_w)
345345{
346   ppu2c0x_device *ppu1 = machine().device<ppu2c0x_device>("ppu1");
347
348346   if (m_do_vrom_bank)
349347   {
350348      /* switch vrom */
r29438r29439
363361      UINT32 pix, color_base;
364362
365363      /* get the pixel at the gun position */
366      pix = ppu1->get_pixel(x, y);
364      pix = m_ppu1->get_pixel(x, y);
367365
368366      /* get the color base from the ppu */
369      color_base = ppu1->get_colorbase();
367      color_base = m_ppu1->get_colorbase();
370368
371369      /* look at the screen and see if the cursor is over a bright pixel */
372370      if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) ||
r29438r29439
669667
670668WRITE8_MEMBER(vsnes_state::mapper4_w)
671669{
672   ppu2c0x_device *ppu1 = machine().device<ppu2c0x_device>("ppu1");
673670   UINT8 MMC3_helper, cmd;
674671
675672   switch (offset & 0x6001)
r29438r29439
718715
719716      case 0x2001: /* $a001 - extra RAM enable/disable */
720717         /* ignored - we always enable it */
721
722718         break;
719
723720      case 0x4000: /* $c000 - IRQ scanline counter */
724721         m_IRQ_count = data;
725
726722         break;
727723
728724      case 0x4001: /* $c001 - IRQ scanline latch */
729725         m_IRQ_count_latch = data;
730
731726         break;
732727
733728      case 0x6000: /* $e000 - Disable IRQs */
734729         m_IRQ_enable = 0;
735730         m_IRQ_count = m_IRQ_count_latch;
736
737         ppu1->set_scanline_callback(ppu2c0x_scanline_delegate());
738
731         m_ppu1->set_scanline_callback(ppu2c0x_scanline_delegate());
739732         break;
740733
741734      case 0x6001: /* $e001 - Enable IRQs */
742735         m_IRQ_enable = 1;
743         ppu1->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(vsnes_state::mapper4_irq),this));
744
736         m_ppu1->set_scanline_callback(ppu2c0x_scanline_delegate(FUNC(vsnes_state::mapper4_irq), this));
745737         break;
746738
747739      default:

Previous 199869 Revisions Next


© 1997-2024 The MAME Team