Previous 199869 Revisions Next

r44370 Saturday 23rd January, 2016 at 16:30:14 UTC by Ryan Holtz
Fix more crashes
[src/mame/audio]cclimber.cpp cclimber.h
[src/mame/drivers]4enraya.cpp dkong.cpp
[src/mame/includes]4enraya.h dkong.h nb1414m4.h
[src/mame/machine]nb1414m4.cpp
[src/mame/video]n64.cpp sega16sp.cpp sega16sp.h

trunk/src/mame/audio/cclimber.cpp
r252881r252882
1212
1313SAMPLES_START_CB_MEMBER( cclimber_audio_device::sh_start )
1414{
15   if (machine().root_device().memregion("samples")->base())
16      m_sample_buf = std::make_unique<INT16[]>(2 * machine().root_device().memregion("samples")->bytes());
17      save_pointer(NAME(m_sample_buf.get()), 2 * machine().root_device().memregion("samples")->bytes());
15   if (m_samples_region)
16   {
17      m_sample_buf = std::make_unique<INT16[]>(2 * m_samples_region.bytes());
18      save_pointer(NAME(m_sample_buf.get()), 2 * m_samples_region.bytes());
19   }
1820}
1921
2022MACHINE_CONFIG_FRAGMENT( cclimber_audio )
r252881r252882
4951   m_sample_num(0),
5052   m_sample_freq(0),
5153   m_sample_volume(0),
52   m_samples(*this, "samples")
54   m_samples(*this, "samples"),
55   m_samples_region(*this, "samples")
5356{
5457}
5558
r252881r252882
102105void cclimber_audio_device::play_sample(int start,int freq,int volume)
103106{
104107   int len;
105   int romlen = machine().root_device().memregion("samples")->bytes();
106   const UINT8 *rom = machine().root_device().memregion("samples")->base();
108   int romlen = m_samples_region.bytes();
107109
108   if (!rom) return;
110   if (m_samples_region == NULL)
111   {
112      return;
113   }
109114
110115   /* decode the rom samples */
111116   len = 0;
112   while (start + len < romlen && rom[start+len] != 0x70)
117   while (start + len < romlen && m_samples_region[start+len] != 0x70)
113118   {
114119      int sample;
115120
116      sample = (rom[start + len] & 0xf0) >> 4;
121      sample = (m_samples_region[start + len] & 0xf0) >> 4;
117122      m_sample_buf[2*len] = SAMPLE_CONV4(sample) * volume / 31;
118123
119      sample = rom[start + len] & 0x0f;
124      sample = m_samples_region[start + len] & 0x0f;
120125      m_sample_buf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;
121126
122127      len++;
trunk/src/mame/audio/cclimber.h
r252881r252882
5656   int m_sample_num;
5757   int m_sample_freq;
5858   int m_sample_volume;
59   required_device<samples_device> m_samples;
59   optional_device<samples_device> m_samples;
60   optional_region_ptr<UINT8> m_samples_region;
6061};
6162
6263
trunk/src/mame/drivers/4enraya.cpp
r252881r252882
408408   save_item(NAME(m_videoram));
409409   save_item(NAME(m_workram));
410410   save_item(NAME(m_soundlatch));
411
412   m_prom = memregion("pal_prom")->base();
413   m_rom = memregion("maincpu")->base();
414411}
415412
416413void _4enraya_state::machine_reset()
trunk/src/mame/drivers/dkong.cpp
r252881r252882
439439{
440440   m_hardware_type = HARDWARE_TKG04;
441441
442   m_snd_rom = memregion("soundcpu")->base();
443
444442   save_item(NAME(m_decrypt_counter));
445443   save_item(NAME(m_dma_latch));
446444}
trunk/src/mame/includes/4enraya.h
r252881r252882
1212{
1313public:
1414   _4enraya_state(const machine_config &mconfig, device_type type, const char *tag)
15      : driver_device(mconfig, type, tag),
16      m_maincpu(*this, "maincpu"),
17      m_ay(*this, "aysnd"),
18      m_gfxdecode(*this, "gfxdecode"),
19      m_palette(*this, "palette")
20   { }
15      : driver_device(mconfig, type, tag)
16      , m_maincpu(*this, "maincpu")
17      , m_ay(*this, "aysnd")
18      , m_gfxdecode(*this, "gfxdecode")
19      , m_palette(*this, "palette")
20      , m_prom(*this, "pal_prom")
21      , m_rom(*this, "maincpu")
22   {
23   }
2124
2225   required_device<cpu_device> m_maincpu;
2326   required_device<ay8910_device> m_ay;
r252881r252882
2831   UINT8 m_videoram[0x1000];
2932   UINT8 m_workram[0x1000];
3033
31   UINT8* m_prom;
32   UINT8* m_rom;
34   optional_region_ptr<UINT8> m_prom;
35   optional_region_ptr<UINT8> m_rom;
3336
3437   /* video-related */
3538   tilemap_t *m_bg_tilemap;
trunk/src/mame/includes/dkong.h
r252881r252882
9494{
9595public:
9696   dkong_state(const machine_config &mconfig, device_type type, const char *tag)
97      : driver_device(mconfig, type, tag),
98      m_maincpu(*this, "maincpu"),
99      m_soundcpu(*this, "soundcpu"),
100      m_eeprom(*this, "eeprom"),
101      m_dev_n2a03a(*this, "n2a03a"),
102      m_dev_n2a03b(*this, "n2a03b"),
103      m_dev_vp2(*this, "virtual_p2"),
104      m_dev_6h(*this, "ls259.6h"),
105      m_discrete(*this, "discrete"),
106      m_video_ram(*this,"video_ram"),
107      m_sprite_ram(*this,"sprite_ram"),
108      m_vidhw(DKONG_BOARD),
109      m_sig30Hz(0),
110      m_blue_level(0),
111      m_cv1(0),
112      m_cv2(0),
113      m_vg1(0),
114      m_vg2(0),
115      m_vg3(0),
116      m_cv3(0),
117      m_cv4(0),
118      m_gfxdecode(*this, "gfxdecode"),
119      m_screen(*this, "screen"),
120      m_palette(*this, "palette"),
121      m_z80dma(*this, "z80dma"),
122      m_dma8257(*this, "dma8257")
123   { }
97      : driver_device(mconfig, type, tag)
98      , m_maincpu(*this, "maincpu")
99      , m_soundcpu(*this, "soundcpu")
100      , m_eeprom(*this, "eeprom")
101      , m_dev_n2a03a(*this, "n2a03a")
102      , m_dev_n2a03b(*this, "n2a03b")
103      , m_dev_vp2(*this, "virtual_p2")
104      , m_dev_6h(*this, "ls259.6h")
105      , m_discrete(*this, "discrete")
106      , m_video_ram(*this,"video_ram")
107      , m_sprite_ram(*this,"sprite_ram")
108      , m_snd_rom(*this, "soundcpu")
109      , m_vidhw(DKONG_BOARD)
110      , m_sig30Hz(0)
111      , m_blue_level(0)
112      , m_cv1(0)
113      , m_cv2(0)
114      , m_vg1(0)
115      , m_vg2(0)
116      , m_vg3(0)
117      , m_cv3(0)
118      , m_cv4(0)
119      , m_gfxdecode(*this, "gfxdecode")
120      , m_screen(*this, "screen")
121      , m_palette(*this, "palette")
122      , m_z80dma(*this, "z80dma")
123      , m_dma8257(*this, "dma8257")
124   {
125   }
124126
125127   /* devices */
126128   required_device<cpu_device> m_maincpu;
r252881r252882
141143   UINT8               m_nmi_mask;
142144
143145   std::unique_ptr<UINT8[]> m_decrypted;
146
144147   /* sound state */
145   const UINT8       *m_snd_rom;
148   optional_region_ptr<UINT8>   m_snd_rom;
146149
147150   /* video state */
148151   tilemap_t           *m_bg_tilemap;
trunk/src/mame/includes/nb1414m4.h
r252881r252882
2424   void _0600(UINT8 is2p, UINT8 *vram);
2525   void _0e00(UINT16 mcu_cmd, UINT8 *vram);
2626
27   UINT8 *m_data;
27   optional_region_ptr<UINT8> m_data;
2828
2929};
3030
trunk/src/mame/machine/nb1414m4.cpp
r252881r252882
3535nb1414m4_device::nb1414m4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3636   : device_t(mconfig, NB1414M4, "NB1414M4 Mahjong Custom", tag, owner, clock, "nb1414m4", __FILE__),
3737   device_video_interface(mconfig, *this),
38   m_data(nullptr)
38   m_data(*this, DEVICE_SELF)
3939{
4040}
4141
r252881r252882
4646
4747void nb1414m4_device::device_start()
4848{
49   m_data = region()->base();
5049}
5150
5251//-------------------------------------------------
trunk/src/mame/video/n64.cpp
r252881r252882
22852285   ewdata[0] = (0x24 << 24) | ((0x80 | tilenum) << 16) | yl;   // command, flipped, tile, yl
22862286   ewdata[1] = (yl << 16) | yh;                                // ym, yh
22872287   ewdata[2] = (xlint << 16) | ((xl & 3) << 14);               // xl, xl frac
2288   ewdata[3] = 0;                                              // dxldy, dxldy frac
2288   // ewdata[3] = 0;                                              dxldy, dxldy frac
22892289   ewdata[4] = (xhint << 16) | ((xh & 3) << 14);               // xh, xh frac
2290   ewdata[5] = 0;                                              // dxhdy, dxhdy frac
2290   // ewdata[5] = 0;                                              dxhdy, dxhdy frac
22912291   ewdata[6] = (xlint << 16) | ((xl & 3) << 14);               // xm, xm frac
2292   ewdata[7] = 0;                                              // dxmdy, dxmdy frac
2292   //ewdata[7] = 0;                                               dxmdy, dxmdy frac
22932293   memset(&ewdata[8], 0, 16 * sizeof(UINT32));                 // shade
22942294   ewdata[24] = (s << 16) | t;                                 // s, t
2295   ewdata[25] = 0;                                            // w
2295   // ewdata[25] = 0;                                             w
22962296   ewdata[26] = ((dsdx >> 5) << 16);                           // dsdx, dtdx
2297   ewdata[27] = 0;                                             // dwdx
2298   ewdata[28] = 0;                                             // s frac, t frac
2299   ewdata[29] = 0;                                             // w frac
2297   // ewdata[27] = 0;                                             dwdx
2298   // ewdata[28] = 0;                                             s frac, t frac
2299   // ewdata[29] = 0;                                             w frac
23002300   ewdata[30] = ((dsdx & 0x1f) << 11) << 16;                   // dsdx frac, dtdx frac
2301   ewdata[31] = 0;                                             // dwdx frac
2302   ewdata[32] = (dtdy >> 5) & 0xffff;//dsde, dtde
2303   ewdata[33] = 0;//dwde
2304   ewdata[34] = (dtdy >> 5) & 0xffff;//dsdy, dtdy
2305   ewdata[35] = 0;//dwdy
2306   ewdata[36] = (dtdy & 0x1f) << 11;//dsde frac, dtde frac
2307   ewdata[37] = 0;//dwde frac
2308   ewdata[38] = (dtdy & 0x1f) << 11;//dsdy frac, dtdy frac
2309   ewdata[39] = 0;//dwdy frac
2310   memset(&ewdata[40], 0, 4 * sizeof(UINT32));//depth
2301   // ewdata[31] = 0;                                             dwdx frac
2302   ewdata[32] = (dtdy >> 5) & 0xffff;                     // dsde, dtde
2303   // ewdata[33] = 0;                                    dwde
2304   ewdata[34] = (dtdy >> 5) & 0xffff;                     // dsdy, dtdy
2305   // ewdata[35] = 0;                                    dwdy
2306   ewdata[36] = (dtdy & 0x1f) << 11;                     // dsde frac, dtde frac
2307   // ewdata[37] = 0;                                    dwde frac
2308   ewdata[38] = (dtdy & 0x1f) << 11;                     // dsdy frac, dtdy frac
2309   // ewdata[39] = 0;                                 // dwdy frac
2310   // ewdata[40-43] = 0;                              // depth
23112311
23122312   draw_triangle(true, true, false, true);
23132313}
r252881r252882
23392339   const INT32 xhint = (xh >> 2) & 0x3ff;
23402340
23412341   UINT32* ewdata = m_temp_rect_data;
2342   ewdata[0] = (0x25 << 24) | ((0x80 | tilenum) << 16) | yl;//command, flipped, tile, yl
2343   ewdata[1] = (yl << 16) | yh;//ym, yh
2344   ewdata[2] = (xlint << 16) | ((xl & 3) << 14);//xl, xl frac
2345   ewdata[3] = 0;//dxldy, dxldy frac
2346   ewdata[4] = (xhint << 16) | ((xh & 3) << 14);//xh, xh frac
2347   ewdata[5] = 0;//dxhdy, dxhdy frac
2348   ewdata[6] = (xlint << 16) | ((xl & 3) << 14);//xm, xm frac
2349   ewdata[7] = 0;//dxmdy, dxmdy frac
2350   memset(&ewdata[8], 0, 16 * sizeof(UINT32));//shade
2351   ewdata[24] = (s << 16) | t;//s, t
2352   ewdata[25] = 0;//w
2353   ewdata[26] = (dtdy >> 5) & 0xffff;//dsdx, dtdx
2354   ewdata[27] = 0;//dwdx
2355   ewdata[28] = 0;//s frac, t frac
2356   ewdata[29] = 0;//w frac
2357   ewdata[30] = ((dtdy & 0x1f) << 11);//dsdx frac, dtdx frac
2358   ewdata[31] = 0;//dwdx frac
2359   ewdata[32] = (dsdx >> 5) << 16;//dsde, dtde
2360   ewdata[33] = 0;//dwde
2361   ewdata[34] = (dsdx >> 5) << 16;//dsdy, dtdy
2362   ewdata[35] = 0;//dwdy
2363   ewdata[36] = (dsdx & 0x1f) << 27;//dsde frac, dtde frac
2364   ewdata[37] = 0;//dwde frac
2365   ewdata[38] = (dsdx & 0x1f) << 27;//dsdy frac, dtdy frac
2366   ewdata[39] = 0;//dwdy frac
2367   memset(&ewdata[40], 0, 4 * sizeof(UINT32));//depth
2342   ewdata[0] = (0x25 << 24) | ((0x80 | tilenum) << 16) | yl;   // command, flipped, tile, yl
2343   ewdata[1] = (yl << 16) | yh;                        // ym, yh
2344   ewdata[2] = (xlint << 16) | ((xl & 3) << 14);            // xl, xl frac
2345   // ewdata[3] = 0;                                    dxldy, dxldy frac
2346   ewdata[4] = (xhint << 16) | ((xh & 3) << 14);            // xh, xh frac
2347   // ewdata[5] = 0;                                    dxhdy, dxhdy frac
2348   ewdata[6] = (xlint << 16) | ((xl & 3) << 14);            // xm, xm frac
2349   // ewdata[7] = 0;                                    dxmdy, dxmdy frac
2350   memset(&ewdata[8], 0, 16 * sizeof(UINT32));               // shade
2351   ewdata[24] = (s << 16) | t;                           // s, t
2352   // ewdata[25] = 0;                                 // w
2353   ewdata[26] = (dtdy >> 5) & 0xffff;                     // dsdx, dtdx
2354   // ewdata[27] = 0;                                    dwdx
2355   // ewdata[28] = 0;                                    s frac, t frac
2356   // ewdata[29] = 0;                                    w frac
2357   ewdata[30] = ((dtdy & 0x1f) << 11);                     // dsdx frac, dtdx frac
2358   // ewdata[31] = 0;                                    dwdx frac
2359   ewdata[32] = (dsdx >> 5) << 16;                        // dsde, dtde
2360   // ewdata[33] = 0;                                    dwde
2361   ewdata[34] = (dsdx >> 5) << 16;                        // dsdy, dtdy
2362   // ewdata[35] = 0;                                    dwdy
2363   ewdata[36] = (dsdx & 0x1f) << 27;                     // dsde frac, dtde frac
2364   // ewdata[37] = 0;                                    dwde frac
2365   ewdata[38] = (dsdx & 0x1f) << 27;                     // dsdy frac, dtdy frac
2366   // ewdata[39] = 0;                                 // dwdy frac
2367   // ewdata[40-43] = 0;                              // depth
23682368
23692369   draw_triangle(true, true, false, true);
23702370}
r252881r252882
31583158   m_prim_lod_fraction.set(0, 0, 0, 0);
31593159   z_build_com_table();
31603160
3161   memset(m_temp_rect_data, 0, sizeof(UINT32) * 0x1000);
3162
31613163   for (INT32 i = 0; i < 0x4000; i++)
31623164   {
31633165      UINT32 exponent = (i >> 11) & 7;
trunk/src/mame/video/sega16sp.cpp
r252881r252882
826826
827827sega_sys16b_sprite_device::sega_sys16b_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
828828   : sega_16bit_sprite_device(mconfig, SEGA_SYS16B_SPRITES, "Sega System 16B Sprites", tag, owner, "sega_16bit_sprite", __FILE__)
829   , m_sprite_region_ptr(*this, DEVICE_SELF)
829   , m_sprite_region_ptr(*this, ":sprites")
830830{
831831   set_local_origin(184, 0x00, -184, 0);
832832}
r252881r252882
868868   //  Note that the zooming described below is 100% accurate to the real board.
869869   //
870870
871   // if the game does not have sprites, don't try to draw anything
872   if (m_sprite_region_ptr == NULL)
873   {
874      return;
875   }
876
877871   // render the sprites in order
878   const UINT16 *spritebase = m_sprite_region_ptr;
872   const UINT16 *spritebase = reinterpret_cast<const UINT16 *>(&m_sprite_region_ptr[0]);
879873   UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x20000;
880874   UINT16 *ramend = spriteram() + spriteram_elements();
881875   for (UINT16 *data = spriteram(); data < ramend; data += 8)
trunk/src/mame/video/sega16sp.h
r252881r252882
203203   virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
204204
205205   // memory regions
206   optional_region_ptr<UINT16> m_sprite_region_ptr;
206   optional_region_ptr<UINT8> m_sprite_region_ptr;
207207};
208208
209209


Previous 199869 Revisions Next


© 1997-2024 The MAME Team