From: Massimo G. <mas...@gm...> - 2008-02-28 13:50:57
|
Hello, I'm using SDCC on PIC 16F target. Now I need to use inline assembly function to manage data on local variables. How can I use local variables within inline assembly code? My case is: unsigned char handle (unsigned char data) { unsigned char temp; _asm some_assembly_manipulation on temp _endasm; return temp; } I can't find the way to reference variable 'temp' in inline assembly code. Thank you, Massimo. |
From: Massimo G. <mas...@gm...> - 2008-02-28 14:20:32
|
Hello, I'm using SDCC on PIC 16F target. Now I need to use inline assembly function to manage data on local variables. How can I use local variables within inline assembly code? My case is: unsigned char handle (unsigned char data) { unsigned char temp; _asm some_assembly_manipulation on temp _endasm; return temp; } I can't find the way to reference variable 'temp' in inline assembly code. Thank you, Massimo. |
From: Adam G. <tra...@gm...> - 2008-02-28 16:22:37
|
Massimo, I am new to sdcc and Pic in general but I think the answer to your question is to specify the address location of your variable when you declare it and then point your assembly to that spot when you want to access it in asm. http://particle.teco.edu/software/sdcc/example.html This page has a good reference on converting *other *compiler code over into sdcc code. In their example they declare some unsigned int with uint8_t at 0x10 foo; uint8_t at 0x11 bar; My guess is you can access them in asm via the address you gave them in your code. --Adam On Thu, Feb 28, 2008 at 8:49 AM, Massimo Gaggero <mas...@gm...> wrote: > Hello, > I'm using SDCC on PIC 16F target. Now I need to use inline assembly > function to manage data on local variables. How can I use local > variables within inline assembly code? > My case is: > > unsigned char handle (unsigned char data) { > unsigned char temp; > _asm > some_assembly_manipulation on temp > _endasm; > return temp; > } > > I can't find the way to reference variable 'temp' in inline assembly code. > > Thank you, > Massimo. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > |