Re: Update on emulating a paddle on the C64.

From: Spiro Trikaliotis (ml-cbmhackers_at_trikaliotis.net)
Date: 2004-12-10 07:18:46

Hello,

(just commenting on this part, as I've not read the other parts of this
thread:)

* On Thu, Dec 09, 2004 at 02:19:02PM -0600 Jim Brain wrote:
 
> The corner case is when the counter is at 65535 (for example), and it
> wraps, to 4095.
> 
> 4095-65535 = -61440 -> (signed int) -4095 (I think...)

This would be +4096, not -4095:

-61440 = $FFF...FF1000; only getting the least 16 bits results in $1000,
thus, 4096.

Anyway, at least this is true for most compilers that I need. As soon as
you leave the range of your signed arithmetic, you loose the grounds of
ANSI C. In fact, the compiler can code this case like it wants; it could
even through an exception and terminate your program, or fill the
variable with some random number, or ...

But, as I told: You're right, the above is the behaviour I've seen on
all compilers I worked with so far.

Regards,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.