Previous 15994 Revisions Next

r7578 Tuesday 16th March, 2010 at 08:00:41 UTC by Fabio Priuli
[SNES] reworked OAM drawing routines, implemented correct range over and time over flags (sprite limits), implemented FirstSprite priority
[src/mame/machine]snes.c
[src/mame/video]snes.c

src/mame/machine/snes.c
r7577r7578
116116   {
117117      memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low ); /* Reset oam address */
118118      memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high );
119      snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
119120   }
120121}
121122
r7577r7578
462463               snes_ppu.oam.address++;
463464               snes_ppu.oam.address_low = snes_ram[OAMADDL] = snes_ppu.oam.address & 0xff;
464465               snes_ppu.oam.address_high = snes_ram[OAMADDH] = (snes_ppu.oam.address >> 8) & 0x1;
466               snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
465467            }
466468            return snes_ppu.ppu1_open_bus;
467469         }
r7577r7578
772774         {
773775            memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low);
774776            memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high);
777            snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
775778         }
776779         snes_ppu.screen_disabled = data & 0x80;
777780         snes_ppu.screen_brightness = (data & 0x0f) + 1;
r7577r7578
818821         snes_ppu.oam.address_low = data;
819822         snes_ppu.oam.saved_address_low = data;
820823         snes_ppu.oam.address = ((snes_ppu.oam.address_high & 0x1) << 8) + data;
824         snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
821825         snes_ram[OAMDATA] = 0;
822826         break;
823827      case OAMADDH:   /* Address for accessing OAM (high) */
r7577r7578
825829         snes_ppu.oam.saved_address_high = data;
826830         snes_ppu.oam.address = ((data & 0x1) << 8) + snes_ppu.oam.address_low;
827831         snes_ppu.oam.priority_rotation = BIT(data, 7);
832         snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
828833         snes_ram[OAMDATA] = 0;
829834         break;
830835      case OAMDATA:   /* Data for OAM write (DW) */
r7577r7578
864869               snes_ppu.oam.address++;
865870               snes_ppu.oam.address_low = snes_ram[OAMADDL] = snes_ppu.oam.address & 0xff;
866871               snes_ppu.oam.address_high = snes_ram[OAMADDH] = (snes_ppu.oam.address >> 8) & 0x1;
872               snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0;
867873            }
868874            return;
869875         }
src/mame/video/snes.c
r7577r7578
997997   int height, width;
998998};
999999
1000static struct OAM oam_list[SNES_SCR_WIDTH / 2];
1000static struct OAM oam_spritelist[SNES_SCR_WIDTH / 2];
10011001
1002#if 0
1003
1004// FIXME: The following functions should be used to create sprite list with
1005// obsel data from the previous line. Unfortunately, some games are very picky
1006// about when you set up sprite attributes (e.g. Super Star Wars - The Empire
1007// Strikes Back and Super Street Fighter II) and they would freeze if we only build
1008// part of the sprite attributes at the right moment and part of them later, during
1009// scanline drawing. Hence, these functions are on hold until more OAM refactoring
1010// is done (soon-ish)
10111002static void snes_update_obsel( void )
10121003{
10131004   snes_ppu.layer[SNES_OAM].charmap = snes_ppu.oam.next_charmap;
r7577r7578
10301021
10311022   snes_ppu.update_oam_list = 0;      // eventually, we can optimize the code by only calling this function when there is a change in size
10321023
1033   for (i = 128; i > 0; i--)
1024   for (i = 127; i >= 0; i--)
10341025   {
1035      if ((i % 4) == 0)
1026      if (((i + 1) % 4) == 0)
10361027         extra = oamram[oam_extra--];
10371028
1038      oam_list[i].vflip = (oamram[oam] & 0x80) >> 7;
1039      oam_list[i].hflip = (oamram[oam] & 0x40) >> 6;
1040      oam_list[i].priority_bits = (oamram[oam] & 0x30) >> 4;
1041      oam_list[i].pal = 128 + ((oamram[oam] & 0x0e) << 3);
1042      oam_list[i].tile = (oamram[oam--] & 0x1) << 8;
1043      oam_list[i].tile |= oamram[oam--];
1044      oam_list[i].y = oamram[oam--] + 1;   /* We seem to need to add one here.... */
1045      oam_list[i].x = oamram[oam--];
1046      oam_list[i].size = (extra & 0x80) >> 7;
1029      oam_spritelist[i].vflip = (oamram[oam] & 0x80) >> 7;
1030      oam_spritelist[i].hflip = (oamram[oam] & 0x40) >> 6;
1031      oam_spritelist[i].priority_bits = (oamram[oam] & 0x30) >> 4;
1032      oam_spritelist[i].pal = 128 + ((oamram[oam] & 0x0e) << 3);
1033      oam_spritelist[i].tile = (oamram[oam--] & 0x1) << 8;
1034      oam_spritelist[i].tile |= oamram[oam--];
1035      oam_spritelist[i].y = oamram[oam--] + 1;   /* We seem to need to add one here.... */
1036      oam_spritelist[i].x = oamram[oam--];
1037      oam_spritelist[i].size = (extra & 0x80) >> 7;
10471038      extra <<= 1;
1048      oam_list[i].x |= ((extra & 0x80) << 1);
1039      oam_spritelist[i].x |= ((extra & 0x80) << 1);
10491040      extra <<= 1;
1050      oam_list[i].y *= snes_ppu.obj_interlace;
10511041
1042      oam_spritelist[i].y *= snes_ppu.obj_interlace;
1043
10521044      /* Adjust if past maximum position */
1053      if (oam_list[i].y >= snes_ppu.beam.last_visible_line * snes_ppu.interlace)
1054         oam_list[i].y -= 256 * snes_ppu.interlace;
1055      if (oam_list[i].x > 255)
1056         oam_list[i].x -= 512;
1045      if (oam_spritelist[i].y >= snes_ppu.beam.last_visible_line * snes_ppu.interlace)
1046         oam_spritelist[i].y -= 256 * snes_ppu.interlace;
10571047
1048      oam_spritelist[i].x &= 0x1ff;
1049
10581050      /* Determine object size */
1059      switch (snes_ppu.oam.next_size)
1051      switch (snes_ppu.oam.size_)
10601052      {
10611053      case 0:         /* 8x8 or 16x16 */
1062         oam_list[i].width  = oam_list[i].size ? 2 : 1;
1063         oam_list[i].height = oam_list[i].size ? 2 : 1;
1054         oam_spritelist[i].width  = oam_spritelist[i].size ? 2 : 1;
1055         oam_spritelist[i].height = oam_spritelist[i].size ? 2 : 1;
10641056         break;
10651057      case 1:         /* 8x8 or 32x32 */
1066         oam_list[i].width  = oam_list[i].size ? 4 : 1;
1067         oam_list[i].height = oam_list[i].size ? 4 : 1;
1058         oam_spritelist[i].width  = oam_spritelist[i].size ? 4 : 1;
1059         oam_spritelist[i].height = oam_spritelist[i].size ? 4 : 1;
10681060         break;
10691061      case 2:         /* 8x8 or 64x64 */
1070         oam_list[i].width  = oam_list[i].size ? 8 : 1;
1071         oam_list[i].height = oam_list[i].size ? 8 : 1;
1062         oam_spritelist[i].width  = oam_spritelist[i].size ? 8 : 1;
1063         oam_spritelist[i].height = oam_spritelist[i].size ? 8 : 1;
10721064         break;
10731065      case 3:         /* 16x16 or 32x32 */
1074         oam_list[i].width  = oam_list[i].size ? 4 : 2;
1075         oam_list[i].height = oam_list[i].size ? 4 : 2;
1066         oam_spritelist[i].width  = oam_spritelist[i].size ? 4 : 2;
1067         oam_spritelist[i].height = oam_spritelist[i].size ? 4 : 2;
10761068         break;
10771069      case 4:         /* 16x16 or 64x64 */
1078         oam_list[i].width  = oam_list[i].size ? 8 : 2;
1079         oam_list[i].height = oam_list[i].size ? 8 : 2;
1070         oam_spritelist[i].width  = oam_spritelist[i].size ? 8 : 2;
1071         oam_spritelist[i].height = oam_spritelist[i].size ? 8 : 2;
10801072         break;
10811073      case 5:         /* 32x32 or 64x64 */
1082         oam_list[i].width  = oam_list[i].size ? 8 : 4;
1083         oam_list[i].height = oam_list[i].size ? 8 : 4;
1074         oam_spritelist[i].width  = oam_spritelist[i].size ? 8 : 4;
1075         oam_spritelist[i].height = oam_spritelist[i].size ? 8 : 4;
10841076         break;
10851077      case 6:         /* undocumented: 16x32 or 32x64 */
1086         oam_list[i].width  = oam_list[i].size ? 4 : 2;
1087         oam_list[i].height = oam_list[i].size ? 8 : 4;
1088         if (snes_ppu.obj_interlace && !oam_list[i].size)
1089            oam_list[i].height = 2;
1078         oam_spritelist[i].width  = oam_spritelist[i].size ? 4 : 2;
1079         oam_spritelist[i].height = oam_spritelist[i].size ? 8 : 4;
1080         if (snes_ppu.obj_interlace && !oam_spritelist[i].size)
1081            oam_spritelist[i].height = 2;
10901082         break;
10911083      case 7:         /* undocumented: 16x32 or 32x32 */
1092         oam_list[i].width  = oam_list[i].size ? 4 : 2;
1093         oam_list[i].height = oam_list[i].size ? 4 : 4;
1094         if (snes_ppu.obj_interlace && !oam_list[i].size)
1095            oam_list[i].height = 2;
1084         oam_spritelist[i].width  = oam_spritelist[i].size ? 4 : 2;
1085         oam_spritelist[i].height = oam_spritelist[i].size ? 4 : 4;
1086         if (snes_ppu.obj_interlace && !oam_spritelist[i].size)
1087            oam_spritelist[i].height = 2;
10961088         break;
10971089      default:
10981090         /* we should never enter here... */
r7577r7578
11011093      }
11021094   }
11031095}
1104#endif
11051096
1106static void snes_update_objects( UINT8 priority_tbl, UINT16 curline )
1097static UINT8 oam_itemlist[32];
1098
1099struct TILELIST {
1100  UINT16 x, priority, pal, tileaddr;
1101  int   hflip;
1102};
1103
1104struct TILELIST oam_tilelist[34];
1105
1106static int is_sprite_on_scanline( UINT16 curline, UINT8 sprite )
11071107{
1108   //if sprite is entirely offscreen and doesn't wrap around to the left side of the screen,
1109   //then it is not counted. this *should* be 256, and not 255, even though dot 256 is offscreen.
1110   int spr_height = (oam_spritelist[sprite].height << 3);
1111
1112   if (oam_spritelist[sprite].x > 256 && (oam_spritelist[sprite].x + (oam_spritelist[sprite].width << 3) - 1) < 512)
1113      return 0;
1114
1115   if (curline >= oam_spritelist[sprite].y && curline < (oam_spritelist[sprite].y + spr_height))
1116      return 1;
1117
1118   if ((oam_spritelist[sprite].y + spr_height) >= 256 && curline < ((oam_spritelist[sprite].y + spr_height) & 255))
1119      return 1;
1120
1121   return 0;
1122}
1123
1124static void snes_update_objects_rto( UINT16 curline )
1125{
1126   int active_sprite;
1127   UINT8 range_over, time_over;
11081128   INT8 xs, ys;
11091129   UINT8 line;
1110   UINT8 range_over = 0, time_over = 0;
1111   UINT8 height, width, vflip, hflip, priority, pal, blend;
1130   UINT8 height, width, vflip, hflip, priority, pal;
11121131   UINT16 tile;
11131132   INT16 i, x, y;
1114   UINT32 name_sel = 0, charaddr;
1133   UINT32 name_sel = 0;
1134
1135   snes_oam_list_build();
1136
1137   /* initialize counters */
1138   range_over = 0;
1139   time_over = 0;
1140
1141   /* setup the proper line */
1142   curline /= snes_ppu.interlace;
1143   curline *= snes_ppu.obj_interlace;
1144
1145   /* reset the list of first 32 objects which intersect current scanline */
1146   memset(oam_itemlist, 0xff, 32);
1147
1148   /* populate the list of 32 objects */
1149   for (i = 0; i < 128; i++)
1150   {
1151      active_sprite = (i + snes_ppu.oam.first_sprite) & 0x7f;
1152
1153      if (!is_sprite_on_scanline(curline, active_sprite))
1154         continue;
1155
1156      if (range_over++ >= 32)
1157         break;
1158
1159      oam_itemlist[range_over - 1] = active_sprite;
1160   }
1161
1162   /* reset the list of first 34 tiles to be drawn */
1163   for (i = 0; i < 34; i++)
1164      oam_tilelist[i].tileaddr = 0xffff;
1165
1166   /* populate the list of 34 tiles */
1167   for (i = 31; i >= 0; i--)
1168   {
1169      if (oam_itemlist[i] == 0xff)
1170         continue;
1171
1172      active_sprite = oam_itemlist[i];
1173
1174      tile = oam_spritelist[active_sprite].tile;
1175      x = oam_spritelist[active_sprite].x;
1176      y = oam_spritelist[active_sprite].y;
1177      height = oam_spritelist[active_sprite].height;
1178      width = oam_spritelist[active_sprite].width;
1179      vflip = oam_spritelist[active_sprite].vflip;
1180      hflip = oam_spritelist[active_sprite].hflip;
1181      priority = oam_spritelist[active_sprite].priority_bits;
1182      pal = oam_spritelist[active_sprite].pal;
1183
1184      /* Only objects using tiles over 255 use name select */
1185      name_sel = (tile < 256) ? 0 : snes_ppu.oam.name_select;
1186
1187      ys = (curline - y) >> 3;
1188      line = (curline - y) % 8;
1189      if (vflip)
1190      {
1191         ys = height - ys - 1;
1192         line = (-1 * line) + 7;
1193      }
1194      line <<= 1;
1195      tile <<= 5;
1196
1197      int ii;
1198
1199      for (ii = 0; ii < width; ii++)
1200      {
1201         INT16 xx = (x + (ii << 3)) & 0x1ff;
1202
1203         if (x != 256 && xx >= 256 && (xx + 7) < 512)
1204            continue;
1205
1206         if (time_over++ >= 34)
1207            break;
1208
1209         xs = (hflip) ? (width - 1 - ii) : ii;
1210         oam_tilelist[time_over - 1].tileaddr = name_sel + tile + table_obj_offset[ys][xs] + line;
1211         oam_tilelist[time_over - 1].hflip = hflip;
1212         oam_tilelist[time_over - 1].x = xx;
1213         oam_tilelist[time_over - 1].pal = pal;
1214         oam_tilelist[time_over - 1].priority = priority;
1215      }
1216   }
1217
1218   /* set Range Over flag if necessary */
1219   if (range_over > 32)
1220      snes_ppu.stat77_flags |= 0x40;
1221
1222   /* set Time Over flag if necessary */
1223   if (time_over > 34)
1224      snes_ppu.stat77_flags |= 0x80;
1225}
1226
1227static void snes_update_objects( UINT8 priority_tbl )
1228{
1229   UINT8 blend, priority;
1230   UINT32 charaddr;
1231   int i;
11151232   static const UINT8 table_obj_priority[10][4] = {
11161233                  {2, 5, 8, 11},   // mode 0
11171234                  {1, 3, 6, 9},   // mode 1
r7577r7578
11241241                  {1, 3, 5, 6},   // mode 7 EXTBG
11251242                  {1, 2, 5, 8}   // mode 1 + BG3 priority bit
11261243   };
1127   UINT8 *oamram = (UINT8 *)snes_oam;
1128   INT16 oam = 0x1ff;
1129   UINT16 oam_extra = oam + 0x20;
1130   UINT16 extra = 0;
11311244
11321245#ifdef SNES_LAYER_DEBUG
11331246   if (debug_options.bg_disabled[SNES_OAM])
r7577r7578
11421255   if (!scanlines[SNES_MAINSCREEN].enable && !scanlines[SNES_SUBSCREEN].enable)
11431256      return;
11441257
1145   curline /= snes_ppu.interlace;
1146   curline *= snes_ppu.obj_interlace;
1258   charaddr = snes_ppu.layer[SNES_OAM].charmap << 13;
11471259
1148   charaddr = snes_ppu.oam.next_charmap << 13;
1149
1150   for (i = 128; i > 0; i--)
1260   /* finally draw the tiles from the tilelist */
1261   for (i = 0; i < 34; i++)
11511262   {
1152      if ((i % 4) == 0)
1153         extra = oamram[oam_extra--];
1263      if (oam_tilelist[i].tileaddr == 0xffff)
1264         continue;
11541265
1155      oam_list[i].vflip = (oamram[oam] & 0x80) >> 7;
1156      oam_list[i].hflip = (oamram[oam] & 0x40) >> 6;
1157      oam_list[i].priority_bits = (oamram[oam] & 0x30) >> 4;
1158      oam_list[i].pal = 128 + ((oamram[oam] & 0x0e) << 3);
1159      oam_list[i].tile = (oamram[oam--] & 0x1) << 8;
1160      oam_list[i].tile |= oamram[oam--];
1161      oam_list[i].y = oamram[oam--] + 1;   /* We seem to need to add one here.... */
1162      oam_list[i].x = oamram[oam--];
1163      oam_list[i].size = (extra & 0x80) >> 7;
1164      extra <<= 1;
1165      oam_list[i].x |= ((extra & 0x80) << 1);
1166      extra <<= 1;
1167      oam_list[i].y *= snes_ppu.obj_interlace;
1168
1169      /* Adjust if past maximum position */
1170      if (oam_list[i].y >= snes_ppu.beam.last_visible_line * snes_ppu.interlace)
1171         oam_list[i].y -= 256 * snes_ppu.interlace;
1172      if (oam_list[i].x > 255)
1173         oam_list[i].x -= 512;
1174      tile = oam_list[i].tile;
1175      x = oam_list[i].x;
1176      y = oam_list[i].y;
1177      height = oam_list[i].height;
1178      width = oam_list[i].width;
1179      vflip = oam_list[i].vflip;
1180      hflip = oam_list[i].hflip;
1181      priority = table_obj_priority[priority_tbl][oam_list[i].priority_bits];
1182      pal = oam_list[i].pal;
1183
1184      /* Draw sprite if it intersects the current line */
1185      if (curline >= y && curline < (y + (snes_ppu.oam.size[oam_list[i].size] << 3)))
1186      {
1187         /* Only objects using palettes 4-7 can be transparent */
1188         blend = (pal < 192) ? 1 : 0;
1189
1190         /* Only objects using tiles over 255 use name select */
1191         name_sel = (tile < 256) ? 0 : snes_ppu.oam.next_name_select;
1192
1193         ys = (curline - y) >> 3;
1194         line = (curline - y) % 8;
1195         if (vflip)
1196         {
1197            ys = snes_ppu.oam.size[oam_list[i].size] - ys - 1;
1198            line = (-1 * line) + 7;
1199         }
1200         line <<= 1;
1201         tile <<= 5;
1202         if (hflip)
1203         {
1204            UINT8 count = 0;
1205            for (xs = (snes_ppu.oam.size[oam_list[i].size] - 1); xs >= 0; xs--)
1206            {
1207               if ((x + (count << 3) < SNES_SCR_WIDTH))
1208               {
1209                  snes_draw_tile_object(charaddr + name_sel + tile + table_obj_offset[ys][xs] + line, x + (count++ << 3), priority, hflip, pal, blend);
1210               }
1211               time_over++;   /* Increase time_over. Should we stop drawing if exceeded 34 tiles? */
1212            }
1213         }
1214         else
1215         {
1216            for (xs = 0; xs < snes_ppu.oam.size[oam_list[i].size]; xs++)
1217            {
1218               if ((x + (xs << 3) < SNES_SCR_WIDTH))
1219               {
1220                  snes_draw_tile_object(charaddr + name_sel + tile + table_obj_offset[ys][xs] + line, x + (xs << 3), priority, hflip, pal, blend);
1221               }
1222               time_over++;   /* Increase time_over. Should we stop drawing if exceeded 34 tiles? */
1223            }
1224         }
1225
1226         /* Increase range_over. Stop drawing if exceeded 32 objects and enforcing that limit is enabled */
1227         range_over++;
1228         if (range_over == 32) //&& (input_port_read(machine, "INTERNAL") & 0x01) )
1229         {
1230            /* Set the flag in STAT77 register */
1231            snes_ppu.stat77_flags |= 0x40;
1232            /* FIXME: This stops the SNESTest rom from drawing the object test properly.  Maybe we shouldn't stop drawing? */
1233            /* return; */
1234         }
1235      }
1266      blend = (oam_tilelist[i].pal < 192) ? 1 : 0;
1267      priority = table_obj_priority[priority_tbl][oam_tilelist[i].priority];
1268      snes_draw_tile_object(charaddr + oam_tilelist[i].tileaddr, oam_tilelist[i].x, priority, oam_tilelist[i].hflip, oam_tilelist[i].pal, blend);
12361269   }
1237
1238   if (time_over >= 34)
1239   {
1240      /* Set the flag in STAT77 register */
1241      snes_ppu.stat77_flags |= 0x80;
1242   }
12431270}
12441271
12451272
r7577r7578
12601287   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 1, 4, SNES_BG3, curline, SNES_OPT_NONE, 0);
12611288   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 6, 9, SNES_BG2, curline, SNES_OPT_NONE, 0);
12621289   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 7, 10, SNES_BG1, curline, SNES_OPT_NONE, 0);
1263   snes_update_objects(0, curline);
1290   snes_update_objects(0);
12641291}
12651292
12661293static void snes_update_mode_1( UINT16 curline )
r7577r7578
12751302      snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 2, SNES_BG3, curline, SNES_OPT_NONE, 0);
12761303      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG2, curline, SNES_OPT_NONE, 0);
12771304      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 5, 8, SNES_BG1, curline, SNES_OPT_NONE, 0);
1278      snes_update_objects(1, curline);
1305      snes_update_objects(1);
12791306   }
12801307   else
12811308   {
12821309      snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 9, SNES_BG3, curline, SNES_OPT_NONE, 0);
12831310      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 3, 6, SNES_BG2, curline, SNES_OPT_NONE, 0);
12841311      snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG1, curline, SNES_OPT_NONE, 0);
1285      snes_update_objects(9, curline);
1312      snes_update_objects(9);
12861313   }
12871314}
12881315
r7577r7578
12951322
12961323   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE2, 0);
12971324   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE2, 0);
1298   snes_update_objects(2, curline);
1325   snes_update_objects(2);
12991326}
13001327
13011328static void snes_update_mode_3( UINT16 curline )
r7577r7578
13071334
13081335   snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0);
13091336   snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, snes_ppu.direct_color);
1310   snes_update_objects(3, curline);
1337   snes_update_objects(3);
13111338}
13121339
13131340static void snes_update_mode_4( UINT16 curline )
r7577r7578
13191346
13201347   snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE4, 0);
13211348   snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE4, snes_ppu.direct_color);
1322   snes_update_objects(4, curline);
1349   snes_update_objects(4);
13231350}
13241351
13251352static void snes_update_mode_5( UINT16 curline )
r7577r7578
13311358
13321359   snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, 0);
13331360   snes_update_line(SNES_COLOR_DEPTH_2BPP, 1, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0);
1334   snes_update_objects(5, curline);
1361   snes_update_objects(5);
13351362}
13361363
13371364static void snes_update_mode_6( UINT16 curline )
r7577r7578
13421369#endif /* SNES_LAYER_DEBUG */
13431370
13441371   snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 1, 4, SNES_BG1, curline, SNES_OPT_MODE6, 0);
1345   snes_update_objects(6, curline);
1372   snes_update_objects(6);
13461373}
13471374
13481375static void snes_update_mode_7( UINT16 curline )
r7577r7578
13551382   if (!snes_ppu.mode7.extbg)
13561383   {
13571384      snes_update_line_mode7(1, 1, SNES_BG1, curline);
1358      snes_update_objects(7, curline);
1385      snes_update_objects(7);
13591386   }
13601387   else
13611388   {
13621389      snes_update_line_mode7(0, 4, SNES_BG2, curline);
13631390      snes_update_line_mode7(2, 2, SNES_BG1, curline);
1364      snes_update_objects(8, curline);
1391      snes_update_objects(8);
13651392   }
13661393}
13671394
r7577r7578
15311558         scanlines[SNES_MAINSCREEN].buffer[ii] = snes_cgram[0];
15321559      }
15331560
1534      /* Draw screens */
1561      /* Prepare OAM for this scanline */
1562      snes_update_objects_rto(curline);
1563
1564      /* Draw scanline */
15351565      snes_draw_screens(curline);
15361566
1567      snes_update_obsel();
1568
15371569#ifdef SNES_LAYER_DEBUG
15381570      if (snes_dbg_video(machine, bitmap, curline))
15391571      {
r7577r7578
15541586         scanline2 = &scanlines[SNES_SUBSCREEN];
15551587      }
15561588
1557      /* Phew! Draw the line to screen */
1589      /* Draw the scanline to screen */
1590
15581591      fade = snes_ppu.screen_brightness;
15591592
15601593      for (x = 0; x < SNES_SCR_WIDTH; x++)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team