]> git.sur5r.net Git - cc65/commitdiff
Fixed addresses crossing 0x10000
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 18 Aug 2003 20:14:31 +0000 (20:14 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 18 Aug 2003 20:14:31 +0000 (20:14 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2365 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/da65/attrtab.c
src/da65/data.c
src/da65/handler.c

index baa78bbb3732b5e4a3f52e389ef9a773d12303eb..247e645c1581c02e2d6a9844d9969709c186b797 100644 (file)
@@ -69,7 +69,7 @@ static const char* SymTab [0x10000];
 
 
 
-void AddrCheck (unsigned Addr)
+static void AddrCheck (unsigned Addr)
 /* Check if the given address has a valid range */
 {
     if (Addr >= 0x10000) {
@@ -112,7 +112,7 @@ void MarkAddr (unsigned Addr, attr_t Attr)
 const char* MakeLabelName (unsigned Addr)
 /* Make the default label name from the given address and return it in a
  * static buffer.
- */
+ */    
 {
     static char LabelBuf [32];
     xsprintf (LabelBuf, sizeof (LabelBuf), "L%04X", Addr);
index 81c628ae8385512082b49922cd77c25598c351b5..d55dda050983f411b5fc37eb6cb15c57ae1549dc 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000      Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 52                                             */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -226,7 +226,7 @@ unsigned RtsTable (void)
     while (BytesLeft > 0) {
 
        /* Get the address */
-       unsigned Addr = GetCodeWord (PC) + 1;
+       unsigned Addr = (GetCodeWord (PC) + 1) & 0xFFFF;
 
        /* In pass 1, define a label, in pass 2 output the line */
        if (Pass == 1) {
@@ -315,7 +315,7 @@ unsigned TextTable (void)
        Count = 0;
        while (Count < BytesLeft && Count < BytesPerLine) {
            unsigned char C = GetCodeByte (PC + Count);
-                   if (C < 0x20 || C > 0x7E || C == '\"') {  
+                   if (C < 0x20 || C > 0x7E || C == '\"') {
                ++Count;
            } else {
                break;
index b22ffbfaf37a8ac09c0f5bca38d1e7feddba8b3a..490619f8d1245aa281610bfa0efaef8f51d5f88d 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000      Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/*               Römerstrasse 52                                             */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -265,7 +265,7 @@ void OH_Relative (const OpcDesc* D)
     signed char Offs = GetCodeByte (PC+1);
 
     /* Calculate the target address */
-    unsigned Addr = (unsigned) (((int) PC+2) + Offs);
+    unsigned Addr = (((int) PC+2) + Offs) & 0xFFFF;
 
     /* Generate a label in pass 1 */
     GenerateLabel (D->Flags, Addr);
@@ -346,7 +346,7 @@ void OH_BitBranch (const OpcDesc* D)
     signed char   BranchOffs = GetCodeByte (PC+2);
 
     /* Calculate the target address for the branch */
-    unsigned BranchAddr = (unsigned) (((int) PC+3) + BranchOffs);
+    unsigned BranchAddr = (((int) PC+3) + BranchOffs) & 0xFFFF;
 
     /* Generate labels in pass 1. The bit branch codes are special in that
      * they don't really match the remainder of the 6502 instruction set (they