1
\$\begingroup\$

I am following this tutorial https://georgjz.github.io/snesaa04/. I am stuck on trying to draw a sprite.

Where the end result should be this:

enter image description here

My end result is this:

enter image description here

As I have not been able to find samples of tile and palette files, I am not sure if I have done everything right.

Sprites.vra:

0b 2e 2a 3f 1e 1f 0f 3f 2e 3f 1c 1f 0c ff f3 fe
2f 00 3f 00 1f 00 3c 00 38 00 10 00 00 00 00 00

SpriteColors.pal:

fe 3f 3e 77 f8 5d 0f 49 ff 7f f8 6f 8a 6b 49 62
64 39 e0 2c 60 18 98 04 9f 0e 3e 09 2c 00 00 00

As the tutorial proposes, I use cc65 as a compiler. The files are included like this:

.segment "SPRITEDATA"
SpriteData: .incbin "Sprites.vra"
ColorData:  .incbin "SpriteColors.pal"

As I could not get bsnes working, I am using Snes9X.

As this failed, I tried to draw a plane with just one color as well to figure out the logic. I did not manage, as the colors were always scrambled.

Questions:

How should the tile/bitplane and palette files look like? What is the checksum error my emulator throws?

As a last note: please be patient if this is basic stuff. I am ex web dev and a retro game hobbyist, and assembly code is completely foreign world to me.

\$\endgroup\$
5
  • \$\begingroup\$ Welcome to GDSE. Just to clarify - where did you get the sprite & palette data from? I didn't see those resources in the tutorial, but maybe I just missed them. If they're not from the tutorial, we may need more details about how you got the sprite related information. \$\endgroup\$
    – Pikalek
    Dec 21, 2020 at 16:26
  • \$\begingroup\$ @Pikalek Ah sorry for the confusion. They were based on instructions given in lesson 3 of the tutorial: georgjz.github.io/snesaa03 \$\endgroup\$ Dec 21, 2020 at 16:28
  • \$\begingroup\$ No worries, just trying to eliminate possible sources of error. Related to that, are you sure the sprite files are encoded as hex/binary & not ASCIII/text? I made that mistake myself once or twice with assembly :P \$\endgroup\$
    – Pikalek
    Dec 21, 2020 at 16:36
  • \$\begingroup\$ @Pikalek it seems that was it! Thank you very much! If you like, write an answer out of it so I can accept and give you the points. \$\endgroup\$ Dec 21, 2020 at 16:45
  • 1
    \$\begingroup\$ Glad I was able to help! I've posted an answer that included the thought process that led me to that suggestion. \$\endgroup\$
    – Pikalek
    Dec 21, 2020 at 17:34

1 Answer 1

2
\$\begingroup\$

When coding in assembly, it can be easy to mix up your data format. In this particular case, the assembly code is expecting the .pal and .vra files to be in hex / binary. For instance, here's the .pal data from the tutorial:

hex code for .pal file

The far left columns indicate the memory offset, the middle column is the data in hexadecimal form & the far right column is the data in ASCII.

So, if properly encoded, if you open the .pal file in something like Notepad, you should see the data as presented on the right, starting with ?>w ] I o kIbd.

If, instead you see fe3f3e77f8 and so forth in a text editor, then the data has been encoded as text / ASCII and will not represent what you want or what the assembly program is expecting.

My first clue that this was a data representation problem was the combination that the data came directly from the tutorial & the error returned was complaining about a bad checksum. Unless the tutorial itself was flawed, this suggested that somewhere, bad / unexpected data was getting processed. I've made similar errors myself when dealing with assembly & hex data.

Using a good hex editing tool will help, but it's still possible to make mistakes, so if you are experiencing data problems, it's a good idea to double check your data format & encoding.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .