HCS08QE8 - SP manipulation - Code Warrior 6.1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

HCS08QE8 - SP manipulation - Code Warrior 6.1

1,252 次查看
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
标签 (1)
0 项奖励
回复
1 回复

545 次查看
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 项奖励
回复