I want from my C code to read value of PC, an for that I want write inline __asm function. I wrote this
int Get_Add(void) { int Add; __asm { mov Add, PC} return Adresa; }
But I got error message "Glavni.c(22): error: #20: identifier "PC" is undefined" Could anybody help me, do I need to include some library?
What an odd thing to do.
It would be simpler to do something like:
int Get_Add(void) { return(int)Get_Add; }
Thank You a lot, it works :)
But what if I want to force my program to jump to specific location, I have to do that with _asm inline function
No you don't.
Do it via a pointer.
typedef void (*TFnPtr)(void); void main(void) { TFnPtr FnPtr; FnPtr = (TFnPtr)0x12345678; (FnPtr)(); }
You must be careful. Make sure you understand what this does and what you really want to do.
There are sensible reasons for doing something like this. Just ensure you choose one of those sensible reasons.