HCS08QE8 - SP manipulation - Code Warrior 6.1

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HCS08QE8 - SP manipulation - Code Warrior 6.1

1,251件の閲覧回数
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 返信

544件の閲覧回数
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 件の賞賛
返信