Previous 15994 Revisions Next

r7427 Friday 19th February, 2010 at 13:07:13 UTC by Firewave
Several cleanups based on cppcheck and VS2008 Code Analysis:
- avoid shadowed variables
- disabled unused variables and code
- removed unreachable code
- moved variables into proper defines
[src/mess]infomess.c
[src/mess/devices]thomflop.c
[src/mess/drivers]cdi.c gba.c mac.c pc6001.c pyl601.c vboy.c x68k.c
[src/mess/formats]hect_tap.c td0_dsk.c thom_cas.c ti99_dsk.c z80ne_dsk.c
[src/mess/machine]llc.c microtan.c rmnimbus.c snescart.c
[src/mess/osd/winui]messui.c
[src/mess/tools/dat2html]dat2html.c
[src/mess/tools/imgtool/modules]amiga.c
[src/mess/video]dgn_beta.c gba.c hd61830.c pc_cga.c super80.c vdc8563.c

src/mess/devices/thomflop.c
r7426r7427
16741674   else if ( ! data[1] )
16751675   {
16761676      char name[33];
1677      int i;
16781677      memcpy( name, data + 12, 32 );
16791678      name[32] = 0;
16801679      for (i=0;i<32;i++)
src/mess/tools/dat2html/dat2html.c
r7426r7427
7979   char html_directory[128] = "sysinfo";
8080   char system_filename[128] = "";
8181   char system_name[128] = "";
82   int systemcount = 0, linecount = 0, emptycount = 0, ulcount = 0;
82   int /*systemcount = 0,*/ linecount = 0, emptycount = 0, ulcount = 0;
8383   FILE *dat, *html, *html_system = NULL;
8484   time_t tm;
8585
r7426r7427
148148               sprintf(system_filename, "%s/%s.htm", html_directory, system_name);
149149               fprintf(html, "&bull;&nbsp;&nbsp;<a href=\"%s\">%s</a>\n", system_filename, system_name);
150150
151               systemcount++;
151               /*systemcount++;*/
152152
153153               html_system = fopen(system_filename, "w");
154154
src/mess/tools/imgtool/modules/amiga.c
r7426r7427
11071107      /* TODO: Softlink support */
11081108      return IMGTOOLERR_UNIMPLEMENTED;
11091109
1110      break;
1111
11121110   case ST_LINKDIR:
11131111   case ST_LINKFILE:
11141112   {
src/mess/infomess.c
r7426r7427
9292
9393   for (device = ram_first(config); device != NULL; device = ram_next(device))
9494   {
95      ram_config *config = (ram_config *)device->inline_config;
96      fprintf(out, "\t\t<ramoption default=\"1\">%u</ramoption>\n",  messram_parse_string(config->default_size));
97      if (config->extra_options != NULL)
95      ram_config *ram = (ram_config *)device->inline_config;
96      fprintf(out, "\t\t<ramoption default=\"1\">%u</ramoption>\n",  messram_parse_string(ram->default_size));
97      if (ram->extra_options != NULL)
9898      {
9999         const char *s;
100100
101101         astring buffer;
102         astring_cpyc(&buffer, config->extra_options);
102         astring_cpyc(&buffer, ram->extra_options);
103103         astring_replacechr(&buffer, ',', 0);
104104
105105         s = astring_c(&buffer);
src/mess/video/dgn_beta.c
r7426r7427
170170
171171static   int   FlashCount;   /* Flash counter, IC2, LS393 decade counter */
172172static int   FlashBit;   /* Flash bit, FL input to I38 */
173static int   DoubleY;   /* Double height latch, 'Y' in I38 */
173static int   s_DoubleY;   /* Double height latch, 'Y' in I38 */
174174static int   DoubleHL;   /* Double height second row 'HL' in I38 */
175175
176176static int   ColourRAM[4];   /* I59, 74ls670, 4x4bit colour ram for graphics modes */
r7426r7427
320320   FlashCount=0;
321321   FlashBit=0;
322322   DoubleHL=1;         /* Default to normal height */
323   DoubleY=1;
323   s_DoubleY=1;
324324   DrawInterlace=INTERLACE_OFF;   /* No interlace by default */
325325
326326   /* setup debug commands */
r7426r7427
429429      ULActive=(UnderLine && (beta_6845_RA==9) && ~SWChar);
430430
431431      /* If Character set one, and undeline set, latch double height */
432      DoubleY=(UnderLine & SWChar & DoubleHL) |
433              (SWChar & ~DoubleY & DoubleHL) |
434         (SWChar & ~DoubleY & (beta_6845_RA==9));
432      s_DoubleY=(UnderLine & SWChar & DoubleHL) |
433              (SWChar & ~s_DoubleY & DoubleHL) |
434         (SWChar & ~s_DoubleY & (beta_6845_RA==9));
435435
436436      /* Invert forground and background if flashing char and flash acive */
437437      Invert=(FlashChar & FlashBit);
src/mess/video/super80.c
r7426r7427
1616static UINT8 current_charset;   /* for super80m */
1717
1818static const UINT8 *FNT;
19static UINT8 options;
19static UINT8 s_options;
2020extern UINT8 *super80_colorram;
2121
2222/**************************** PALETTES for super80m and super80v ******************************************/
r7426r7427
404404   framecnt++;
405405   speed = mc6845_reg[10]&0x20, flash = mc6845_reg[10]&0x40;         // cursor modes
406406   cursor = (mc6845_reg[14]<<8) | mc6845_reg[15];               // get cursor position
407   options=input_port_read(screen->machine, "CONFIG");
407   s_options=input_port_read(screen->machine, "CONFIG");
408408   output_set_value("cass_led",(super80_shared & 0x20) ? 1 : 0);
409409   mc6845_update(mc6845, bitmap, cliprect);
410410   return 0;
r7426r7427
425425
426426      /* get colour or b&w */
427427      fg = 5;                  /* green */
428      if ((options & 0x60) == 0x60) fg = 15;      /* b&w */
428      if ((s_options & 0x60) == 0x60) fg = 15;      /* b&w */
429429
430      if (~options & 0x40)
430      if (~s_options & 0x40)
431431      {
432432         col = super80_colorram[mem];               /* byte of colour to display */
433433         fg = col & 0x0f;
src/mess/video/vdc8563.c
r7426r7427
463463            {
464464               UINT16 ch, fg, bg;
465465               const UINT8 *charptr;
466               int v, h;
466               int v, h2;
467467               UINT16 *pixel;
468468
469469               ch = vdc8563->ram[i] | ((vdc8563->ram[j] & 0x80) ? 0x100 : 0);
r7426r7427
473473
474474               for (v = 0; v < 16; v++)
475475               {
476                  for (h = 0; h < 8; h++)
476                  for (h2 = 0; h2 < 8; h2++)
477477                  {
478                     pixel = BITMAP_ADDR16(bitmap, (y * height) + height + v, (x * 8) + 8 + h);
479                     *pixel = (charptr[v] & (0x80 >> h)) ? fg : bg;
478                     pixel = BITMAP_ADDR16(bitmap, (y * height) + height + v, (x * 8) + 8 + h2);
479                     *pixel = (charptr[v] & (0x80 >> h2)) ? fg : bg;
480480                  }
481481               }
482482            }
src/mess/video/pc_cga.c
r7426r7427
268268   int Y_total;
269269   int I_total;
270270   int Q_total;
271} ntsc;
271} s_ntsc;
272272
273273
274274/* Clear NTSC buffers and running totals. Call this before the beginning of each new line. */
r7426r7427
502502
503503   internal_pc_cga_video_start(machine, M6845_PERSONALITY_GENUINE);
504504
505   ntsc_decoder_init( machine, &ntsc, 8, 256 );
505   ntsc_decoder_init( machine, &s_ntsc, 8, 256 );
506506}
507507
508508
r7426r7427
831831   if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n"));
832832if ( NTSC_FILTER )
833833{
834   ntsc_clear( &ntsc );
834   ntsc_clear( &s_ntsc );
835835   memset( ntsc_decoded, 0, sizeof(ntsc_decoded));
836836}
837837   for ( i = 0; i < x_count; i++ )
r7426r7427
903903   }
904904if (NTSC_FILTER)
905905{
906   ntsc_decode( &ntsc, samples, ntsc_decoded, 160 );
906   ntsc_decode( &s_ntsc, samples, ntsc_decoded, 160 );
907907   p = BITMAP_ADDR16(bitmap, y, 0);
908908   samp_index = 0;
909909   for ( i = 0; i < ( 8 * x_count ); i++ )
r7426r7427
15531553{
15541554   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
15551555   UINT16   offset_base = ra << 13;
1556   int i;
1556   int j;
15571557   running_machine *machine = device->machine;
15581558
15591559   if ( y == 0 ) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n"));
1560   for ( i = 0; i < x_count; i++ )
1560   for ( j = 0; j < x_count; j++ )
15611561   {
1562      UINT16 offset = offset_base | ( ( ma + i ) & 0x1FFF );
1562      UINT16 offset = offset_base | ( ( ma + j ) & 0x1FFF );
15631563      UINT16 i = ( cga.color_select & 8 ) ? device->machine->generic.videoram.u8[ videoram_offset[3] | offset ] << 3 : 0;
15641564      UINT16 r = ( cga.color_select & 4 ) ? device->machine->generic.videoram.u8[ videoram_offset[2] | offset ] << 2 : 0;
15651565      UINT16 g = ( cga.color_select & 2 ) ? device->machine->generic.videoram.u8[ videoram_offset[1] | offset ] << 1 : 0;
src/mess/video/hd61830.c
r7426r7427
266266   case HD61830_INSTRUCTION_CLEAR_BIT:
267267      {
268268      int nb = data & 0x07;
269      UINT8 data = memory_read_byte(space, hd61830->cac);
269      UINT8 data_ = memory_read_byte(space, hd61830->cac);
270270
271      data &= ~(2 << nb);
271      data_ &= ~(2 << nb);
272272
273273      if (LOG) logerror("HD61380 '%s' Clear Bit %u at %04x\n", device->tag.cstr(), nb + 1, hd61830->cac);
274274
275      memory_write_byte(space, hd61830->cac, data);
275      memory_write_byte(space, hd61830->cac, data_);
276276
277277      hd61830->cac++;
278278      }
r7426r7427
281281   case HD61830_INSTRUCTION_SET_BIT:
282282      {
283283      int nb = data & 0x07;
284      UINT8 data = memory_read_byte(space, hd61830->cac);
284      UINT8 data_ = memory_read_byte(space, hd61830->cac);
285285
286      data |= 2 << nb;
286      data_ |= 2 << nb;
287287
288288      if (LOG) logerror("HD61380 '%s' Set Bit %u at %04x\n", device->tag.cstr(), nb + 1, hd61830->cac);
289289
290      memory_write_byte(space, hd61830->cac, data);
290      memory_write_byte(space, hd61830->cac, data_);
291291
292292      hd61830->cac++;
293293      }
src/mess/video/gba.c
r7426r7427
4343/* Utility functions */
4444INLINE int is_in_window(gba_state_t *gba_state, int x, int window);
4545INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb);
46INLINE UINT32 increase_brightness(UINT32 color, int coeff);
47INLINE UINT32 decrease_brightness(UINT32 color, int coeff);
46INLINE UINT32 increase_brightness(UINT32 color, int coeff_);
47INLINE UINT32 decrease_brightness(UINT32 color, int coeff_);
4848
4949#include "gbamode0.c"
5050#include "gbamode1.c"
r7426r7427
482482   if(ctrl & BGCNT_PALETTE256)
483483   {
484484      UINT16 *src = screendata + 0x400 * (pixx >> 8) + ((pixx & 255) >> 3) + stride;
485      INT32 x = 0;
486485      for(x = 0; x < 240; x++)
487486      {
488487         UINT16 data = *src;
r7426r7427
546545   else
547546   {
548547      UINT16 *src = screendata + 0x400 * (pixx >> 8) + ((pixx & 255) >> 3) + stride;
549      INT32 x = 0;
550548      for(x = 0; x < 240; x++)
551549      {
552550         UINT16 data = *src;
r7426r7427
882880            else
883881            {
884882               INT32 ax;
885               int cury = y - sy;
883               int cury_ = y - sy;
886884
887885               width *= 8;
888886               height *= 8;
889887
890               if(cury >= 0 && cury < height)
888               if(cury_ >= 0 && cury_ < height)
891889               {
892890                  if( ( (sx < 240) || ( ( (sx + width) & 0x1ff ) < 240 ) ) && (attr0 & OBJ_ROZMODE_DISABLE) == 0)
893891                  {
r7426r7427
897895                        int address = 0;
898896                        if(attr1 & OBJ_VFLIP)
899897                        {
900                           cury = height - cury - 1;
898                           cury_ = height - cury_ - 1;
901899                        }
902900                        if((gba_state->DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200)
903901                        {
r7426r7427
919917                           ax = width - 1;
920918                        }
921919
922                        address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 7) << 3) + ((ax >> 3) << 6) + (ax & 7)) & 0x7fff);
920                        address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 7) << 3) + ((ax >> 3) << 6) + (ax & 7)) & 0x7fff);
923921
924922                        if(attr1 & OBJ_HFLIP)
925923                        {
r7426r7427
976974                        UINT32 address;
977975                        if(attr1 & OBJ_VFLIP)
978976                        {
979                           cury = height - cury - 1;
977                           cury_ = height - cury_ - 1;
980978                        }
981979                        if((gba_state->DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200)
982980                        {
r7426r7427
994992                           ax = width - 1;
995993                        }
996994
997                        address = 0x10000 + ((((tiledrawindex + (cury >> 3) * inc) << 5) + ((cury & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff);
995                        address = 0x10000 + ((((tiledrawindex + (cury_ >> 3) * inc) << 5) + ((cury_ & 0x07) << 2) + ((ax >> 3) << 5) + ((ax & 0x07) >> 1)) & 0x7fff);
998996                        if(attr1 & OBJ_HFLIP)
999997                        {
1000998                           ax = 7;
r7426r7427
17291727   return color0;
17301728}
17311729
1732INLINE UINT32 increase_brightness(UINT32 color, int coeff)
1730INLINE UINT32 increase_brightness(UINT32 color, int coeff_)
17331731{
17341732   int r = (color >>  0) & 0x1f;
17351733   int g = (color >>  5) & 0x1f;
17361734   int b = (color >> 10) & 0x1f;
17371735
1738   r += ((0x1f - r) * coeff) >> 4;
1739   g += ((0x1f - g) * coeff) >> 4;
1740   b += ((0x1f - b) * coeff) >> 4;
1736   r += ((0x1f - r) * coeff_) >> 4;
1737   g += ((0x1f - g) * coeff_) >> 4;
1738   b += ((0x1f - b) * coeff_) >> 4;
17411739
17421740   if(r > 0x1f) r = 0x1f;
17431741   if(g > 0x1f) g = 0x1f;
r7426r7427
17461744   return (color & 0xffff0000) | (b << 10) | (g << 5) | r;
17471745}
17481746
1749INLINE UINT32 decrease_brightness(UINT32 color, int coeff)
1747INLINE UINT32 decrease_brightness(UINT32 color, int coeff_)
17501748{
17511749   int r = (color >>  0) & 0x1f;
17521750   int g = (color >>  5) & 0x1f;
17531751   int b = (color >> 10) & 0x1f;
17541752
1755   r -= (r * coeff) >> 4;
1756   g -= (g * coeff) >> 4;
1757   b -= (b * coeff) >> 4;
1753   r -= (r * coeff_) >> 4;
1754   g -= (g * coeff_) >> 4;
1755   b -= (b * coeff_) >> 4;
17581756
17591757   if(r < 0) r = 0;
17601758   if(g < 0) g = 0;
src/mess/osd/winui/messui.c
r7426r7427
8282//  LOCAL VARIABLES
8383//============================================================
8484
85static software_config *config;
85static software_config *s_config;
8686static BOOL s_bIgnoreSoftwarePickerNotifies;
8787
8888static int *mess_icon_index;
r7426r7427
349349void MySoftwareListClose(void)
350350{
351351   // free the machine config, if necessary
352   if (config != NULL)
352   if (s_config != NULL)
353353   {
354      software_config_free(config);
355      config = NULL;
354      software_config_free(s_config);
355      s_config = NULL;
356356   }
357357}
358358
r7426r7427
366366   // do we have to do anything?
367367   if (!bForce)
368368   {
369      if (config != NULL)
370         is_same = (drvindex == config->driver_index);
369      if (s_config != NULL)
370         is_same = (drvindex == s_config->driver_index);
371371      else
372372         is_same = (drvindex < 0);
373373      if (is_same)
r7426r7427
375375   }
376376
377377   // free the machine config, if necessary
378   if (config != NULL)
379   {
380      software_config_free(config);
381      config = NULL;
382   }
378   MySoftwareListClose();
383379
384380   // allocate the machine config, if necessary
385381   if (drvindex >= 0)
386382   {
387      config = software_config_alloc(drvindex, MameUIGlobal(), NULL);
383      s_config = software_config_alloc(drvindex, MameUIGlobal(), NULL);
388384   }
389385
390386   // locate key widgets
r7426r7427
392388   hwndSoftwareDevView = GetDlgItem(GetMainWindow(), IDC_SWDEVVIEW);
393389
394390   // set up the device view
395   DevView_SetDriver(hwndSoftwareDevView, config);
391   DevView_SetDriver(hwndSoftwareDevView, s_config);
396392
397393   // set up the software picker
398394   SoftwarePicker_Clear(hwndSoftwarePicker);
399   SoftwarePicker_SetDriver(hwndSoftwarePicker, config);
395   SoftwarePicker_SetDriver(hwndSoftwarePicker, s_config);
400396
401397   // add the relevant paths
402398   drv = drivers[drvindex];
r7426r7427
503499   // if device is NULL, this is a special case; try to find existing image
504500   if (device == NULL)
505501   {
506      for (device = config->mconfig->devicelist.first(); device != NULL;device = device->next)
502      for (device = s_config->mconfig->devicelist.first(); device != NULL;device = device->next)
507503      {
508504         if (is_image_device(device))
509505         {
510            s = GetSelectedSoftware(drvindex, config->mconfig, device);
506            s = GetSelectedSoftware(drvindex, s_config->mconfig, device);
511507            if ((s != NULL) && !mame_stricmp(s, pszFilename))
512508               break;
513509         }
r7426r7427
526522
527523      if (file_extension != NULL)
528524      {
529         for (device = config->mconfig->devicelist.first(); device != NULL;device = device->next)
525         for (device = s_config->mconfig->devicelist.first(); device != NULL;device = device->next)
530526         {
531527            if (is_image_device(device))
532528            {
533               s = GetSelectedSoftware(drvindex, config->mconfig, device);
529               s = GetSelectedSoftware(drvindex, s_config->mconfig, device);
534530               if (is_null_or_empty(s) && image_device_uses_file_extension(device, file_extension))
535531                  break;
536532            }
r7426r7427
541537   if (device != NULL)
542538   {
543539      // place the image
544      InternalSetSelectedSoftware(drvindex, config->mconfig, device, pszFilename);
540      InternalSetSelectedSoftware(drvindex, s_config->mconfig, device, pszFilename);
545541   }
546542   else
547543   {
r7426r7427
558554   const device_config *device;
559555   const char *s;
560556
561   for (device = config->mconfig->devicelist.first(); device != NULL;device = device->next)
557   for (device = s_config->mconfig->devicelist.first(); device != NULL;device = device->next)
562558   {
563559      if (is_image_device(device))
564560      {
565         s = GetSelectedSoftware(drvindex, config->mconfig, device);
561         s = GetSelectedSoftware(drvindex, s_config->mconfig, device);
566562         if ((s != NULL) && !strcmp(pszFilename, s))
567563            MessSpecifyImage(drvindex, device, NULL);
568564      }
r7426r7427
598594   // be problematic
599595   ListView_SetItemState(hwndSoftware, -1, 0, LVIS_SELECTED);
600596
601   for (dev = config->mconfig->devicelist.first(); dev != NULL;dev = dev->next)
597   for (dev = s_config->mconfig->devicelist.first(); dev != NULL;dev = dev->next)
602598   {
603599      if (is_image_device(dev))
604600      {
605         pszSoftware = GetSelectedSoftware(config->driver_index, config->mconfig, dev);
601         pszSoftware = GetSelectedSoftware(s_config->driver_index, s_config->mconfig, dev);
606602         if (pszSoftware && *pszSoftware)
607603         {
608604            i = SoftwarePicker_LookupIndex(hwndSoftware, pszSoftware);
r7426r7427
633629   struct PickerOptions opts;
634630   HWND hwndSoftware;
635631
636   config = NULL;
632   s_config = NULL;
637633   hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST);
638634
639635   memset(&opts, 0, sizeof(opts));
src/mess/machine/microtan.c
r7426r7427
438438static int parse_intel_hex(UINT8 *snapshot_buff, char *src)
439439{
440440    char line[128];
441    int row = 0, column = 0, last_addr = 0, last_size = 0;
441    int /*row = 0,*/ column = 0, last_addr = 0, last_size = 0;
442442
443443    while (*src)
444444    {
r7426r7427
449449                unsigned int size, addr, null, b[32], cs, n;
450450
451451                line[column] = '\0';
452                row++;
452                /*row++;*/
453453                n = sscanf(line, ":%02x%04x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
454454                    &size, &addr, &null,
455455                    &b[ 0], &b[ 1], &b[ 2], &b[ 3], &b[ 4], &b[ 5], &b[ 6], &b[ 7],
r7426r7427
519519static int parse_zillion_hex(UINT8 *snapshot_buff, char *src)
520520{
521521    char line[128];
522    int parsing = 0, row = 0, column = 0;
522    int parsing = 0, /*row = 0,*/ column = 0;
523523
524524    while (*src)
525525    {
r7426r7427
536536                        unsigned int addr, b[8], n;
537537
538538                        line[column] = '\0';
539                        row++;
539                        /*row++;*/
540540                        n = sscanf(line, "%x %x %x %x %x %x %x %x %x", &addr, &b[0], &b[1], &b[2], &b[3], &b[4], &b[5], &b[6], &b[7]);
541541                        if (n == 0)
542542                        {
r7426r7427
572572                {
573573                    int addr, n;
574574
575                    row++;
575                    /*row++;*/
576576                    line[column] = '\0';
577577                    n = sscanf(line, "G%x", (unsigned int *) &addr);
578578                    if (n == 1 && !snapshot_buff[8192+64+1] && !snapshot_buff[8192+64+1])
src/mess/machine/llc.c
r7426r7427
1212#include "includes/llc.h"
1313#include "devices/messram.h"
1414
15static UINT8 code = 0;
15static UINT8 s_code = 0;
1616
1717static UINT8 llc1_key_state = 0;
1818
1919static READ8_DEVICE_HANDLER (llc1_port_b_r)
2020{
2121   UINT8 retVal = 0;
22   if (code!=0) {
22   if (s_code!=0) {
2323      if (llc1_key_state==0) {
2424         llc1_key_state = 1;
2525         retVal = 0x5F;
r7426r7427
2929            retVal = 0;
3030         } else {
3131            llc1_key_state = 0;
32            retVal = code;
33            code =0;
32            retVal = s_code;
33            s_code =0;
3434         }
3535      }
3636   } else {
r7426r7427
8282         {
8383            if (c == (1 << j))
8484            {
85               code = j + i*8;
85               s_code = j + i*8;
8686               break;
8787            }
8888         }
src/mess/machine/rmnimbus.c
r7426r7427
20052005
20062006    switch (offset*2)
20072007    {
2008        default         : return IOPorts[offset]; break;
2008        default         : return IOPorts[offset];
20092009    }
20102010    return 0;
20112011}
src/mess/machine/snescart.c
r7426r7427
347347   UINT8 *temp_buffer = auto_alloc_array(machine, UINT8, 0x410000);
348348   UINT8 valid_mode20, valid_mode21, valid_mode25;
349349   unsigned char *ROM;
350   int length;
350   /*int length;*/
351351
352352   snes_ram = memory_region(machine, "maincpu");
353353   memset( snes_ram, 0, 0x1000000 );
r7426r7427
420420
421421   /* Loading data */
422422   ROM = memory_region(image->machine, "cart");
423   length = image_fread(image, ROM, snes_rom_size - offset);
423   /*length =*/ image_fread(image, ROM, snes_rom_size - offset);
424424
425425   if (SNES_CART_DEBUG) printf("size %08X\n", snes_rom_size - offset);
426426
src/mess/formats/z80ne_dsk.c
r7426r7427
390390   UINT16 calculated_crc;
391391   size_t i, j;
392392   size_t offs;
393   int state;
393   /*int state;*/
394394   UINT8 *track_data;
395395   void *track_data_v;
396396   size_t track_length;
r7426r7427
477477   }
478478
479479   /* we found a matching sector ID */
480   state = 0;
480   /*state = 0;*/
481481   offs = idam_offset + 2 * DMK_IDAM_LEN;
482482
483483   /* find pattern 0x0000FB; this represents the start of a data sector */
src/mess/formats/ti99_dsk.c
r7426r7427
17341734   int idamcnt, state, track, head, i, totalseclen = 0, format = 0, byte, tracklength, trackadd = 0;
17351735   int first_idam = 0;
17361736   UINT8 *track_data;
1737   int offset;
1737   /*int offset;*/
17381738
17391739   struct ti99dsk_geometry dummy_geometry;
17401740
r7426r7427
18891889    */
18901890
18911891   tracklength = idamcnt * totalseclen + trackadd;
1892   offset = 0;
1892   /*offset = 0;*/
18931893
18941894   /* Read the last track. We assume that all tracks are properly
18951895       formatted; otherwise, the above calculations would already fail.
src/mess/formats/td0_dsk.c
r7426r7427
174174            //      size of data that should be reapeted next byte times
175175            while(buff_pos<realsize) {
176176               if (data[data_pos]==0x00) {
177                  int size = data[data_pos+1];
178                  memcpy(buf+buff_pos,data + data_pos + 2,size);
179                  data_pos += 2 + size;
180                  buff_pos += size;
177                  int size_ = data[data_pos+1];
178                  memcpy(buf+buff_pos,data + data_pos + 2,size_);
179                  data_pos += 2 + size_;
180                  buff_pos += size_;
181181               } else {
182                  int size   = 2*data[data_pos];
182                  int size_  = 2*data[data_pos];
183183                  int repeat = data[data_pos+1];
184184                  data_pos+=2;
185185
186186                  for (i=0;i<repeat;i++) {
187                     memcpy(buf + buff_pos,data + data_pos,size);
188                     buff_pos += size;
187                     memcpy(buf + buff_pos,data + data_pos,size_);
188                     buff_pos += size_;
189189                  }
190                  data_pos += size;
190                  data_pos += size_;
191191               }
192192            }
193193            break;
194194      default:
195195            return FLOPPY_ERROR_INTERNAL;
196            break;
197196   }
198197   return FLOPPY_ERROR_SUCCESS;
199198}
src/mess/formats/hect_tap.c
r7426r7427
8888
8989static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
9090{
91   int   data_pos, sample_count, block_count;
91   int   data_pos, sample_count/*, block_count*/;
9292    int previous_block=0;
9393
9494   data_pos = 0;
9595   sample_count = 0;
96    block_count = 0;
96    /*block_count = 0;*/
9797    previous_block = 0;
9898
9999   /* First 768 cycle of synchro */
r7426r7427
119119      if (block_size==0)
120120         block_size=256;
121121
122      block_count++;
122      /*block_count++;*/
123123        sample_count += hector_tap_byte(buffer, sample_count, casdata[data_pos] );
124124        data_pos++;
125125
r7426r7427
146146
147147static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
148148{
149   int   data_pos, sample_count, block_count;
150    int previous_block=0;
149   int   data_pos, sample_count/*, block_count*/;
150    /*int previous_block=0;*/
151151
152152   data_pos = 0;
153153   sample_count = 0;
154    block_count = 0;
155    previous_block = 0;
154    /*block_count = 0;*/
155    /*previous_block = 0;*/
156156
157157    /* Out if len of file not modulo 822 octets    */
158158   if ( (cas_size % 822) != 0 )
r7426r7427
169169      /* Handle block lenght on tape data */
170170      block_size = 822 ; /* Fixed size for the forth*/
171171
172      block_count=0;
172      /*block_count=0;*/
173173
174174      /* Data samples */
175175      for ( ; block_size ; data_pos++, block_size-- )
src/mess/formats/thom_cas.c
r7426r7427
514514   {                        \
515515      if ( (SIZE) > 0 )               \
516516      {                     \
517         int i;                  \
517         int j;                  \
518518         LOG (( "mo5_k5_load: 0-filler size=%i hbitstart=%i\n", (SIZE), hbitsize )); \
519         for ( i = 0; i < (SIZE); i++ )         \
519         for ( j = 0; j < (SIZE); j++ )         \
520520            K5_PUT_BIT( 0 );         \
521521      }                     \
522522   } while (0)
r7426r7427
526526   {                        \
527527      if ( (SIZE) > 0 )               \
528528      {                     \
529         int i;                  \
529         int j;                  \
530530         LOG (( "mo5_k5_load: 0x01 filler size=%i bitstart=%i\n", (SIZE), hbitsize )); \
531         for ( i = 0; i < (SIZE); i++ )         \
531         for ( j = 0; j < (SIZE); j++ )         \
532532            K5_PUT_BYTE( 0x01 );         \
533533      }                     \
534534   } while (0)
src/mess/drivers/pc6001.c
r7426r7427
136136   {
137137      if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger)
138138      {
139         int fgcol = (attr & 2) ? 7 : 2;
139         fgcol = (attr & 2) ? 7 : 2;
140140
141141         for(y=0;y<192;y++)
142142         {
src/mess/drivers/vboy.c
r7426r7427
147147   switch(offset << 1) {
148148      case 0x00:   //INTPND
149149               return state->vip_regs.INTPND;
150               break;
151150      case 0x02:   //INTENB
152151               return state->vip_regs.INTENB;
153               break;
154152      case 0x04:   //INTCLR
155153               logerror("Error reading INTCLR\n");
156154               break;
157155      case 0x20:   //DPSTTS
158156               return state->vip_regs.DPSTTS;
159               break;
160157      case 0x22:   //DPCTRL
161158               return state->vip_regs.DPCTRL;
162               break;
163159      case 0x24:   //BRTA
164160               return state->vip_regs.BRTA;
165               break;
166161      case 0x26:   //BRTB
167162               return state->vip_regs.BRTB;
168               break;
169163      case 0x28:   //BRTC
170164               return state->vip_regs.BRTC;
171               break;
172165      case 0x2A:   //REST
173166               return state->vip_regs.REST;
174               break;
175167      case 0x2E:   //FRMCYC
176168               return state->vip_regs.FRMCYC;
177               break;
178169      case 0x30:   //CTA
179170               return state->vip_regs.CTA;
180               break;
181171      case 0x40:   //XPSTTS
182172               return state->vip_regs.XPSTTS;
183               break;
184173      case 0x42:   //XPCTRL
185174               return state->vip_regs.XPCTRL;
186               break;
187175      case 0x44:   //VER
188176               return state->vip_regs.VER;
189               break;
190177      case 0x48:   //SPT0
191178               return state->vip_regs.SPT[0];
192               break;
193179      case 0x4A:   //SPT1
194180               return state->vip_regs.SPT[1];
195               break;
196181      case 0x4C:   //SPT2
197182               return state->vip_regs.SPT[2];
198               break;
199183      case 0x4E:   //SPT3
200184               return state->vip_regs.SPT[3];
201               break;
202185      case 0x60:   //GPLT0
203186               return state->vip_regs.GPLT[0];
204               break;
205187      case 0x62:   //GPLT1
206188               return state->vip_regs.GPLT[1];
207               break;
208189      case 0x64:   //GPLT2
209190               return state->vip_regs.GPLT[2];
210               break;
211191      case 0x66:   //GPLT3
212192               return state->vip_regs.GPLT[3];
213               break;
214193      case 0x68:   //JPLT0
215194               return state->vip_regs.JPLT[0];
216               break;
217195      case 0x6A:   //JPLT1
218196               return state->vip_regs.JPLT[1];
219               break;
220197      case 0x6C:   //JPLT2
221198               return state->vip_regs.JPLT[2];
222               break;
223199      case 0x6E:   //JPLT3
224200               return state->vip_regs.JPLT[3];
225               break;
226201      case 0x70:   //BKCOL
227202               return state->vip_regs.BKCOL;
228               break;
229203      default:
230204               logerror("Unemulated read: addr %08x\n", offset * 2 + 0x0005f800);
231205               break;
src/mess/drivers/cdi.c
r7426r7427
703703            verboselog(space->machine, 12, "scc68070_periphs_r: Timer Status Register: %02x & %04x\n", scc68070->timers.timer_status_register, mem_mask);
704704         }
705705         return (scc68070->timers.timer_status_register << 8) | scc68070->timers.timer_control_register;
706         break;
707706      case 0x2022/2:
708707         verboselog(space->machine, 2, "scc68070_periphs_r: Timer Reload Register: %04x & %04x\n", scc68070->timers.reload_register, mem_mask);
709708         return scc68070->timers.reload_register;
r7426r7427
747746            verboselog(space->machine, 2, "scc68070_periphs_r: DMA(%d) Status Register: %04x & %04x\n", (offset - 0x2000) / 32, scc68070->dma.channel[(offset - 0x2000) / 32].channel_status, mem_mask);
748747         }
749748         return (scc68070->dma.channel[(offset - 0x2000) / 32].channel_status << 8) | scc68070->dma.channel[(offset - 0x2000) / 32].channel_error;
750         break;
751749      case 0x4004/2:
752750      case 0x4044/2:
753751         if(ACCESSING_BITS_0_7)
r7426r7427
14531451         l3=cdic_xa_last[3];
14541452   int b=0;
14551453   int s=0;
1456   int decoded = 0;
1454   //int decoded = 0;
14571455
14581456   for (b=0; b<18; b++)
14591457   {
r7426r7427
14861484            *dp++=d1;
14871485            l3=l2;
14881486            l2=d1;
1489            decoded += 2;
1487            //decoded += 2;
14901488         }
14911489      }
14921490
r7426r7427
34723470   {
34733471      if(mcd212->channel[0].image_coding_method & MCD212_ICM_NR)
34743472      {
3475         int reg = 0;
3473         int reg_ = 0;
34763474         int flag = 0;
34773475
34783476         for(flag = 0; flag < 2; flag++)
34793477         {
3480            for(reg = 0; reg < 4; reg++)
3478            for(reg_ = 0; reg_ < 4; reg_++)
34813479            {
3482               if(mcd212->channel[0].region_control[reg] == 0)
3480               if(mcd212->channel[0].region_control[reg_] == 0)
34833481               {
34843482                  break;
34853483               }
3486               if(x == (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_X))
3484               if(x == (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_X))
34873485               {
3488                  switch((mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_OP) >> MCD212_RC_OP_SHIFT)
3486                  switch((mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_OP) >> MCD212_RC_OP_SHIFT)
34893487                  {
34903488                     case 0: // End of region control for line
34913489                        break;
r7426r7427
34943492                     case 3: // Not used
34953493                        break;
34963494                     case 4: // Change weight of plane A
3497                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3495                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
34983496                        break;
34993497                     case 5:   // Not used
35003498                        break;
35013499                     case 6: // Change weight of plane B
3502                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3500                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
35033501                        break;
35043502                     case 7:   // Not used
35053503                        break;
r7426r7427
35273525                     case 11:   // Not used
35283526                        break;
35293527                     case 12: // Reset region flag and change weight of plane A
3530                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3528                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
35313529                        if(flag)
35323530                        {
35333531                           latched_rf1 = 0;
r7426r7427
35383536                        }
35393537                        break;
35403538                     case 13: // Set region flag and change weight of plane A
3541                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3539                        latched_wfa = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
35423540                        if(flag)
35433541                        {
35443542                           latched_rf1 = 1;
r7426r7427
35493547                        }
35503548                        break;
35513549                     case 14: // Reset region flag and change weight of plane B
3552                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3550                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
35533551                        if(flag)
35543552                        {
35553553                           latched_rf1 = 0;
r7426r7427
35603558                        }
35613559                        break;
35623560                     case 15: // Set region flag and change weight of plane B
3563                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
3561                        latched_wfb = (mcd212->channel[0].region_control[flag*4 + reg_] & MCD212_RC_WF) >> MCD212_RC_WF_SHIFT;
35643562                        if(flag)
35653563                        {
35663564                           latched_rf1 = 1;
src/mess/drivers/mac.c
r7426r7427
8282   {
8383      case 0:   // VERSION
8484         return 0;   // original ASC
85         break;
8685
8786      default:
8887         break;
src/mess/drivers/x68k.c
r7426r7427
563563   x68k_sys.mouse.inputtype++;
564564   if(x68k_sys.mouse.inputtype > 2)
565565   {
566      int val = scc8530_get_reg_b(scc, 0);
566      int i_val = scc8530_get_reg_b(scc, 0);
567567      x68k_sys.mouse.inputtype = 0;
568568      x68k_sys.mouse.bufferempty = 1;
569      val &= ~0x01;
570      scc8530_set_reg_b(scc, 0, val);
569      i_val &= ~0x01;
570      scc8530_set_reg_b(scc, 0, i_val);
571571      logerror("SCC: mouse buffer empty\n");
572572   }
573573
src/mess/drivers/pyl601.c
r7426r7427
351351      {
352352         UINT8 code = messram_get_ptr(devtag_get_device(device->machine, "messram"))[(((ma + column) & 0x0fff) + 0xf000)];
353353         code = ((code << 1) | (code >> 7)) & 0xff;
354         data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff];
355354         if (column == cursor_x-2)
356355         {
357356            data = 0xff;
358357         }
358         else
359         {
360            data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff];
361         }
359362         for (bit = 0; bit < 8; bit++)
360363         {
361364            int x = (column * 8) + bit;
r7426r7427
371374   {
372375      for (i = 0; i < x_count; i++)
373376      {
374         UINT8 data = messram_get_ptr(devtag_get_device(device->machine, "messram"))[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
377         data = messram_get_ptr(devtag_get_device(device->machine, "messram"))[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
375378         for (bit = 0; bit < 8; bit++)
376379         {
377380            *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0;
r7426r7427
413416   {
414417      for (i = 0; i < x_count; i++)
415418      {
416         UINT8 data = messram_get_ptr(devtag_get_device(device->machine, "messram"))[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
419         data = messram_get_ptr(devtag_get_device(device->machine, "messram"))[(((ma + i) << 3) | (ra & 0x07)) & 0xffff];
417420         for (bit = 0; bit < 8; bit++)
418421         {
419422            *BITMAP_ADDR16(bitmap, y, (i * 8) + bit) = BIT(data, 7) ? 1 : 0;
src/mess/drivers/gba.c
r7426r7427
22532253      case EEP_IDLE:
22542254//          printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 1);
22552255         return 0x00010001;   // "ready"
2256         break;
22572256
22582257        case EEP_READFIRST:
22592258            gba_state->eeprom_count--;
r7426r7427
22902289//          printf("out = %08x\n", out);
22912290//          printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %08x\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), out);
22922291         return out;
2293         break;
22942292   }
22952293//  printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, gba_state->eeprom_state, activecpu_get_pc(), 0);
22962294   return 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team