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

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

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

Jump to solution
818 Views
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:

Labels (1)
0 Kudos
1 Solution
557 Views
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.

 

View solution in original post

0 Kudos
5 Replies
557 Views
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 Kudos
557 Views
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 Kudos
557 Views
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 Kudos
558 Views
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 Kudos
557 Views
100asong
Contributor I

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

0 Kudos