syntax for IX1 addressing

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

syntax for IX1 addressing

2,026 Views
csosza
Contributor I

What is the syntax (an example) for IX1 addressing mode?

 

I tried this

            LDHX #$0
            SUB $0,X

Which results

 1381   33   000000 45 0000               LDHX #$0
 1382   34   000003 F0                      SUB $0,X
 

But this is wrong. Opcode should be E0.

Labels (1)
Tags (1)
0 Kudos
5 Replies

706 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

When the offset value is zero, this represents the special case of IX addressing mode, which is more efficient than IX1 addressing mode. So this is what the assembler uses. It means that the code requires one less byte, and one less execution cycle.

 

Note that the instructions SUB 0,X and SUB ,X are alternative forms of the same instruction. 

 

Is there any particular reason that you would wish to force the use of IX1 mode?

 

Regards,

Mac

 

Message Edited by bigmac on 2009-06-22 01:38 AM
0 Kudos

706 Views
csosza
Contributor I

Hi,

 

It would be an example in my demonstration (this would be a theoretical example).

Can I use IX1 addressing in CodeWarrior? I have the latest version.

(or is there any like using DB directives..?)

 

0 Kudos

706 Views
peg
Senior Contributor IV

Hi,

Its like Mac said. If you use an offset of zero the assembler will use the more efficient IX mode.

If you really want IX1 mode, or to demonstrate it then the offset would have to be non-zero.

 

0 Kudos

706 Views
csosza
Contributor I
Thanks, I will use a non-zero address.
0 Kudos

706 Views
CompilerGuru
NXP Employee
NXP Employee

For completeness, the assembler has  a syntax for specifing the size of the operand:

 

 

 3043   27   000004 F0                      SUB $0,X; 3044   28   000005 E0 00                   SUB <$0,X; 3045   29   000007 D0 0000                 SUB >$0,X;

 

Note that this works with the assembler, not with the HLI in the compiler.

 

Especially for educationaly purposes, I would recommend to use an offset which requires the addressing mode and not just 0.

 

Daniel

 

0 Kudos