Forráskód Böngészése

* write absolute references correctly on avr, resolves #32040

git-svn-id: trunk@37419 -
florian 7 éve
szülő
commit
3d3298f64d
3 módosított fájl, 44 hozzáadás és 1 törlés
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/avr/agavrgas.pas
  3. 40 0
      tests/webtbs/tw32040.pp

+ 1 - 0
.gitattributes

@@ -15786,6 +15786,7 @@ tests/webtbs/tw3185.pp svneol=native#text/plain
 tests/webtbs/tw3190.pp svneol=native#text/plain
 tests/webtbs/tw31945.pp svneol=native#text/pascal
 tests/webtbs/tw3197.pp svneol=native#text/plain
+tests/webtbs/tw32040.pp svneol=native#text/pascal
 tests/webtbs/tw32043.pp svneol=native#text/pascal
 tests/webtbs/tw3207.pp svneol=native#text/plain
 tests/webtbs/tw3210.pp svneol=native#text/plain

+ 3 - 1
compiler/avr/agavrgas.pas

@@ -119,7 +119,9 @@ unit agavrgas;
                   if assigned(symbol) then
                     s:=ReplaceForbiddenAsmSymbolChars(symbol.name);
 
-                  if offset<0 then
+                  if s='' then
+                    s:=tostr(offset)
+                  else if offset<0 then
                     s:=s+tostr(offset)
                   else if offset>0 then
                     s:=s+'+'+tostr(offset);

+ 40 - 0
tests/webtbs/tw32040.pp

@@ -0,0 +1,40 @@
+{ %cpu=avr }
+{ %norun }
+const
+  c0 = 0;
+  c1 = 1;
+  c2 = $02;
+  c10 = $10;
+  c22 = $22;
+  c100 = $100;
+  c1000 = $1000;
+  c3070 = $3070;
+
+procedure something; assembler; nostackframe;
+asm
+  ldi ZL, lo8(c0);
+  ldi ZH, hi8(c0);
+  ldi ZL, lo8(c1);
+  ldi ZH, hi8(c1);
+  ldi ZL, lo8(c2);
+  ldi ZH, hi8(c2);
+  ldi ZL, lo8(c10);
+  ldi ZH, hi8(c10);
+  ldi ZL, lo8(c22);
+  ldi ZH, hi8(c22);
+  ldi ZL, lo8(c100);
+  ldi ZH, hi8(c100);
+  ldi ZL, lo8(c1000);
+  ldi ZH, hi8(c1000);
+  ldi ZL, lo8(c3070);
+  ldi ZH, hi8(c3070);
+
+  ldi ZL, lo8(0x3070);
+  ldi ZH, hi8(0x3070);
+  ldi ZL, lo8(0x300);
+  ldi ZH, hi8(0x300);
+end;
+
+
+begin
+end.