Closed anoxic83 closed 1 year ago
The X register is still in 8-bit mode. 16-bit registers aren't assumed by default in 65816 mode. You need .xl
to tell the assembler that X is now 16-bit (make sure you have whatever processor flags set correctly beforehand).
.xl
ldx #$5654
xa-2.3.14/% xa -w test.xa
xa-2.3.14/% xd a.o65
0000000 ? T V
a2 54 56
0000003
(See this and other related pseudo-ops: http://www.floodgap.com/retrotech/xa/xa.1.html )
xa -w test.asm ldx #$5654 test.asm:line 6: 0006:Overflow error Break after 1 errors
documentation of WDC65C816 (https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf): 3.5.18 Immediate-# With Immediate (#) addressing the operand is the second byte (second and third bytes when in the 16-bit mode) of the instruction.