News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Nes tile editor question  (Read 1544 times)

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Nes tile editor question
« on: October 12, 2015, 08:29:23 am »
My question is about how a tile editor reads the data, im not referring to 2bpp bitplanes but rather how it makes sure it gets all the graphics. My first thought was is that it just puts the 2bpp format on all set of 16 bytes from start to end but I dont think that  work because not all data is 16 bytes which could cause it to scramble the tiles, what i mean is it could start formatting  a 16 byte set starting on the wrong byte which would mess it all up. My other thought is since CHR-ROM graphics are always at the bottom of the file(maybe im wrong on that) a tile editor could read the data backwards and process the 16 byte sets all the way though without scrambling them. Anyone know exactly how a tile editor does this?

FAST6191

  • Hero Member
  • *****
  • Posts: 3184
    • View Profile
Re: Nes tile editor question
« Reply #1 on: October 12, 2015, 08:53:54 am »
Your tile editor is not that intelligent. If you want to think of it as a hex editor with a very odd decode function then that would not be the worst thing you can do.

"2bpp format on all set of 16 bytes from start to end" is pretty accurate here. Many tile editors will allow you to change this start address, probably at a bytewise and maybe even bitwise level (something like tiled2002, http://home.arcor.de/minako.aino/TilEd2002/ , combines the larger byte/whole tile jumps with the smaller ones), many others will allow different decode methods and a precious few (mainly something like crystaltile2) will allow you to skip a number of bits per tile in case you have a per tile header or something -- such a thing is practically unheard of in the NES world but happens enough to warrant the functionality at least on the DS. Equally some might have some minor awareness of NES ROM formats and even mappers but nothing close to any kind of heuristics or pattern analysis like you might see for audio programs at times. Likewise the NES is a bit more limited in what it can do with graphics and slow enough that compression is not terribly common so you can set default decode methods to be luckier more than "start at 0" might afford, you lose this as you go more generic and get something like http://www.romhacking.net/utilities/646/ but at the same time it is far more extensible.

"a tile editor could read the data backwards and process the 16 byte sets all the way though without scrambling them"
I am not sure quite where you are going with that but it was either a slight lead on from above or a lead into either optimisation. Maybe back when it might have mattered but today. Start from the back is also a way to dodge flash cart header/alignment issues but at the same time if you advance one pixel at a time you will very shortly at least hit a multiple/natural divisor of the right number.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Nes tile editor question
« Reply #2 on: October 12, 2015, 09:18:04 am »
Thanks you, I was not aware that some editors let you choose where to start. Im working with tile editor pro and it does not have such an option. But if a game is CHR-ROM and all the data is at the bottom, in theory one could read the last 16 bytes of the file and process it with 2bpp, grab the next set of 16 and do the same ect.. ect.. would this not work? Im only talking about CHR ROM not compressed data.

Bregalad

  • Hero Member
  • *****
  • Posts: 2756
    • View Profile
Re: Nes tile editor question
« Reply #3 on: October 12, 2015, 10:07:54 am »
CHR-ROM data is at the end only by iNES convention. Someone just decided that it was the case.

Some tile editors automatically detect iNES headers and teleport you to the start of the CHR-ROM when opening a .nes file, for instance YY-CHR does this.

Hypnotic_rabbit

  • Jr. Member
  • **
  • Posts: 35
    • View Profile
Re: Nes tile editor question
« Reply #4 on: October 12, 2015, 10:48:24 am »
Ahh the header, I didnt think of that. I know a little bit about the header but not the part of it you are talking about, all i know is the NES part at the beginning and the values that tell how many banks in PRG and CHR but i dont know where is tells where they start in the header, Ill look into that tho, thanks.