Re: [stella] time to stick me with a fork?

Subject: Re: [stella] time to stick me with a fork?
From: "Ronald A. Laski, Jr." <rlaski@xxxxxxxxx>
Date: Sun, 14 Mar 2004 14:31:18 -0600
At 01:41 PM 3/14/2004 +0000, you wrote:

Subpixel Joust Pong comes to mind. Everyone on the group said it
was the right thing to do, and it made all the difference in
the world, but 16 bit math still makes me go crosseyed sometimes.
(I understand why you clear the carry before addition, but owe
it to myself to spend some time w/ the 6502 emulator and figure
out why you need to set the carry before subtraction.)
In a nutshell - the carry bit is essentially the 9th bit of accumulator (possibly other math functions of the cpu as well - it's been a number of years since I've touched 6502 programming) so, when your addition results in a value greater than 255 decimal, the 9th bit (carry) catches the carryover. In a subtraction, it PREVENTS an underflow. (in other words, when you set the 9th bit of the accumulator to 1 it becomes impossible for your subtraction to go below zero, or to become negative.)

If anyone else wishes to clarify this further, please go ahead!! :)

My 2 cents,

Ron


---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/


Current Thread