If you’re not familiar with SHEL, you should be. Their new album dropped recently!
Anyway, I have a compiler that does some funny stuff. When I write
I would expect the assembly to be
MOV A,r RLC A MOV r,A
but instead I get
MOV A,r ADD A,ACC MOV r,A
What does this accomplish?
I mean, sure, it’s doubling the input, and for the target it’s the same number of cycles, but it is somewhat confusing.
What’s more confusing, though, is that if r is 3, I wind up with 3+3=2. Last I checked, this wasn’t the case. Oh, and apparently 2+2=0.
Secondly, if the result of all of my manipulation means that r is 0, I would expect the line return r; to assign 0 to the variable on the left side of the equal sign in the calling function (e.g. var=function(); ). When I step through the code, however, the debugger at the return line tells me that r suddenly is 0xFF. And when the return happens, 0xA1 gets assigned to var. Does this make sense to anyone else?
Back to banging my head against the desk (figuratively) in an attempt to figure out what’s going on here!