Hello, I have a problem with CCS v3.3 where I have a function that returns an unsigned 32bit value which is to be stored in an unsigned 32bit local variable and immediately upon return the value is correct as expected in the accumulator but the next instruction is a SETC SXM followed by a MOV ACC, @AL... what this does is copies the low word of the accumulator onto the full accumulator with sign extension.
This behavior makes no sense, the function I am calling returns a 32bit in ACC... why would CCS generate assembly code that then immediately destroys the high word of that register? Furthermore, the return of this function and the variable that the return is being assigned to are unsigned, why is CCS setting sign extension?
C:
u32_Result = calc32(u32_Param);
ASM:
LCR calc32
SETC SXM
MOV ACC, @AL
If I go into mixed mode and break on the SXM instruction the value in the accumulator is correct, it is what I expected the function to return... then it is destroyed by the next line...
I realize CCS 3.3 is not the most recent version, but if someone could provide at least a workaround for this problem I would appreciate it.