Sprites.chr is not appearing in PPU viewer

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Mon Oct 13, 2014 11:56 pm

I don't know if I'm doing this correctly, but I just added my sprites.chr file to my program, but when I run my code, it won't appear in the PPU viewer (I'm using FCEUX for testing). I added both font.chr (contains background tiles) and sprites.chr files with .incbin"<file-name-here>", but only the background tiles appear in the PPU viewer.

This is how it is in the code:

Code: Select all

 .bank 2
 .org $0000
 .incbin "Font.chr"
 .incbin "Sprites.chr"
Here is full code if you need it: http://pastebin.com/qkBqk2y9
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

Drag
Posts: 1335
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: Sprites.chr is not appearing in PPU viewer

Post by Drag » Tue Oct 14, 2014 1:01 am

Make sure your two .chr files don't add up to be over 8kb, because on the NES, the background uses 4kb, and the sprites use 4kb.

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Tue Oct 14, 2014 2:39 am

Drag wrote:Make sure your two .chr files don't add up to be over 8kb, because on the NES, the background uses 4kb, and the sprites use 4kb.
The background has 31 tiles and sprites has 2 tiles. No way either of those would be more than 4kb.
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

Denine
Posts: 398
Joined: Wed Feb 17, 2010 5:42 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by Denine » Tue Oct 14, 2014 5:05 am

Make sure your background .chr file is 4kb. If it is smaller, then sprites .chr file might be simply included right after background. See PPU viewer if you can find your sprite tiles on the background "side" of the viewer.
To avoid this you can either(in your case, since you are using NROM+CHR ROM):
-Make background file excatly 4kb. It have to have 256 tiles, even if latter are empty.
-Changing the end of the assembly file to:
.bank 2
.org $0000
.incbin "Font.chr"
.org $1000
.incbin "Sprites.chr"

User avatar
tokumaru
Posts: 11998
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Sprites.chr is not appearing in PPU viewer

Post by tokumaru » Tue Oct 14, 2014 7:34 am

Did you set the palettes correctly at $3F00-$3F1F? FCEUX will not show anything if the palette isn't set (you can cycle through the palettes in the viewer IIRC).

Did you select the correct pattern tables for each side through bits 3 and 4 of register $2000 (PPUCTRL)? If both are pointing to the background pattern table that's all you'll see.

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by Kasumi » Tue Oct 14, 2014 10:58 am

I think Denine's got it right. I downloaded the file from pastebin, changed nothing inside. I supplied two different 4 KB CHR files and it displayed both in FCEUX's PPU viewer just fine.

Alternatively Font.chr is actually 8 KB. The number of tiles used doesn't necessarily correspond to the size of the file. Which version of NESASM are you using?

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Tue Oct 14, 2014 11:00 pm

I use NESASM 3. I'm also using YY-CHR for making the graphics if that matters.
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by 3gengames » Wed Oct 15, 2014 12:14 am

You have to set the palette to see them in fceux's viewer.

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Wed Oct 15, 2014 12:33 am

I did set all 8 palettes. I'll have to see if I can limit the chr file sizes to see if that fixes this problem. Looking at the earlier messages, it's very well possible that my chr files are over 4kb
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by 3gengames » Wed Oct 15, 2014 12:43 am

Should be 8KB exactly. YY-Chr should save that normally, using 2 pages. At least from what I remember.

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Wed Oct 15, 2014 1:51 am

I just checked my chr files, and it seems like they both are 16kb. Maybe it's best that I put all graphics to the same file, but just start sprites with 4kb offset to get them right after the first background table.
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by 3gengames » Wed Oct 15, 2014 1:55 am

Save to the right file format, too. If your settings aren't right on the editor, then it won't output right file format/size for the file, no matter the extension.

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Wed Oct 15, 2014 2:07 am

What are the correct settings then? I attached image of the settings that appear on the main editor screen, but I don't know if that's what you meant. Anyway, I got the sprite to appear on the PPU viewer by adding it to the font.chr with a 4kb offset. Now I just need to make it appear on screen.
yychr.png
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

User avatar
Kasumi
Posts: 1292
Joined: Wed Apr 02, 2008 2:09 pm

Re: Sprites.chr is not appearing in PPU viewer

Post by Kasumi » Wed Oct 15, 2014 2:19 am

Here is a blank 4KB file. If your YY-CHR is like mine (yours is newer than mine), YY-CHR will save a file that is the exact same size as it was when it was opened. So open this and paste your background tiles in. Save it as font.chr. Open it again and put your sprite tiles in. Save it as sprites.chr.

I'd say your file is still too big, because YY-CHR shows 256 tiles in its left window. 256 tiles is 4 KB. You can scroll down which means your file is bigger than 4KB. And it looks like you can actually scroll quite a bit which means your file is probably still 16 KB and not even 8KB.

Edit: Actually I learned a new thing about YY-CHR today. The filesize is at the top in hex. 000000/004000. $4000 is how big your file is. $4000 is 16KB.

Edit2: I'll attach a blank 8KB file as well in case that's your preferred method.
Attachments
blank 8K file.chr
(8 KiB) Downloaded 123 times
blank 4K file.chr
(4 KiB) Downloaded 123 times

User avatar
Tsutarja
Posts: 123
Joined: Sun Oct 12, 2014 11:06 am
Location: Finland

Re: Sprites.chr is not appearing in PPU viewer

Post by Tsutarja » Wed Oct 15, 2014 2:40 am

I'll have to leave that for later. I got a new problem. I was trying to set up a proper code for updating either background and/or sprites if necessary and I messed something up. The screen is black now, but I can see stuff on the Nametable Viewer just fine.

Here is the code: http://pastebin.com/sAee4cD3
UP SIDE DOWN A B A B B A B A Hidari migi
L R L R STOP & DASH & UP & TALK Ijou nashi

Post Reply