q = frag_more (2);
*q++ = (rnum & R_IX) ? 0xDD : 0xFD;
*q = (prefix) ? prefix : (opcode + (6 << shift));
- emit_byte (symbol_get_value_expression (arg->X_add_symbol),
- BFD_RELOC_Z80_DISP8);
+ {
+ expressionS offset = *arg;
+ offset.X_op = O_symbol;
+ offset.X_add_number = 0;
+ emit_byte (&offset, BFD_RELOC_Z80_DISP8);
+ }
if (prefix)
{
q = frag_more (1);
switch (dst.X_op)
{
case O_md1:
- emit_ldxhl ((dst.X_add_number & R_IX) ? 0xDD : 0xFD, 0x70,
- &src, symbol_get_value_expression (dst.X_add_symbol));
+ {
+ expressionS dst_offset = dst;
+ dst_offset.X_op = O_symbol;
+ dst_offset.X_add_number = 0;
+ emit_ldxhl ((dst.X_add_number & R_IX) ? 0xDD : 0xFD, 0x70,
+ &src, &dst_offset);
+ }
break;
case O_register:
--- /dev/null
+#objdump: -d
+#name: index intructions with label as offset
+
+.*: .*
+
+Disassembly of section .text:
+
+00000000 <begin>:
+[ ]+0:[ ]+3e 20[ ]+ld a,0x20
+[ ]+2:[ ]+dd 7e 20[ ]+ld a,\(ix\+32\)
+[ ]+5:[ ]+3e 40[ ]+ld a,0x40
+[ ]+7:[ ]+dd 7e 40[ ]+ld a,\(ix\+64\)
+[ ]+a:[ ]+c9[ ]+ret
--- /dev/null
+begin:
+
+offsetAtStart: equ 32
+
+ LD A, offsetAtStart
+ LD A, (IX + offsetAtStart)
+
+ LD A, offsetAtEnd
+ LD A, (IX + offsetAtEnd)
+
+ RET
+
+offsetAtEnd: equ 64
+ END
+
run_dump_test "suffix"
# test assembling and disassembling instructions involving offsets
run_dump_test "offset"
+# test assembling instruction with offset that is a label defined later
+ run_dump_test "atend"
# test for data transfer instructions
run_dump_test "ld-group"
# test for block instructions