A simple sprite demo for teaching

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

DoNotWant
Posts: 83
Joined: Sun Sep 30, 2012 3:44 am

Re: A simple sprite demo for teaching

Post by DoNotWant »

I understand the logic of the inertia effect, but I'm having a real hard time understanding the use of signed numbers and fixed-point arithmetic. I haven't really found anything good about it from the POV of the 6502 on google, anyone here got anything good?

I can add/subtract 8n-bit unsigned numbers, and it would be great to know how to do it
with signed fixed-point numbers, so I could extend this to use 16-bit velocity.

I tried handling inertia with unsigned numbers, but that turned into an unholy mess pretty quick.

Thanks!
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: A simple sprite demo for teaching

Post by rainwarrior »

Addition and subtraction of signed numbers the exactly the same as unsigned numbers, on the 6502. The same set of instructions works for both.

The part that is significantly different is making comparisons. Here is a good article to read:
http://www.6502.org/tutorials/compare_beyond.html

Another thing that is different is the bitwise right shift. You will want to copy the sign bit as you shift, like instead of LSR, perhaps use CMP #$80, ROR.
DoNotWant
Posts: 83
Joined: Sun Sep 30, 2012 3:44 am

Re: A simple sprite demo for teaching

Post by DoNotWant »

rainwarrior wrote:Addition and subtraction of signed numbers the exactly the same as unsigned numbers, on the 6502. The same set of instructions works for both.

The part that is significantly different is making comparisons. Here is a good article to read:
http://www.6502.org/tutorials/compare_beyond.html

Another thing that is different is the bitwise right shift. You will want to copy the sign bit as you shift, like instead of LSR, perhaps use CMP #$80, ROR.
Thanks!
I think the problem is the fixed-point part. I tried to edit a little more of tepples code, but it turned into another mess. I'm getting tierd, so I'm gonna give it another try tomorrow.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A simple sprite demo for teaching

Post by tepples »

"tierd"? I thought tires don exits :p

In any case, version 4 is out with new build environment setup instructions courtesy of the Super NES version's thread.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A simple sprite demo for teaching

Post by tepples »

I've released version 0.05 incorporating improvements based on the suggestions made by koitsu and Espozo. One new feature in the MMC1 template is a driver for UNROM/UOROM that's a drop-in replacement.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

As if anybody gives a fork

Post by tepples »

I put the NROM version on GitHub so that you can create new NES projects by forking pinobatch/nrom-template. One change was made: PNG to CHR conversion was ported to Python 3.

EDIT (2016-11-16): UNROM, UOROM, SGROM, and SNROM version as well at pinobatch/snrom-template. I forked it from the nrom-template repository so that changes that I make in the NROM version can be reflected in this version.

If you cannot use GitHub's fork functionality for some reason, such as if you prefer Savannah, GitLab, or BitBucket for whatever reason, you can create an empty repository on your Git host of choice and then clone manually:

Code: Select all

git clone https://github.com/pinobatch/nrom-template.git PROJECT
cd PROJECT
git remote rename origin upstream
git remote add origin https://github.com/USERNAME/PROJECT.git
git push -u origin master
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A simple sprite demo for teaching

Post by tepples »

Now ported to BNROM, so people can get started with the 32K PRG ROM bankswitching model of BNROM, AOROM, Color Dreams, and GTROM

pinobatch/bnrom-template
Post Reply