]> git.sur5r.net Git - cc65/commitdiff
Fix for multiple overlay segments.
authorLaubzega <mileksmyk@gmail.com>
Sun, 26 Aug 2018 03:21:12 +0000 (20:21 -0700)
committerLaubzega <mileksmyk@gmail.com>
Sun, 26 Aug 2018 03:21:12 +0000 (20:21 -0700)
src/ld65/bin.c

index 927719016a549d676b555c0d410a7f547bf5354e..f4d241adde45d8fa027c038e5a69d670c457e916 100644 (file)
@@ -193,8 +193,8 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M)
                     NewAddr += M->Start;
                 }
                 if (DoWrite || (M->Flags & MF_FILL) != 0) {
-                    /* Seek back for "overlay" segments */
-                    if (NewAddr < Addr) {
+                    /* Seek in "overlay" segments */
+                    if (S->Flags & SF_OVERLAY) {
                         fseek(D->F, NewAddr - M->Start, SEEK_SET);
                     } else {
                         WriteMult (D->F, M->FillVal, NewAddr-Addr);