Previous 199869 Revisions Next

r41770 Wednesday 18th November, 2015 at 22:06:35 UTC by Ryan Holtz
First round of this==NULL crash fixes
[/branches/code_cleanup/src/devices/machine]timekpr.cpp
[/branches/code_cleanup/src/devices/sound]2610intf.cpp 2610intf.h fm.cpp upd7759.cpp upd7759.h ymz280b.cpp
[/branches/code_cleanup/src/mame/audio]dcs.cpp dcs.h
[/branches/code_cleanup/src/mame/drivers]neogeo_noslot.cpp sfbonus.cpp
[/branches/code_cleanup/src/mame/includes]btime.h cps1.h
[/branches/code_cleanup/src/mame/video]btime.cpp cps1.cpp

branches/code_cleanup/src/devices/machine/timekpr.cpp
r250281r250282
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)
123   : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
124   , device_nvram_interface(mconfig, *this)
125   , m_default_data(NULL)
125126{
126127}
127128
r250281r250282
230231   m_century = make_bcd( systime.local_time.year / 100 );
231232   m_data.resize( m_size );
232233
233   m_default_data = region()->base();
234   if (m_default_data)
234   if (region())
235235   {
236      assert( region()->bytes() == m_size );
236      m_default_data = region()->base();
237      if (m_default_data)
238      {
239         assert( region()->bytes() == m_size );
240      }
237241   }
238242
239243   save_item( NAME(m_control) );
branches/code_cleanup/src/devices/sound/2610intf.cpp
r250281r250282
1616#include "2610intf.h"
1717#include "fm.h"
1818
19const char* YM2610_TAG = "ymsnd";
20const char* YM2610_DELTAT_TAG = "ymsnd.deltat";
21
1922static void psg_set_clock(void *param, int clock)
2023{
2124   ym2610_device *ym2610 = (ym2610_device *) param;
r250281r250282
143146   ay8910_device::device_start();
144147
145148   int rate = clock()/72;
146   void *pcmbufa,*pcmbufb;
147   int  pcmsizea,pcmsizeb;
148   std::string name(tag());
149149
150150   m_irq_handler.resolve();
151151
r250281r250282
156156   /* stream system initialize */
157157   m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2610_device::stream_generate),this));
158158   /* setup adpcm buffers */
159   pcmbufa  = region()->base();
160   pcmsizea = region()->bytes();
161   name.append(".deltat");
162   pcmbufb = (void *)(machine().root_device().memregion(name.c_str())->base());
163   pcmsizeb = machine().root_device().memregion(name.c_str())->bytes();
164   if (pcmbufb == NULL || pcmsizeb == 0)
159   void *pcmbufa  = region()->base();
160   int pcmsizea = region()->bytes();
161
162   std::string name = tag() + std::string(".deltat");
163   memory_region *deltat_region = machine().root_device().memregion(name.c_str());
164   void *pcmbufb = pcmbufa;
165   int pcmsizeb = pcmsizea;
166   if (deltat_region != NULL && deltat_region->base() != NULL && deltat_region->bytes() != 0)
165167   {
166      pcmbufb = pcmbufa;
167      pcmsizeb = pcmsizea;
168      pcmbufb = deltat_region->base();
169      pcmsizeb = deltat_region->bytes();
168170   }
169171
170172   /**** initialize YM2610 ****/
r250281r250282
207209const device_type YM2610 = &device_creator<ym2610_device>;
208210
209211ym2610_device::ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
210   : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__),
211      m_irq_handler(*this)
212   : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__)
213   , m_irq_handler(*this)
212214{
213215}
214216
215217ym2610_device::ym2610_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)
216   : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source),
217      m_irq_handler(*this)
218   : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source)
219   , m_irq_handler(*this)
218220{
219221}
220222
branches/code_cleanup/src/devices/sound/2610intf.h
r250281r250282
2929   void _timer_handler(int c,int count,int clock);
3030   void _ym2610_update_request();
3131
32   static const char* YM2610_TAG;
33   static const char* YM2610_DELTAT_TAG;
34
3235protected:
3336   // device-level overrides
3437   virtual void device_start();
branches/code_cleanup/src/devices/sound/fm.cpp
r250281r250282
24222422
24232423   UINT8       flagmask;           /* YM2608 only */
24242424   UINT8       irqmask;            /* YM2608 only */
2425   
2425
24262426   device_t   *device;
24272427};
24282428
r250281r250282
36853685   F2610->pcmbuf = (const UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
36863686   F2610->pcm_size = dev->machine().root_device().memregion(name.c_str())->bytes();
36873687   name.append(".deltat");
3688   F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
3688   memory_region *deltat_region = dev->machine().root_device().memregion(name.c_str());
3689   F2610->deltaT.memory = NULL;
3690   if (deltat_region != NULL)
3691   {
3692      F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
3693   }
36893694   if(F2610->deltaT.memory == NULL)
36903695   {
36913696      F2610->deltaT.memory = (UINT8*)F2610->pcmbuf;
36923697      F2610->deltaT.memory_size = F2610->pcm_size;
36933698   }
36943699   else
3700   {
36953701      F2610->deltaT.memory_size = dev->machine().root_device().memregion(name.c_str())->bytes();
3702   }
36963703
36973704   /* Reset Prescaler */
36983705   OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */
branches/code_cleanup/src/devices/sound/upd7759.cpp
r250281r250282
145145
146146
147147upd775x_device::upd775x_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)
148   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
149      device_sound_interface(mconfig, *this),
150      m_channel(NULL),
151      m_sample_offset_shift(0),
152      m_pos(0),
153      m_step(0),
154      m_fifo_in(0),
155      m_reset(0),
156      m_start(0),
157      m_drq(0),
158      m_state(0),
159      m_clocks_left(0),
160      m_nibbles_left(0),
161      m_repeat_count(0),
162      m_post_drq_state(0),
163      m_post_drq_clocks(0),
164      m_req_sample(0),
165      m_last_sample(0),
166      m_block_header(0),
167      m_sample_rate(0),
168      m_first_valid_header(0),
169      m_offset(0),
170      m_repeat_offset(0),
171      m_adpcm_state(0),
172      m_adpcm_data(0),
173      m_sample(0),
174      m_rom(NULL),
175      m_rombase(NULL),
176      m_romoffset(0),
177      m_rommask(0),
178      m_drqcallback(*this)
148   : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
149   , device_sound_interface(mconfig, *this)
150   , m_channel(NULL)
151   , m_sample_offset_shift(0)
152   , m_pos(0)
153   , m_step(0)
154   , m_fifo_in(0)
155   , m_reset(0)
156   , m_start(0)
157   , m_drq(0)
158   , m_state(0)
159   , m_clocks_left(0)
160   , m_nibbles_left(0)
161   , m_repeat_count(0)
162   , m_post_drq_state(0)
163   , m_post_drq_clocks(0)
164   , m_req_sample(0)
165   , m_last_sample(0)
166   , m_block_header(0)
167   , m_sample_rate(0)
168   , m_first_valid_header(0)
169   , m_offset(0)
170   , m_repeat_offset(0)
171   , m_adpcm_state(0)
172   , m_adpcm_data(0)
173   , m_sample(0)
174   , m_rom_region(*this, tag)
175   , m_rom(NULL)
176   , m_rombase(NULL)
177   , m_romoffset(0)
178   , m_rommask(0)
179   , m_drqcallback(*this)
179180{
180181}
181182
182183const device_type UPD7759 = &device_creator<upd7759_device>;
183184
184185upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
185   : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__),
186      m_timer(NULL)
186   : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__)
187   , m_timer(NULL)
187188{
188189}
189190
190191
191192upd7759_device::upd7759_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)
192   : upd775x_device(mconfig, type, name, tag, owner, clock, shortname, source),
193      m_timer(NULL)
193   : upd775x_device(mconfig, type, name, tag, owner, clock, shortname, source)
194   , m_timer(NULL)
194195{
195196}
196197
r250281r250282
231232
232233   /* compute the ROM base or allocate a timer */
233234   m_romoffset = 0;
234   m_rom = m_rombase = region()->base();
235   if (m_rombase == NULL)
235   if (m_rom_region != NULL)
236236   {
237      m_rom = m_rombase = m_rom_region->base();
238
239      UINT32 romsize = m_rom_region->bytes();
240      if (romsize >= 0x20000)
241      {
242         m_rommask = 0x1ffff;
243      }
244      else
245      {
246         m_rommask = romsize - 1;
247      }
248
249      m_drqcallback.set_callback(DEVCB_NULL);
250   }
251   else
252   {
237253      assert(type() == UPD7759); // other chips do not support slave mode
238254      m_timer = timer_alloc(TIMER_SLAVE_UPDATE);
239255      m_rommask = 0;
240256   }
241   else
242   {
243      UINT32 romsize = region()->bytes();
244      if (romsize >= 0x20000) m_rommask = 0x1ffff;
245      else m_rommask = romsize - 1;
246257
247      m_drqcallback.set_callback(DEVCB_NULL);
248   }
249
250258   /* assume /RESET and /START are both high */
251259   m_reset = 1;
252260   m_start = 1;
r250281r250282
306314
307315   /* compute the ROM base or allocate a timer */
308316   m_romoffset = 0;
309   m_rom = m_rombase = region()->base();
310   if (m_rombase == NULL)
317   if (m_rom_region != NULL)
311318   {
312      m_rommask = 0;
313   }
314   else
315   {
319      m_rom = m_rombase = m_rom_region->base();
320
316321      UINT32 romsize = region()->bytes();
317      if (romsize >= 0x20000) m_rommask = 0x1ffff;
318      else m_rommask = romsize - 1;
322      if (romsize >= 0x20000)
323      {
324         m_rommask = 0x1ffff;
325      }
326      else
327      {
328         m_rommask = romsize - 1;
329      }
319330
320331      m_drqcallback.set_callback(DEVCB_NULL);
321332   }
333   else
334   {
335      m_rommask = 0;
336   }
322337
323338   /* assume /RESET and /START are both high */
324339   m_reset = 1;
branches/code_cleanup/src/devices/sound/upd7759.h
r250281r250282
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 */
9899   UINT8 *     m_rom;                        /* pointer to ROM data or NULL for slave mode */
99100   UINT8 *     m_rombase;                    /* pointer to ROM data or NULL for slave mode */
100101   UINT32      m_romoffset;                  /* ROM offset to make save/restore easier */
branches/code_cleanup/src/devices/sound/ymz280b.cpp
r250281r250282
581581
582582   /* initialize the rest of the structure */
583583   m_master_clock = (double)clock() / 384.0;
584   m_mem_base = region()->base();
585   m_mem_size = region()->bytes();
586584   m_irq_handler.resolve();
587585
586   if (region() != NULL)
587   {
588      /* Some systems (e.g. Konami Firebeat) have a YMZ280B on-board that isn't hooked up to ROM, so be safe. */
589      m_mem_base = region()->base();
590      m_mem_size = region()->bytes();
591   }
592
588593   for (int i = 0; i < 8; i++)
589594   {
590595      m_voice[i].timer = timer_alloc(i);
branches/code_cleanup/src/mame/audio/dcs.cpp
r250281r250282
594594
595595void dcs_audio_device::dcs_boot()
596596{
597   UINT8 buffer[0x1000];
598//  UINT32 max_banks;
599   UINT16 *base;
600   int i;
601
602597   switch (m_rev)
603598   {
604599      /* rev 1/1.5: use the last set data bank to boot from */
605600      case 1:
606601      case 15:
607
602      {
608603         /* determine the base */
609//          max_banks = m_bootrom_words / 0x1000;
610         base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words);
604         // max_banks = m_bootrom_words / 0x1000;
605         UINT16* base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words);
611606
612607         /* convert from 16-bit data to 8-bit data and boot */
613         for (i = 0; i < 0x1000; i++)
608         UINT8 buffer[0x1000];
609         for (int i = 0; i < 0x1000; i++)
610         {
614611            buffer[i] = base[i];
612         }
613         assert(m_internal_program_ram != NULL);
615614         m_cpu->load_boot_data(buffer, m_internal_program_ram);
616615         break;
616      }
617617
618618      /* rev 2: use the ROM page in the SDRC to boot from */
619619      case 2:
620
620      {
621621         /* determine the base */
622         UINT16* base;
622623         if (m_bootrom == m_sounddata)
623624         {
624625            /* EPROM case: page is selected from the page register */
r250281r250282
631632         }
632633
633634         /* convert from 16-bit data to 8-bit data and boot */
634         for (i = 0; i < 0x1000; i++)
635         UINT8 buffer[0x1000];
636         for (int i = 0; i < 0x1000; i++)
637         {
635638            buffer[i] = base[i];
639         }
640         assert(m_internal_program_ram != NULL);
636641         m_cpu->load_boot_data(buffer, m_internal_program_ram);
637642         break;
643      }
638644
639645      /* rev 3/4: HALT the ADSP-2181 until program is downloaded via IDMA */
640646      case 3:
r250281r250282
665671      case 1:
666672      case 15:
667673         m_sounddata_bank = 0;
668         membank("databank")->set_entry(0);
674         m_data_bank->set_entry(0);
669675         break;
670676
671677      /* rev 2: reset the SDRC ASIC */
r250281r250282
807813   m_sounddata_words(0),
808814   m_sounddata_banks(0),
809815   m_sounddata_bank(0),
816   m_data_bank(*this, "databank"),
817   m_rom_page(NULL),
818   m_dram_page(NULL),
810819   m_auto_ack(0),
811820   m_latch_control(0),
812821   m_input_data(0),
r250281r250282
845854{
846855   m_sram = NULL;
847856
848   m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr();
849   m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr();
857   memory_share *internal_ram = memshare("dcsint");
858   if (internal_ram != NULL)
859   {
860      m_internal_program_ram = (UINT32 *)internal_ram->ptr();
861   }
862   memory_share *external_ram = memshare("dcsext");
863   if (external_ram != NULL)
864   {
865      m_external_program_ram = (UINT32 *)external_ram->ptr();
866   }
850867
851868   /* find the DCS CPU and the sound ROMs */
852869   m_cpu = subdevice<adsp21xx_device>("dcs");
r250281r250282
866883   if (m_rev == 1)
867884   {
868885      m_sounddata_banks = m_sounddata_words / 0x1000;
869      membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2);
886      m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2);
870887   }
871888   else
872889   {
873890      m_sounddata_banks = m_sounddata_words / 0x800;
874      membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2);
891      m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2);
875892   }
876893
877894   /* create the timers */
r250281r250282
891908{
892909   int soundbank_words;
893910
894   m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr();
895   m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr();
911   memory_share *internal_ram = memshare("dcsint");
912   if (internal_ram != NULL)
913   {
914      m_internal_program_ram = (UINT32 *)internal_ram->ptr();
915   }
916   memory_share *external_ram = memshare("dcsext");
917   if (external_ram != NULL)
918   {
919      m_external_program_ram = (UINT32 *)external_ram->ptr();
920   }
896921
897922   /* find the DCS CPU and the sound ROMs */
898923   m_cpu = subdevice<adsp21xx_device>("dcs2");
r250281r250282
937962   }
938963   m_sounddata_banks = m_sounddata_words / soundbank_words;
939964   if (m_rev != 2)
940      membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2);
965   {
966      m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2);
967   }
941968
942969   /* allocate memory for the SRAM */
943970   m_sram = auto_alloc_array(machine(), UINT16, 0x8000*4/2);
r250281r250282
9821009
9831010READ16_MEMBER( dcs_audio_device::dcs_dataram_r )
9841011{
1012   assert(m_external_program_ram != NULL);
9851013   return m_external_program_ram[offset] >> 8;
9861014}
9871015
9881016
9891017WRITE16_MEMBER( dcs_audio_device::dcs_dataram_w )
9901018{
1019   assert(m_external_program_ram != NULL);
9911020   UINT16 val = m_external_program_ram[offset] >> 8;
9921021   COMBINE_DATA(&val);
9931022   m_external_program_ram[offset] = (val << 8) | (m_external_program_ram[offset] & 0x0000ff);
r250281r250282
10011030   else
10021031      m_sounddata_bank = (m_sounddata_bank & 0xff00) | (data & 0xff);
10031032
1004   membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks);
1033   m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks);
10051034
10061035   /* bit 11 = sound board led */
10071036#if 0
r250281r250282
10141043{
10151044   m_sounddata_bank = (m_sounddata_bank & 0x00ff) | ((data & 0x01) << 8) | ((data & 0xfc) << 7);
10161045
1017   membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks);
1046   m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks);
10181047}
10191048
10201049/*************************************
r250281r250282
10341063      {
10351064         /* ROM-based; use the memory page to select from ROM */
10361065         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1037            membank("rompage")->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]);
1066         {
1067            m_rom_page->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]);
1068         }
10381069      }
10391070      else
10401071      {
10411072         /* RAM-based; use the ROM page to select from ROM, and the memory page to select from RAM */
10421073         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1043            membank("rompage")->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]);
1074         {
1075            m_rom_page->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]);
1076         }
10441077         if (SDRC_DM_ST != 0)
1045            membank("drampage")->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]);
1078         {
1079            m_dram_page->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]);
1080         }
10461081      }
10471082   }
10481083}
r250281r250282
10871122      int baseaddr = (SDRC_ROM_ST == 0) ? 0x0000 : (SDRC_ROM_ST == 1) ? 0x3000 : 0x3400;
10881123      int pagesize = (SDRC_ROM_SZ == 0 && SDRC_ROM_ST != 0) ? 4096 : 1024;
10891124      m_data->install_read_bank(baseaddr, baseaddr + pagesize - 1, "rompage");
1125      m_rom_page = membank("rompage");
10901126   }
10911127
10921128   /* map the DRAM page as bank 26 */
r250281r250282
10941130   {
10951131      int baseaddr = (SDRC_DM_ST == 1) ? 0x0000 : (SDRC_DM_ST == 2) ? 0x3000 : 0x3400;
10961132      m_data->install_readwrite_bank(baseaddr, baseaddr + 0x3ff, "drampage");
1133      m_dram_page = membank("drampage");
10971134   }
10981135
10991136   /* update the bank pointers */
r250281r250282
12851322      /* offset 2 controls RAM pages */
12861323      case 2:
12871324         dsio.reg[2] = data;
1288         membank("databank")->set_entry(DSIO_DM_PG % m_sounddata_banks);
1325         m_data_bank->set_entry(DSIO_DM_PG % m_sounddata_banks);
12891326         break;
12901327   }
12911328}
r250281r250282
13521389      /* offset 2 controls RAM pages */
13531390      case 2:
13541391         dsio.reg[2] = data;
1355         membank("databank")->set_entry(DENV_DM_PG % m_sounddata_banks);
1392         m_data_bank->set_entry(DENV_DM_PG % m_sounddata_banks);
13561393         break;
13571394
13581395      /* offset 3 controls FIFO reset */
branches/code_cleanup/src/mame/audio/dcs.h
r250281r250282
170170   UINT32      m_sounddata_banks;
171171   UINT16      m_sounddata_bank;
172172
173   optional_memory_bank   m_data_bank;
174   memory_bank *         m_rom_page;
175   memory_bank *         m_dram_page;
176
173177   /* I/O with the host */
174178   UINT8       m_auto_ack;
175179   UINT16      m_latch_control;
branches/code_cleanup/src/mame/drivers/neogeo_noslot.cpp
r250281r250282
29662966  BANK 2  NOT USED
29672967  BANK 3  NOT USED
29682968 ****************************************/
2969
2970   ROM_START( b2b )
2969ROM_START( b2b )
29712970   ROM_REGION( 0x100000, "maincpu", 0 )
29722971   ROM_LOAD16_WORD_SWAP( "071.p1", 0x000000, 0x080000, CRC(7687197d) SHA1(4bb9cb7819807f7a7e1f85f1c4faac4a2f8761e8) )
29732972
r250281r250282
29782977   ROM_REGION( 0x100000, "ymsnd", 0 )
29792978   ROM_LOAD( "071.v1", 0x000000, 0x100000, CRC(50feffb0) SHA1(00127dae0130889995bfa7560bc4b0662f74fba5) )
29802979
2980   NO_DELTAT_REGION
2981
29812982   ROM_REGION( 0x400000, "sprites", 0 )
29822983   ROM_LOAD16_BYTE( "071.c1", 0x000000, 0x200000, CRC(23d84a7a) SHA1(9034658ad40e2c45558abc3db312aa2764102fc4) ) /* Plane 0,1 */
29832984   ROM_LOAD16_BYTE( "071.c2", 0x000001, 0x200000, CRC(ce7b6248) SHA1(ad1cd5adae5c151e183ff88b68afe10f7009f48e) ) /* Plane 2,3 */
branches/code_cleanup/src/mame/drivers/sfbonus.cpp
r250281r250282
294294      m_2801_regs(*this, "2801_regs"),
295295      m_2c01_regs(*this, "2c01_regs"),
296296      m_3000_regs(*this, "3000_regs"),
297      m_3800_regs(*this, "3800_regs")  { }
297      m_3800_regs(*this, "3800_regs")
298   {
299   }
298300
299301   required_device<cpu_device> m_maincpu;
300302   required_device<gfxdecode_device> m_gfxdecode;
r250281r250282
58435845   ROM_REGION( 0x100000, "gfx2", ROMREGION_ERASE00 )
58445846ROM_END
58455847
5846//ROM_REGION( 0x80000, "user1", 0 ) /* Z80 Code */
5847//ROM_LOAD( "dummy.rom", 0x00000, 0x40000, CRC(1) SHA1(1) )
5848
58495848DRIVER_INIT_MEMBER(sfbonus_state,sfbonus_common)
58505849{
58515850   m_tilemap_ram = auto_alloc_array(machine(), UINT8, 0x4000);
r250281r250282
58735872   memset(m_videoram, 0xff, 0x10000);
58745873
58755874   save_pointer(NAME(m_videoram), 0x10000);
5876
5877   // dummy.rom helper
5878   {
5879      UINT8 *ROM = memregion("maincpu")->base();
5880      int length = memregion("maincpu")->bytes();
5881      UINT8* ROM2 = memregion("user1")->base();
5882
5883      if (ROM2)
5884      {
5885         printf("X %02x %02x %02x %02x %02x %02x %02x %02x\n", ROM[0x50], ROM[0x51], ROM[0x52], ROM[0x53], ROM[0x54], ROM[0x55],ROM[0x56],ROM[0x57]);
5886
5887         {
5888            int x;
5889            int y;
5890            for (y = 0; y < 0x8; y++)
5891            {
5892               printf("@Echo Off\n");
5893               printf("a.exe ");
5894               for (x = 0; x < 0x20 * 0x8; x += 0x8)
5895               {
5896                  printf("%02x %02x ", ROM[x + y], ROM2[x + y]);
5897               }
5898               printf("\n");
5899            }
5900
5901         }
5902
5903         {
5904            FILE *fp;
5905            char filename[256];
5906            sprintf(filename,"decr_%s", machine().system().name);
5907            fp = fopen(filename, "w+b");
5908            if (fp)
5909            {
5910               fwrite(ROM, length, 1, fp);
5911               fclose(fp);
5912            }
5913         }
5914      }
5915   }
59165875}
59175876
59185877void sfbonus_state::sfbonus_bitswap(
r250281r250282
63486307// Known sets but no roms dumped at all for these:
63496308// Merry Circus
63506309// Devil Island - 14 Liner version
6351// Fruit Bonus 2010 (or is this on the older goldstar.c style hardware)
63526310
6353
63546311// ?? what is this
63556312GAME( 200?, amclink,     0,        sfbonus,    amcoe1_reels3, sfbonus_state,    sfbonus_common,  ROT0,  "Amcoe", "Amcoe Link Control Box (Version 2.2)", MACHINE_NOT_WORKING)
branches/code_cleanup/src/mame/includes/btime.h
r250281r250282
1010{
1111public:
1212   btime_state(const machine_config &mconfig, device_type type, const char *tag)
13      : driver_device(mconfig, type, tag),
14      m_rambase(*this, "rambase"),
15      m_videoram(*this, "videoram"),
16      m_colorram(*this, "colorram"),
17      m_bnj_backgroundram(*this, "bnj_bgram"),
18      m_zoar_scrollram(*this, "zoar_scrollram"),
19      m_lnc_charbank(*this, "lnc_charbank"),
20      m_deco_charram(*this, "deco_charram"),
21      m_spriteram(*this, "spriteram"),
22      m_audio_rambase(*this, "audio_rambase"),
23      m_maincpu(*this, "maincpu"),
24      m_audiocpu(*this, "audiocpu"),
25      m_gfxdecode(*this, "gfxdecode"),
26      m_screen(*this, "screen"),
27      m_palette(*this, "palette") { }
13      : driver_device(mconfig, type, tag)
14      , m_rambase(*this, "rambase")
15      , m_videoram(*this, "videoram")
16      , m_colorram(*this, "colorram")
17      , m_bnj_backgroundram(*this, "bnj_bgram")
18      , m_zoar_scrollram(*this, "zoar_scrollram")
19      , m_lnc_charbank(*this, "lnc_charbank")
20      , m_deco_charram(*this, "deco_charram")
21      , m_spriteram(*this, "spriteram")
22      , m_audio_rambase(*this, "audio_rambase")
23      , m_maincpu(*this, "maincpu")
24      , m_audiocpu(*this, "audiocpu")
25      , m_gfxdecode(*this, "gfxdecode")
26      , m_screen(*this, "screen")
27      , m_palette(*this, "palette")
28      , m_prom_region(*this, "proms")
29   {
30   }
2831
2932   /* memory pointers */
3033   optional_shared_ptr<UINT8> m_rambase;
r250281r250282
6265   required_device<gfxdecode_device> m_gfxdecode;
6366   required_device<screen_device> m_screen;
6467   required_device<palette_device> m_palette;
68   optional_memory_region m_prom_region;
6569
6670   DECLARE_WRITE8_MEMBER(audio_nmi_enable_w);
6771   DECLARE_WRITE8_MEMBER(lnc_w);
branches/code_cleanup/src/mame/includes/cps1.h
r250281r250282
117117      m_gfxdecode(*this, "gfxdecode"),
118118      m_screen(*this, "screen"),
119119      m_palette(*this, "palette"),
120      m_decrypted_opcodes(*this, "decrypted_opcodes") { }
120      m_decrypted_opcodes(*this, "decrypted_opcodes"),
121      m_region_stars(*this, "stars") { }
121122
122123   /* memory pointers */
123124   // cps1
r250281r250282
214215   required_device<screen_device> m_screen;
215216   required_device<palette_device> m_palette;
216217   optional_shared_ptr<UINT16> m_decrypted_opcodes;
218   optional_memory_region m_region_stars;
217219
218220   DECLARE_READ16_MEMBER(cps1_hack_dsw_r);
219221   DECLARE_READ16_MEMBER(cps1_in1_r);
branches/code_cleanup/src/mame/video/btime.cpp
r250281r250282
3232
3333PALETTE_INIT_MEMBER(btime_state,btime)
3434{
35   const UINT8 *color_prom = memregion("proms")->base();
36   int i;
37
38
3935   /* Burger Time doesn't have a color PROM, but Hamburge has. */
4036   /* This function is also used by Eggs. */
41   if (color_prom == 0) return;
37   if (m_prom_region == NULL)
38   {
39      return;
40   }
4241
43   for (i = 0; i < palette.entries(); i++)
42   const UINT8 *color_prom = m_prom_region->base();
43
44   for (int i = 0; i < palette.entries(); i++)
4445   {
45      int bit0, bit1, bit2, r, g, b;
46      /* red component */
47      int bit0 = (color_prom[i] >> 0) & 0x01;
48      int bit1 = (color_prom[i] >> 1) & 0x01;
49      int bit2 = (color_prom[i] >> 2) & 0x01;
50      int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
4651
47      /* red component */
48      bit0 = (color_prom[i] >> 0) & 0x01;
49      bit1 = (color_prom[i] >> 1) & 0x01;
50      bit2 = (color_prom[i] >> 2) & 0x01;
51      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
5252      /* green component */
5353      bit0 = (color_prom[i] >> 3) & 0x01;
5454      bit1 = (color_prom[i] >> 4) & 0x01;
5555      bit2 = (color_prom[i] >> 5) & 0x01;
56      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
56      int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
57
5758      /* blue component */
5859      bit0 = 0;
5960      bit1 = (color_prom[i] >> 6) & 0x01;
6061      bit2 = (color_prom[i] >> 7) & 0x01;
61      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
62      int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
6263
6364      palette.set_pen_color(i, rgb_t(r,g,b));
6465   }
r250281r250282
8485PALETTE_INIT_MEMBER(btime_state,lnc)
8586{
8687   const UINT8 *color_prom = memregion("proms")->base();
87   int i;
8888
89   for (i = 0; i < palette.entries(); i++)
89   for (int i = 0; i < palette.entries(); i++)
9090   {
91      int bit0, bit1, bit2, r, g, b;
91      /* red component */
92      int bit0 = (color_prom[i] >> 7) & 0x01;
93      int bit1 = (color_prom[i] >> 6) & 0x01;
94      int bit2 = (color_prom[i] >> 5) & 0x01;
95      int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
9296
93      /* red component */
94      bit0 = (color_prom[i] >> 7) & 0x01;
95      bit1 = (color_prom[i] >> 6) & 0x01;
96      bit2 = (color_prom[i] >> 5) & 0x01;
97      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
9897      /* green component */
9998      bit0 = (color_prom[i] >> 4) & 0x01;
10099      bit1 = (color_prom[i] >> 3) & 0x01;
101100      bit2 = (color_prom[i] >> 2) & 0x01;
102      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
101      int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
102
103103      /* blue component */
104104      bit0 = 0;
105105      bit1 = (color_prom[i] >> 1) & 0x01;
106106      bit2 = (color_prom[i] >> 0) & 0x01;
107      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
107      int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
108108
109109      palette.set_pen_color(i, rgb_t(r,g,b));
110110   }
branches/code_cleanup/src/mame/video/cps1.cpp
r250281r250282
28032803void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
28042804{
28052805   int offs;
2806   UINT8 *stars_rom = memregion("stars")->base();
2806   UINT8 *stars_rom = m_region_stars->base();
28072807
28082808   if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1]))
28092809   {
r250281r250282
29642964      bitmap.fill(m_palette->black_pen(), cliprect);
29652965   }
29662966
2967   cps1_render_stars(screen, bitmap, cliprect);
2967   if (m_region_stars)
2968   {
2969      cps1_render_stars(screen, bitmap, cliprect);
2970   }
29682971
29692972   /* Draw layers (0 = sprites, 1-3 = tilemaps) */
29702973   l0 = (layercontrol >> 0x06) & 03;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team