How to determine the number of a tile in a tilesheet?

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

Post Reply
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

How to determine the number of a tile in a tilesheet?

Post by mattheweston »

I can use the following code to load a tile from a tileset and display it at 80,80. However, how are tiles numbered so I can tell what tile to load?

For example, if I have a tileset, and there is a tile in the middle of the tileset I want to load, how do I determine the number or the tile to load?

Code: Select all

  LDA #$80
  STA $0200        ;put sprite 0 in center ($80) of screen vertically
  STA $0203        ;put sprite 0 in center ($80) of screen horizontally
  LDA #$00
  STA $0201        ;tile number = 0
  STA $0202        ;color palette = 0, no flipping

  LDA #%10000000   ; enable NMI, sprites from Pattern Table 0
  STA $2000

  LDA #%00010000   ; no intensify (black background), enable sprites
  STA $2001
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: How to determine the number of a tile in a tilesheet?

Post by thefox »

A good graphics editor like YY-CHR will display you the tile number in the status bar when you hover your cursor over a tile.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
mikaelmoizt
Posts: 120
Joined: Sat Apr 12, 2014 12:11 pm
Location: Gothenburg, Sweden

Re: How to determine the number of a tile in a tilesheet?

Post by mikaelmoizt »

If you have FCEUX, you can simply go to Debug -> PPU Viewer and take a look at your tilemap in your ROM.
Attachments
ppuviewer.jpg
I´ve got %01100011 problems but the BITs aint one.
JRoatch
Formerly 43110
Posts: 394
Joined: Wed Feb 05, 2014 7:01 am
Location: us-east
Contact:

Re: How to determine the number of a tile in a tilesheet?

Post by JRoatch »

So arrange like that then the "middle" tiles are 119, 120, 135, and 136 in decimal. Also keep in mind the sprite mode in $2000. nesdev wiki on Sprites
Post Reply