HCS08QE8 - SP manipulation - Code Warrior 6.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08QE8 - SP manipulation - Code Warrior 6.1

890 Views
ef24096
Contributor II
Hi all,

I want to manipulate the stack pointer with an macro.

I tried this with the following code which doesn't work.

#define __SetSP( x ) __asm LDHX #x; __asm TXS;

error message (C18103: Factor exptected).

Have anyone an solution to do this?

cb


Message Edited by ef24096 on 2008-05-27 12:13 PM

Message Edited by ef24096 on 2008-05-27 12:13 PM
Labels (1)
0 Kudos
1 Reply

183 Views
bigmac
Specialist III
Hello,
 
The following seems to give the intended result.
 
#pragma NO_STRING_CONSTR
#define __SetSP( x ) __asm LDHX #x; __asm TXS
 
Without the pragma, the presence of the '#' character within the inline assembler instruction confuses the C preprocessor when it expands the macro.
 
Regards,
Mac
 
 


Message Edited by bigmac on 2008-05-28 02:54 AM
0 Kudos