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.
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
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..?)
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.
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