Browse Source

+ support indirect jumps in the 6502 assembler writer

Nikolay Nikolov 1 month ago
parent
commit
14bee8464d
1 changed files with 13 additions and 2 deletions
  1. 13 2
      compiler/mos6502/agsdas6500.pas

+ 13 - 2
compiler/mos6502/agsdas6500.pas

@@ -496,8 +496,19 @@ unit agsdas6500;
             begin
               if o.ref^.refaddr=addr_no then
                 begin
-                  writer.AsmWrite('TODO:indirect jump ref');
-                  //WriteReference(o.ref^);
+                  writer.AsmWrite('[');
+                  if assigned(o.ref^.symbol) then
+                    begin
+                      writer.AsmWrite(ApplyAsmSymbolRestrictions(o.ref^.symbol.name));
+                      if o.ref^.offset>0 then
+                       writer.AsmWrite('+'+tostr(o.ref^.offset))
+                      else
+                       if o.ref^.offset<0 then
+                        writer.AsmWrite(tostr(o.ref^.offset));
+                    end
+                  else
+                    writer.AsmWrite(tostr(o.ref^.offset));
+                  writer.AsmWrite(']');
                 end
               else
                 begin