Previous 199869 Revisions Next

r44367 Saturday 23rd January, 2016 at 16:30:14 UTC by Ryan Holtz
Refix some of the this==NULL stuff
[src/devices/machine]timekpr.cpp timekpr.h
[src/devices/sound]c140.cpp c140.h namco.cpp namco.h scsp.cpp scsp.h tms5110.cpp tms5110.h upd7759.cpp upd7759.h ymf271.cpp ymf271.h
[src/mame/video]sega16sp.cpp sega16sp.h

trunk/src/devices/machine/timekpr.cpp
r252878r252879
120120//-------------------------------------------------
121121
122122timekeeper_device::timekeeper_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)
123   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
124      device_nvram_interface(mconfig, *this)
125   , m_default_data(NULL)
123   : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
124   , device_nvram_interface(mconfig, *this)
125   , m_default_data(*this, DEVICE_SELF)
126126{
127127}
128128
r252878r252879
231231   m_century = make_bcd( systime.local_time.year / 100 );
232232   m_data.resize( m_size );
233233
234   if (region())
234   if (m_default_data)
235235   {
236      m_default_data = region()->base();
237      if (m_default_data)
238      {
239         assert( region()->bytes() == m_size );
240      }
236      assert(m_default_data.bytes() == m_size);
241237   }
242238
243239   save_item( NAME(m_control) );
trunk/src/devices/machine/timekpr.h
r252878r252879
8888   UINT8 m_century;
8989
9090   dynamic_buffer m_data;
91   UINT8 *m_default_data;
91   optional_region_ptr<UINT8> m_default_data;
9292
9393protected:
9494   int m_size;
trunk/src/devices/sound/c140.cpp
r252878r252879
9595   , m_mixer_buffer_left(nullptr),
9696   , m_mixer_buffer_right(nullptr),
9797   , m_baserate(0),
98   , m_rom_region(*this, this->tag())
98   , m_rom_region(*this, DEVICE_SELF)
9999   , m_pRom(nullptr)
100100{
101101   memset(m_REG, 0, sizeof(UINT8)*0x200);
r252878r252879
109109
110110void c140_device::device_start()
111111{
112   m_sample_rate=m_baserate=clock();
112   m_sample_rate = m_baserate = clock();
113113
114114   m_stream = stream_alloc(0, 2, m_sample_rate);
115115
116   if (m_rom_region)
116   if (m_rom_ptr != NULL)
117117   {
118      m_pRom = (INT8 *)m_rom_region->base();
118      printf("asdf\n");
119      m_pRom = m_rom_ptr;
119120   }
120121
121122   /* make decompress pcm table */     //2000.06.26 CAB
123   INT32 segbase = 0;
124   for(int i = 0; i < 8; i++)
122125   {
123      int i;
124      INT32 segbase=0;
125      for(i=0;i<8;i++)
126      {
127         m_pcmtbl[i]=segbase;    //segment base value
128         segbase += 16<<i;
129      }
126      m_pcmtbl[i]=segbase;    //segment base value
127      segbase += 16<<i;
130128   }
131129
132130   memset(m_REG,0,sizeof(m_REG));
131
132   for(int i = 0; i < C140_MAX_VOICE; i++)
133133   {
134      int i;
135      for(i=0;i<C140_MAX_VOICE;i++) init_voice( &m_voi[i] );
134      init_voice(&m_voi[i]);
136135   }
137136
138137   /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
trunk/src/devices/sound/c140.h
r252878r252879
110110   std::unique_ptr<INT16[]> m_mixer_buffer_right;
111111
112112   int m_baserate;
113   optional_memory_region m_rom_region;
113   optional_region_ptr<INT8> m_rom_ptr;
114114   INT8 *m_pRom;
115115   UINT8 m_REG[0x200];
116116
trunk/src/devices/sound/namco.cpp
r252878r252879
3838namco_audio_device::namco_audio_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)
3939   : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
4040   , device_sound_interface(mconfig, *this)
41   , m_wave_region(*this, this->tag())
41   , m_wave_ptr(*this, DEVICE_SELF)
4242   , m_last_channel(nullptr)
4343   , m_soundregs(nullptr)
4444   , m_wavedata(nullptr)
r252878r252879
9696   logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate);
9797
9898   /* build the waveform table */
99   build_decoded_waveform(m_wave_region != NULL ? m_wave_region->base() : NULL);
99   build_decoded_waveform(m_wave_ptr);
100100
101101   /* get stream channels */
102102   if (m_stereo)
r252878r252879
110110   /* register with the save state system */
111111   save_pointer(NAME(m_soundregs), 0x400);
112112
113   if (m_wave_region == nullptr)
113   if (m_wave_ptr == nullptr)
114114      save_pointer(NAME(m_wavedata), 0x400);
115115
116116   save_item(NAME(m_voices));
trunk/src/devices/sound/namco.h
r252878r252879
5454   UINT32 namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq);
5555
5656   /* waveform region */
57   optional_memory_region m_wave_region;
57   optional_region_ptr<UINT8> m_wave_ptr;
5858
5959   /* data about the sound system */
6060   sound_channel m_channel_list[MAX_VOICES];
trunk/src/devices/sound/scsp.cpp
r252878r252879
149149      m_roffset(0),
150150      m_irq_cb(*this),
151151      m_main_irq_cb(*this),
152      m_ram_region(*this, this->tag()),
152      m_ram_region(*this, DEVICE_SELF),
153153      m_BUFPTR(0),
154154      m_SCSPRAM(nullptr),
155155      m_SCSPRAM_LENGTH(0),
trunk/src/devices/sound/scsp.h
r252878r252879
4545
4646struct SCSP_LFO_t
4747{
48   unsigned short phase;
48   UINT16 phase;
4949   UINT32 phase_step;
5050   int *table;
5151   int *scale;
r252878r252879
6969   SCSP_LFO_t PLFO;     //Phase LFO
7070   SCSP_LFO_t ALFO;     //Amplitude LFO
7171   int slot;
72   signed short Prev;  //Previous sample (for interpolation)
72   INT16 Prev;  //Previous sample (for interpolation)
7373};
7474
7575
r252878r252879
113113   } m_udata;
114114
115115   SCSP_SLOT m_Slots[32];
116   signed short m_RINGBUF[128];
117   unsigned char m_BUFPTR;
116   INT16 m_RINGBUF[128];
117   UINT8 m_BUFPTR;
118118#if FM_DELAY
119   signed short m_DELAYBUF[FM_DELAY];
120   unsigned char m_DELAYPTR;
119   INT16 m_DELAYBUF[FM_DELAY];
120   UINT8 m_DELAYPTR;
121121#endif
122   unsigned char *m_SCSPRAM;
122   UINT8 *m_SCSPRAM;
123123   UINT32 m_SCSPRAM_LENGTH;
124124   char m_Master;
125125   sound_stream * m_stream;
r252878r252879
168168
169169   int m_length;
170170
171   signed short *m_RBUFDST;   //this points to where the sample will be stored in the RingBuf
171   INT16 *m_RBUFDST;   //this points to where the sample will be stored in the RingBuf
172172
173173   //LFO
174174   int m_PLFO_TRI[256], m_PLFO_SQR[256], m_PLFO_SAW[256], m_PLFO_NOI[256];
r252878r252879
177177   int m_ASCALES[8][256];
178178
179179   void exec_dma(address_space &space);       /*state DMA transfer function*/
180   unsigned char DecodeSCI(unsigned char irq);
180   UINT8 DecodeSCI(UINT8 irq);
181181   void CheckPendingIRQ();
182182   void MainCheckPendingIRQ(UINT16 irq_type);
183183   void ResetInterrupts();
r252878r252879
192192   UINT32 Step(SCSP_SLOT *slot);
193193   void Compute_LFO(SCSP_SLOT *slot);
194194   void StartSlot(SCSP_SLOT *slot);
195   void StopSlot(SCSP_SLOT *slot,int keyoff);
195   void StopSlot(SCSP_SLOT *slot, int keyoff);
196196   void init();
197   void UpdateSlotReg(int s,int r);
197   void UpdateSlotReg(int s, int r);
198198   void UpdateReg(address_space &space, int reg);
199   void UpdateSlotRegR(int slot,int reg);
199   void UpdateSlotRegR(int slot, int reg);
200200   void UpdateRegR(address_space &space, int reg);
201   void w16(address_space &space,unsigned int addr,unsigned short val);
202   unsigned short r16(address_space &space, unsigned int addr);
201   void w16(address_space &space, UINT32 addr, UINT16 val);
202   UINT16 r16(address_space &space, UINT32 addr);
203203   inline INT32 UpdateSlot(SCSP_SLOT *slot);
204204   void DoMasterSamples(int nsamples);
205205
206206   //LFO
207207   void LFO_Init();
208   signed int PLFO_Step(SCSP_LFO_t *LFO);
209   signed int ALFO_Step(SCSP_LFO_t *LFO);
210   void LFO_ComputeStep(SCSP_LFO_t *LFO,UINT32 LFOF,UINT32 LFOWS,UINT32 LFOS,int ALFO);
208   INT32 PLFO_Step(SCSP_LFO_t *LFO);
209   INT32 ALFO_Step(SCSP_LFO_t *LFO);
210   void LFO_ComputeStep(SCSP_LFO_t *LFO, UINT32 LFOF, UINT32 LFOWS, UINT32 LFOS, int ALFO);
211211};
212212
213213extern const device_type SCSP;
trunk/src/devices/sound/tms5110.cpp
r252878r252879
10491049
10501050void tms5110_device::device_start()
10511051{
1052   m_table = NULL;
1053   if (m_table_region != NULL)
1054   {
1055      m_table = m_table_region->base();
1056   }
1057
10581052   set_variant(TMS5110_IS_TMS5110A);
10591053
10601054   /* resolve lines */
r252878r252879
15371531tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15381532   : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__),
15391533   , device_sound_interface(mconfig, *this)
1540   , m_table_region(*this, this->tag())
1534   , m_table(*this, DEVICE_SELF)
15411535   , m_m0_cb(*this)
15421536   , m_m1_cb(*this)
15431537   , m_addr_cb(*this)
r252878r252879
15491543tms5110_device::tms5110_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)
15501544   : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
15511545   , device_sound_interface(mconfig, *this)
1552   , m_table_region(*this, this->tag())
1546   , m_table(*this, DEVICE_SELF)
15531547   , m_m0_cb(*this)
15541548   , m_m1_cb(*this)
15551549   , m_addr_cb(*this)
trunk/src/devices/sound/tms5110.h
r252878r252879
9797   void parse_frame();
9898
9999   // internal state
100   /* table region */
101   optional_memory_region m_table_region;
100   /* table */
101   optional_region_ptr<UINT8> m_table;
102102
103103   /* coefficient tables */
104104   int m_variant;                /* Variant of the 5110 - see tms5110.h */
r252878r252879
194194   UINT8 m_romclk_hack_state;
195195
196196   emu_timer *m_romclk_hack_timer;
197   const UINT8 *m_table;
198197};
199198
200199extern const device_type TMS5110;
trunk/src/devices/sound/upd7759.cpp
r252878r252879
171171   , m_adpcm_state(0)
172172   , m_adpcm_data(0)
173173   , m_sample(0)
174   , m_rom_region(*this, this->tag())
174   , m_rom_region(*this, DEVICE_SELF)
175175   , m_rom(nullptr)
176176   , m_rombase(nullptr)
177177   , m_romoffset(0)
r252878r252879
232232
233233   /* compute the ROM base or allocate a timer */
234234   m_romoffset = 0;
235   if (m_rom_region != nullptr)
235   m_rom = m_rombase;
236   if (m_rombase != nullptr)
236237   {
237      m_rom = m_rombase = m_rom_region->base();
238
239      UINT32 romsize = m_rom_region->bytes();
238      UINT32 romsize = m_rombase.bytes();
240239      if (romsize >= 0x20000)
241240      {
242241         m_rommask = 0x1ffff;
r252878r252879
314313
315314   /* compute the ROM base or allocate a timer */
316315   m_romoffset = 0;
317   if (m_rom_region != nullptr)
316   m_rom = m_rombase;
317   if (m_rombase != nullptr)
318318   {
319      m_rom = m_rombase = m_rom_region->base();
320
321      UINT32 romsize = region()->bytes();
319      UINT32 romsize = m_rombase.bytes();
322320      if (romsize >= 0x20000)
323321      {
324322         m_rommask = 0x1ffff;
r252878r252879
735733void upd775x_device::postload()
736734{
737735   if (m_rombase)
736   {
738737      m_rom = m_rombase + m_romoffset;
738   }
739739}
740740
741741/************************************************************
trunk/src/devices/sound/upd7759.h
r252878r252879
9595   INT16       m_sample;                     /* current sample value */
9696
9797   /* ROM access */
98   optional_memory_region m_rom_region;     /* ROM data region which may or may not be present */
98   optional_region_ptr<UINT8> m_rombase;     /* pointer to ROM data or NULL for slave mode */
9999   UINT8 *     m_rom;                        /* pointer to ROM data or NULL for slave mode */
100   UINT8 *     m_rombase;                    /* pointer to ROM data or NULL for slave mode */
101100   UINT32      m_romoffset;                  /* ROM offset to make save/restore easier */
102101   UINT32      m_rommask;                    /* maximum address offset */
103102
trunk/src/devices/sound/ymf271.cpp
r252878r252879
17061706   m_timA = timer_alloc(0);
17071707   m_timB = timer_alloc(1);
17081708
1709   if (m_mem_region != NULL)
1710   {
1711      m_mem_base = m_mem_region->base();
1712      m_mem_size = m_mem_region->bytes();
1713   }
1709   m_mem_size = m_mem_base.bytes();
1710
17141711   m_irq_handler.resolve();
17151712
17161713   m_ext_read_handler.resolve();
r252878r252879
17601757   , m_ext_address(0)
17611758   , m_ext_rw(0)
17621759   , m_ext_readlatch(0)
1763   , m_mem_base(NULL)
1760   , m_mem_base(*this, DEVICE_SELF)
17641761   , m_mem_size(0)
1765   , m_irq_handler(*this)
1766   , m_ext_read_handler(*this)
1767   , m_ext_write_handler(*this)
1768   , m_mem_region(*this, this->tag())
17691762   , m_clock(0)
17701763   , m_timA(nullptr)
17711764   , m_timB(nullptr)
17721765   , m_stream(nullptr)
17731766   , m_mix_buffer(nullptr)
1767   , m_irq_handler(*this)
1768   , m_ext_read_handler(*this)
1769   , m_ext_write_handler(*this)
17741770{
17751771   memset(m_slots, 0, sizeof(m_slots));
17761772   memset(m_groups, 0, sizeof(m_groups));
trunk/src/devices/sound/ymf271.h
r252878r252879
147147   UINT8 m_ext_rw;
148148   UINT8 m_ext_readlatch;
149149
150   UINT8 *m_mem_base;
150   optional_region_ptr<UINT8> m_mem_base;
151151   UINT32 m_mem_size;
152152   UINT32 m_clock;
153153
r252878r252879
159159   devcb_write_line m_irq_handler;
160160   devcb_read8 m_ext_read_handler;
161161   devcb_write8 m_ext_write_handler;
162
163   optional_memory_region m_mem_region;
164162};
165163
166164extern const device_type YMF271;
trunk/src/mame/video/sega16sp.cpp
r252878r252879
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(*this, this->tag())
829   , m_sprite_region_ptr(*this, DEVICE_SELF)
830830{
831831   set_local_origin(184, 0x00, -184, 0);
832832}
r252878r252879
869869   //
870870
871871   // if the game does not have sprites, don't try to draw anything
872   if (m_sprite_region == NULL)
872   if (m_sprite_region_ptr == NULL)
873873   {
874874      return;
875875   }
876876
877877   // render the sprites in order
878   const UINT16 *spritebase = reinterpret_cast<const UINT16 *>(m_sprite_region->base());
879   UINT8 numbanks = m_sprite_region->bytes() / 0x20000;
878   const UINT16 *spritebase = m_sprite_region_ptr;
879   UINT8 numbanks = m_sprite_region_ptr.bytes() / 0x20000;
880880   UINT16 *ramend = spriteram() + spriteram_elements();
881881   for (UINT16 *data = spriteram(); data < ramend; data += 8)
882882   {
trunk/src/mame/video/sega16sp.h
r252878r252879
203203   virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
204204
205205   // memory regions
206   optional_memory_region      m_sprite_region;
206   optional_region_ptr<UINT16> m_sprite_region_ptr;
207207};
208208
209209


Previous 199869 Revisions Next


© 1997-2024 The MAME Team