It is currently Sun Sep 24, 2017 11:17 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 8:03 am 
Offline

Joined: Tue Mar 28, 2017 6:26 am
Posts: 17
hi,
I'm a beginner on Nes and using cc65.
I can display sprites, background, move sprites, palettes, attributes ... and even change bank for graphics / chr.

I read the articles on nesdev wiki but I have a worry when I want to display sprites in 8x16.
My code works in 8x8 and with metatiles.
I change the size of the sprites by changing the PPUCTRL to 0x2000 From 0x90 (1001 000) to 0xB0 (1011 000).
00X0 0000 : X = 0 -> 8x8
: X = 1 -> 8x16

I must do it wrong. Do I need to change something in my code.
I write the values of my sprites in OAM in 0x200 (Y,Tile Num, Attrib, X, ...);
As you can see in pictures, the NES only draw the top of my sprites (8x8)

Code:
SPRITES[0] = 16; // Y
      SPRITES[1] = 0; // Tile num
      SPRITES[2] = 0; // Atributes
      SPRITES[3] = 24; // X
      
      
      SPRITES[4] = 16;
      SPRITES[5] = 0x10;
      SPRITES[6] = 0;
      SPRITES[7] = 48;


Image


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 8:07 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7210
Location: Chexbres, VD, Switzerland
That's because the way pattern tables are displayed by most debuggers aren't 8x16-sprites-friendly. It displays tile $10 below tile $00, but when set in 8x16 sprite mode, the NES will display tile $01 below tile $00.

Some CHR editors such as YY-CHR or Tile-Molester have an enablable option to display tiles in a layout that is 8x16-sprites-friendly, I don't know whether any emulator with debug and VRAM viewer has this option as well.


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 8:09 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1733
Location: DIGDUG
It's sequential.

In 8x16 mode, you tell it to use tile #1. The sprite will be composed of tile #1 (top) and tile #2 (bottom).

Not tile #1 and tile #$11, as you have.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 8:10 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5648
Location: Canada
How are your changing the value written to $2000? Whatever library you're using probably writes it during vblank, so you need to tell the library to do that using whatever interface it might have for doing so.

If you open FCEUX's debugger and put a breakpoint on writes to $2000 you can see exactly what and when is getting written to it.

Can you post a ROM?

Bregalad wrote:
That's because the way pattern tables are displayed by most debuggers aren't 8x16-sprites-friendly. It displays tile $10 below tile $00, but when set in 8x16 sprite mode, the NES will display tile $01 below tile $00.

Some CHR editors such as YY-CHR or Tile-Molester have an enablable option to display tiles in a layout that is 8x16-sprites-friendly, I don't know whether any emulator with debug and VRAM viewer has this option as well.

This shouldn't be the problem. FCEUX has an 8x16 tile display mode, and OP has it enabled. You can see the checkbox in the screenshot they posted.


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 8:51 am 
Offline

Joined: Tue Mar 28, 2017 6:26 am
Posts: 17
Thanks you all.

It was because of the value of $2000. I checked with the debugger as you ask me and the value was the same as the older.
I change the value when my screen is off at start. But I had also placed it in my NMI function in asm. Remove from it and it's working.

I could not remember the change. 3 hours for that. :mrgreen:

But it's working now. Need to replace my tile in my chr file but it's ok. I walked step by step.


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Wed Mar 29, 2017 10:45 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7210
Location: Chexbres, VD, Switzerland
rainwarrior wrote:
This shouldn't be the problem. FCEUX has an 8x16 tile display mode, and OP has it enabled. You can see the checkbox in the screenshot they posted.

Ooops, my bad. I didn't even know about this feature, it's a nice thing to have !

If I'm not mistaken the SNES actually handles sprites larger than 8x8 in a way that is more friendly to tile viewer (but less friendly to hardware), for example a 16x16 sprite with index $00 would be made of 8x8 sprites $00, $01, $10 and $11.


Top
 Profile  
 
 Post subject: Re: Spreite 8x8 to 8x16
PostPosted: Fri Mar 31, 2017 12:44 am 
Offline

Joined: Tue Mar 28, 2017 6:26 am
Posts: 17
No problem.

I use yy-chr and I can actually modify the bank of sprites in 8x16 but if you change the background bank after, it also changes the order of the tiles for the background in 8x16.
So I prefer to use the normal mode for bank sprites.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group