Call a subroutine  from a separate file

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

Call a subroutine  from a separate file

ソリューションへジャンプ
2,438件の閲覧回数
sctang
Contributor I

Hello,

It is my first time to write an application with a main program in a file and several subroutines in different files for a HCS08QE MCU. Attached is a program for testing. After compling it, I got the following message:

 

A13003: Value is truncated to one byte

SR_Test.asm line 3

A13003: Value is truncated to one byte

SR_Test.asm line 4

A1104: Undeclared user defined symbol:  PTCD

SR_Test.asm line 3

Compile failed

 

The compiler regards the command  "BSET 7,PTCD" in the main program as a direct addressing instruction since the address of PTCD is 0x04. However, it is not the case for the same command in the subroutine.

I tried many times by adding XDEF, XREF, XREF.B to the .asm files, and the object code file to Project.prm, but I got other error messages.

Please give me advice because I have spend a long time to learn this which should be a straightforward issue.

Thanks.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,478件の閲覧回数
CrasyCat
Specialist III

Hello

 

I assume you want to build the 2 .asm file separately and then link them together.

Am I right?

 

Then you should

  1- Create a file SR_Test.inc, where you have declaration for all symbols from SR_Test.asm

       that are visible from outside of the file.

  2- Include that .inc file in main.asm and remove include from SR_Test.asm

  3. In SR_Test.asm, include directive.inc and make label SR_Test_Function visible from

      outside of the module (using directive XDEF)

 

CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,479件の閲覧回数
CrasyCat
Specialist III

Hello

 

I assume you want to build the 2 .asm file separately and then link them together.

Am I right?

 

Then you should

  1- Create a file SR_Test.inc, where you have declaration for all symbols from SR_Test.asm

       that are visible from outside of the file.

  2- Include that .inc file in main.asm and remove include from SR_Test.asm

  3. In SR_Test.asm, include directive.inc and make label SR_Test_Function visible from

      outside of the module (using directive XDEF)

 

CrasyCat

0 件の賞賛
返信
1,478件の閲覧回数
sctang
Contributor I

Thank you, CrasyCat,

 

It works. This is what I need.

 

sctang

0 件の賞賛
返信