Menu

#468 Subtraction with data in acc error

closed-wont-fix
5
2013-05-25
2003-03-03
No

When doing a 16 bit subtraction where the right side
resides in the accumulator, the high byte is
incorrectly? complimented resulting in the wrong result.

A cut down gzipped .lst file follows compiled with
--i-code-in-asm.
I had to leave all the serial code initialisation and
stuff in there to prevent the compiler from optimising
the problem away.

I also found that something like

void setup_vars(void)
{
i = 64;
j = 3;
}

void main(void)
{
(Other init routines here)
setup_vars
k = (i+20) - (j*5);

}

would not call the setup_vars routine. there was no
trace of it in the .lst file and it just did not work.

Also having a problem with initialised variables.
like
xdata unsigned char IP[4] = { 192,168,1,100 };
it appears to be compiled in, seems to work in the
simulator but on my 89c668 does not write the right
values to ram. doing a manual init byte by byte works
however.

Discussion

  • Bernhard Held

    Bernhard Held - 2003-03-03

    Logged In: YES
    user_id=203539

    We can't fix bugs, unless we're able to reproduce them.
    Please supply complete, compilable examples (attaching
    files doesn't work reliably, but it often works in a second
    step!).

    Futhermore it would be much easier to process your reports,
    if you would file a separate bug report for each problem.

    Even if I close this report for now plese feel free to submit new
    ones. The bugs seem to be serious and we want to learn
    more about them.

     
  • Bernhard Held

    Bernhard Held - 2003-03-03
    • status: open --> closed
     
  • Bernhard Held

    Bernhard Held - 2003-03-03
    • milestone: --> unreproducable
    • assigned_to: nobody --> bernhardheld
    • status: closed --> closed-wont-fix
     
  • Frieder Ferlemann

    Logged In: YES
    user_id=589052

    Hi,

    one part of the problem might be missing "()"
    and the compiler not complaining about it.

    Frieder

    This seems OK for me? :

    int i,j,k;

    void setup_vars(void)
    {
    i = 64;
    j = 3;
    }

    void main(void)
    {
    /* (Other init routines here) */

    setup_vars(); /* OK? OK! */

    setup_vars; /* no warning (and no code either) */

    k = (i+20) - (j*5);
    }

     

Log in to post a comment.