SNES Image format

Hier könnt ihr Euch mit Gleichgesinnten austauschen bei der Entwicklung eines neuen Spiels oder eines neuen Stücks Hardware... oder einfach nur über Coding und Spieleentwicklung allgemein plaudern.

Moderatoren: ikari_01, d4s

Chaz231
SNES-Newbie
SNES-Newbie
Beiträge: 3
Registriert: 4. Juni 2016, 18:12

SNES Image format

Beitrag von Chaz231 » 4. Juni 2016, 18:31

I am trying to understand how the snes image format works because I don't have windows and I can't use pcx2snes. I've done quite a bit of research and I've manage to figure out 95% percent of it, but there is one part I'm a bit hung up on. I'm trying to read the graphic used in this tutorial (tiles.inc):

http://wiki.superfamicom.org/snes/show/ ... ic-Tac-Toe

The link to the source files is at the bottom of the page.

I know that the dimensions from the pcx source file included are 112x16. I also know that each line in of the table in the snes image file is one 8x8 tile. The part that is confusing to me is that there are 30 rows in the table but I know that only 28 are displayed. It would seem to me that there is an extra to rows of $00 to show that it's a division of the top half of the image from the bottom half. Does anybody know if that is the case and if so how the snes knows that it's not another real tile? Thanks in advance!

Benutzeravatar
Ramsis
SNES-Freak
SNES-Freak
Beiträge: 538
Registriert: 29. Dezember 2011, 15:33
+Positive Tradingpoints+: 3 von 3
Wohnort: Löwenhöhle :3
Kontaktdaten:

Re: SNES Image format

Beitrag von Ramsis » 5. Juni 2016, 10:46

Hi, and welcome to the forums! :)
Chaz231 hat geschrieben:I am trying to understand how the snes image format works because I don't have windows and I can't use pcx2snes.
In case you're on Linux, pcx2snes/gfx2snes work just fine using Wine (i.e., by simply invoking ./<filename>.exe in a terminal). Also, there's a tool named sixpack which contains a native Linux binary. :wink:
Chaz231 hat geschrieben:I know that the dimensions from the pcx source file included are 112x16. I also know that each line in of the table in the snes image file is one 8x8 tile. The part that is confusing to me is that there are 30 rows in the table but I know that only 28 are displayed.
A quick look at address $8000 in the assembled ROM reveals that the original 112×16 graphics are .INCBINed as one row of 128×8 pixels (= 16 tiles) and another row of 112×8 px (= 14 tiles). Hence the 30 tiles total. It seems that the gfx converter (pcx2snes in this case) automagically added the two "missing" empty tiles at the end of the first row in order to preserve the vertical alignment of the TicTacToe icons.

So all in all, there are 6 empty tiles: 2 at the beginning of row 1 (lines 4 and 5 in tiles.inc), 2 at its end (lines 18 and 19), and 2 at the beginning of row 2 (lines 20 and 21).

Hope this helps! :)

Ramsis
Dateianhänge
tictac.png
tictac.png (14.42 KiB) 4224 mal betrachtet

Chaz231
SNES-Newbie
SNES-Newbie
Beiträge: 3
Registriert: 4. Juni 2016, 18:12

Re: SNES Image format

Beitrag von Chaz231 » 5. Juni 2016, 23:08

Thank you for your response! I'm on mac, but I've tried wine and for some reason it has stopped working for me... Likely because my computer is getting outdated. But my friend and I are actually attempting to build a snes image viewer/editor/converter that is hosted on a website so it's cross platform. That's the main reason I'm trying to figure all this stuff out.
A quick look at address $8000 in the assembled ROM reveals that the original 112×16 graphics are .INCBINed as one row of 128×8 pixels (= 16 tiles) and another row of 112×8 px (= 14 tiles).
What do you mean looking at address $8000 in the assembled ROM? Are you running the game in a debugger? And how are you able to see that? That does make sense that it would lengthen the image to 128 pixels though.

Thank you again for the help!

Benutzeravatar
Ramsis
SNES-Freak
SNES-Freak
Beiträge: 538
Registriert: 29. Dezember 2011, 15:33
+Positive Tradingpoints+: 3 von 3
Wohnort: Löwenhöhle :3
Kontaktdaten:

Re: SNES Image format

Beitrag von Ramsis » 6. Juni 2016, 10:32

Chaz231 hat geschrieben:What do you mean looking at address $8000 in the assembled ROM?
I loaded the ROM in Tile Layer Pro, a simple tile editor (i.e., a program that lets you view/edit NES/GB/SNES/etc graphics). :wink:

Chaz231
SNES-Newbie
SNES-Newbie
Beiträge: 3
Registriert: 4. Juni 2016, 18:12

Re: SNES Image format

Beitrag von Chaz231 » 6. Juni 2016, 18:57

Gotcha. Alrighty! I'll figure it out. Thank you!

Antworten