m68k subtraction and absolute value

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 »

Yep that is what it was I put a moveq #0,d0 before the draw line function and the mul worked.
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

sega16 wrote:Yep that is what it was I put a moveq #0,d0 before the draw line function and the mul worked.
Ah - isn't strange how some of the SMALLEST THINGS can make a program act weird?
sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 »

I agree it can be strange and this is especially true for asm. When programming in high level languages this does not happen as much as far as I am aware because the programer does not manipulate registers.
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

True, but you can get other issues that compilers now generate warnings for, like this case:

Code: Select all

    int x;
    while (something)
    {
        if (whatever)
            x = whatever = 0;
        x += 1;
        something = check_something();
    }
The code assumes that whatever is set coming into the loop or else x has an undefined value to start. That will generate a warning in gcc, but still compile as the compiler cannot tell the state of whatever at that point.
Post Reply