]> git.sur5r.net Git - cc65/commitdiff
Fixed a bug
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Jun 2004 14:36:54 +0000 (14:36 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 4 Jun 2004 14:36:54 +0000 (14:36 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3085 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/exprdesc.c

index cf0986bf87291be89e2b815204cec2c1010ca2bf..7c498eda8ece670b5b657ff62c76d77a2c3ba6c8 100644 (file)
@@ -81,33 +81,33 @@ const char* ED_GetLabelName (const ExprDesc* Expr, long Offs)
 
         case E_LOC_ABS:
             /* Absolute: numeric address or const */
-           xsprintf (Buf, sizeof (Buf), "$%04X", (int)(Offs & 0xFFFF));
+           xsprintf (Buf, sizeof (Buf), "$%04X", (int)(Offs & 0xFFFF));
             break;
 
         case E_LOC_GLOBAL:
         case E_LOC_STATIC:
             /* Global or static variable */
-           if (Offs) {
-               xsprintf (Buf, sizeof (Buf), "%s%+ld",
+           if (Offs) {
+               xsprintf (Buf, sizeof (Buf), "%s%+ld",
                           SymGetAsmName (Expr->Sym), Offs);
-           } else {
-               xsprintf (Buf, sizeof (Buf), "%s",
+           } else {
+               xsprintf (Buf, sizeof (Buf), "%s",
                           SymGetAsmName (Expr->Sym));
-           }
+           }
             break;
 
         case E_LOC_REGISTER:
             /* Register variable */
-           xsprintf (Buf, sizeof (Buf), "regbank+%u",
-                      (unsigned)(Offs & 0xFFFFU));
+           xsprintf (Buf, sizeof (Buf), "regbank+%u",
+                      (unsigned)((Offs + Expr->Name) & 0xFFFFU));
             break;
 
         case E_LOC_LITERAL:
             /* Literal in the literal pool */
-           if (Offs) {
-               xsprintf (Buf, sizeof (Buf), "%s%+ld",
+           if (Offs) {
+               xsprintf (Buf, sizeof (Buf), "%s%+ld",
                           LocalLabelName (Expr->Name), Offs);
-           } else {
+           } else {
                        xsprintf (Buf, sizeof (Buf), "%s",
                           LocalLabelName (Expr->Name));
            }