Thanks Jan,
I have reached this conclusion too, I didn't understand the
compiler/assembler interaction (and still don't fully, I can't get an
"sts var, Y" to work, but I'll work at it).
Btw. I like using silly names for variables, but only in very small demo
scripts ;-)

Robert

Robert,

I think you want this:
uint8_t get_ram_byte(uint16_t ram_address)
{
  uint8_t    byte;
  asm  ("ld %0, %a1"    "\n\t"
         : "=&r" (byte) : "e" (ram_address));
  return byte;
}

By using the "=&r" constraint you tell the compiler that it shall allocate a 
register and after the asm routine it shall use its content as the "byte" 
variable (which is, btw., a really bad idea for a name of a variable).

JW






_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to