Page 2 of 2

Re: A simple sprite demo for teaching

Posted: Sat Nov 01, 2014 9:54 am
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!

Re: A simple sprite demo for teaching

Posted: Sat Nov 01, 2014 10:50 am
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.

Re: A simple sprite demo for teaching

Posted: Sat Nov 01, 2014 12:11 pm
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.

Re: A simple sprite demo for teaching

Posted: Sun Nov 09, 2014 8:08 pm
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.

Re: A simple sprite demo for teaching

Posted: Fri Feb 13, 2015 4:06 pm
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.

As if anybody gives a fork

Posted: Tue Nov 15, 2016 6:11 pm
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

Re: A simple sprite demo for teaching

Posted: Wed Feb 07, 2018 1:55 pm
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