Re: [cc65] Strange behaviour of a simple code

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-08-09 11:49:25
On Mon, Aug 09, 2010 at 10:51:56AM +0200, Carlos wrote:
>    In these last days i'm really puzzled with a strange behaviour with a cc65
>    simple program, don't know if is some kind of bug or a bad code from my
>    part but can't find where the problem can be.

I don't know what inc_test is supposed to do, but it's so weird that I assume
it's wrong.

For one: It does only increment the low bytes of the values. Nothing is
propagated into the high bytes. So the outcome is difficult to calculate when
displaying the values in decimal.

Second: The routines uses adc but does never set the carry to a known state.
So the result depends on the value of the carry when the function is called,
which is more or less unknown.

Third: The carry from the addition of the low byte of "to" is added to the low
byte of "from". I cannot see how this would make sense.

If you're trying to get into assembly, why not start with something simpler,
like incrementing a byte variable. The next thing could be to increment a word
variable and so on.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Aug 9 11:49:34 2010

This archive was generated by hypermail 2.1.8 : 2010-08-09 11:49:36 CEST