Am Fri, 30 Jun 2006 11:20:03 +0200 schrieb David Brown:
>>
>>   mov.b &0x0034, r15
>>   add r15, r15
>>   mov r15, &two
>>   ret
>
> That would be wrong.  PINB is declared volatile - the C code says it should
> be read twice, so it should be read twice by the generated assembly.  Thus
> better code would be:

Thinking 'embedded' seems to be quite different than thinking 'C'. ;-)
I agree with that. But your code

> mov.b &0x0034, r15
> add.d &0x0034, r15
> mov r15, &two
> ret

adds a 8 bit number to a 16 bit number where adding to 8 bit numbers
is needed. ;-)


Reply via email to