|
> This algorithm is used to decrease the counter by 1... I keep the rightmost > values (the least significant bits), which, if I ignore the carry, results in > the register decreasing by 1 at each iteration... > > Amazing what a small piece of paper and the Windows calculator (in scientific > mode) can do for you. :-) > > Here's the breakdown: > > 1F = 0001 1111 = 1F > FF = 1111 1111 > ----------------- > [download a life] >
Not sure if this helps but since ARM is very bad as handling words and bytes, for Cyclone I went for the strategy of pushing up everything to the TOP 8 bits of the 32 bit registers and doing the sum.
e.g. to calculate 0x12 + 0x34 I would calculate 0x12000000+0x34000000
Works fine and sets all the right bits (NZVC), except when you get to SBC and ADC...
Newsdee's Love, Glory, and Discussion Boards
|