I have a question about streaming in new object tiles.

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
SNES AYE
Posts: 201
Joined: Mon Nov 07, 2022 11:28 am

I have a question about streaming in new object tiles.

Post by SNES AYE »

Are there any known ways to lower how much VRAM space each object tile takes up in order to be able to stream more of them in/out every frame than is typical on SNES, maybe by using them in some kind of unofficial lower-colour mode rather the normal 4bpp or something along those lines?
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: I have a question about streaming in new object tiles.

Post by psycopathicteen »

Yes, you can do that. There is a DMA mode that skips every other byte. You can use that to animate 2bpp tiles, just as long as you leave every other byte blank.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: I have a question about streaming in new object tiles.

Post by tepples »

If it's only about vblank time and not about VRAM capacity, try this. It fits each object tile into 16 bytes, which should let you copy 10 tiles in a scanline instead of only 5, or 380 tiles in an unextended 60 Hz vblank instead of 190.
  1. Draw the sprite at 2bpp using only colors 0 (transparent), 1, 4, and 5, or only colors 0, 2, 8, and 10.
  2. Encode the tile in NES format (all 8 rows of plane 0 then all 8 rows of plane 1).
  3. Set VMAIN to increment when the low byte of VMDATA is written (if 0, 1, 4, and 5) or when the high byte of VMDATA is written (if 0, 2, 8, 10).
  4. DMA copy to the low byte (if 0, 1, 4, and 5) or to the high byte (if 0, 2, 8, 10) instead of the usual mode that writes low than high.
EDIT: psycopathicteen and I thought of the same thing.
SNES AYE
Posts: 201
Joined: Mon Nov 07, 2022 11:28 am

Re: I have a question about streaming in new object tiles.

Post by SNES AYE »

Great. Thanks for both those answers.
SNES AYE
Posts: 201
Joined: Mon Nov 07, 2022 11:28 am

Re: I have a question about streaming in new object tiles.

Post by SNES AYE »

Follow up question: So, with this 2bpp approach for the objects, how are the object palettes now setup and used then in terms of how I would actually draw the sprite art to make sure they are using them correctly? Is it just the same as normal but I only use four colors from each of the 8 16-color palettes rather than the normal full 16 colors per palette, or do I get to use maybe 32 4-color palettes for the sprites now? I think part of the answer to this is maybe covered above, but I just want to be completely clear.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: I have a question about streaming in new object tiles.

Post by Oziphantom »

you can make a set with 0,1,4,5 and another with 0,2,8,10 as the colours. So you only get 16 palletes.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: I have a question about streaming in new object tiles.

Post by 93143 »

You can write either the even bitplanes or the odd bitplanes. This means you can use two 2bpp (3-colour plus holes) subsubpalettes per 4bpp sprite subpalette. You cannot, however, switch a location in VRAM from one subsubpalette to the other without writing all four bitplanes, since the ones you aren't using need to be blank (the exception is if the sprite is completely solid, with no zero colour, in which case you can just set up the 4bpp subpalette so that it doesn't matter what's in the unused bits, like how Bad Apple for the Mega Drive got around the MD not having a 2bpp mode).

It occurs to me that one could do transparency between 2bpp sprites by filling in the full 15-colour subpalette with the appropriate combinations, and combining the sprites in software via bit shifting and row offset, with one sprite using the even bitplanes and the other using the odd bitplanes. 2bpp is a very restrictive colour depth for sprites, but since the S-PPU can only do one colour math operation per displayed pixel, and can't do colour math between sprites at all, it might be worth it in specific circumstances...
Catyak
Posts: 54
Joined: Mon Apr 25, 2022 4:33 pm

Re: I have a question about streaming in new object tiles.

Post by Catyak »

As a clarification, you have 8 even and 8 odd palettes (for a total of 16) with 3 colors plus transparency. However, depending on if you write the 2bpp sprite data to the even or odd sprite bitplanes, the sprite can only use a palette from either the 8 even palettes or the 8 odd palettes.

Basically: Even sprites use the 8 even palettes, and odd sprites use the 8 odd palettes.
SNES AYE
Posts: 201
Joined: Mon Nov 07, 2022 11:28 am

Re: I have a question about streaming in new object tiles.

Post by SNES AYE »

Thanks for all the information. Some good stuff to think about for sure. :)
Post Reply