For instruction :NEG,it has one usage:NEG oprx8,X.I don't know how to use it in fact.

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

For instruction :NEG,it has one usage:NEG oprx8,X.I don't know how to use it in fact.

ソリューションへジャンプ
1,111件の閲覧回数
100asong
Contributor I

I don't know what means oprx8.

In datasheet,oprx8 is "Any label or expression that evaluates to an unsigned 8-bit value, used for indexed addressing".

Could you please give me an sample.

Thanks.:smileytongue:

ラベル(1)
0 件の賞賛
返信
1 解決策
850件の閲覧回数
peg
Senior Contributor IV

Hello Tom,

 

PTAD, I presume is 0. What's happening here is the assembler is optimising this to the faster IX addressing mode which uses an implied zero base. It shouldn't happen for a non-zero base.

 

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
850件の閲覧回数
rocco
Senior Contributor II

Hi Tom,

 

I assume you are talking about a MC9S08 family MCU. If so, then you need to get the HCS08 Family Reference Manual and read section 6.3 to learn about the addressing modes in the S08.

 

But to answer your question:

 

        neg     n,X     ;negate the a value in memory

 

"n" is an 8 bit offset, contained in the assembled instruction, which is added to the contents  of the H:X register to determine the address in memory to be negated.

0 件の賞賛
返信
850件の閲覧回数
peg
Senior Contributor IV

Hello Tom,

 

Not clear what you are saying here. There are many addressing modes available with this instruction

The limitation you allude to here occurs with many instructions in this addressing mode.

It means that the base value that you index from must be in the "zero page" or the first 256 bytes of RAM.

0 件の賞賛
返信
850件の閲覧回数
100asong
Contributor I

Thanks for your help.

Now I know how to use it:smileysurprised:prx8 is a base address value and X index register is offset.

I meet a new question: the machine code is 60 00,I want to know what the asm sentenct  is.

I try to write the code: NEG 0,X or NEG PTAD,X. But the corresponding hex is 70.I can not get 60 00 object binary.

Please help me about it.Thanks.

0 件の賞賛
返信
851件の閲覧回数
peg
Senior Contributor IV

Hello Tom,

 

PTAD, I presume is 0. What's happening here is the assembler is optimising this to the faster IX addressing mode which uses an implied zero base. It shouldn't happen for a non-zero base.

 

0 件の賞賛
返信
850件の閲覧回数
100asong
Contributor I

Okay,I know now.It should be code space.

0 件の賞賛
返信