syntax for IX1 addressing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

syntax for IX1 addressing

2,900 次查看
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.

标签 (1)
标记 (1)
0 项奖励
回复
5 回复数

1,580 次查看
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 项奖励
回复

1,580 次查看
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 项奖励
回复

1,580 次查看
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 项奖励
回复

1,580 次查看
csosza
Contributor I
Thanks, I will use a non-zero address.
0 项奖励
回复

1,580 次查看
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 项奖励
回复