I've put an interesting code on this page .
const uint8_t MachineCode[44] PROGMEM = {
0x25, 0x9A, 0x2D, 0x9A, 0x40, 0xE5, 0x5F, 0xEF,
0x6F, 0xEF, 0x6A, 0x95, 0xF1, 0xF7, 0x5A, 0x95,
0xE1, 0xF7, 0x4A, 0x95, 0xD1, 0xF7, 0x2D, 0x98,
0x40, 0xE5, 0x5F, 0xEF, 0x6F, 0xEF, 0x6A, 0x95,
0xF1, 0xF7, 0x5A, 0x95, 0xE1, 0xF7, 0x4A, 0x95,
0xD1, 0xF7, 0xEB, 0xCF
};
const uint8_t *ptr = MachineCode;
void setup() {
//get address of code and call it
//Creio que o ERRO esteja aqui:
asm(
"lds r30, ptr \n\t"
"lds r31, ptr+1 \n\t"
"lsr r30 \n\t"
"icall \n\t"
);
}
void loop() {
//never reach here
}
I ran the code on my Arduino, but I got this error:
C:\Users\xxx\Documents\Arduino\xxx/xxx.ino:19: undefined reference to 'ptr'
I think it's because the assembly code is not getting access to the ptr
variable. I'm a beginner in C \ C ++.