a first small step to cross the 64k barrier
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 7 Feb 2001 16:14:02 +0000 (16:14 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 7 Feb 2001 16:14:02 +0000 (16:14 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@606 4a8a32a2-be11-0410-ad9d-d568d2c75423

as/mcs51/lkihx.c
as/mcs51/lkmain.c
as/mcs51/lkrloc.c

index 2e52d94b8bc4ac5369ab51eb41ef59c1611f1683..6058fa49219898fe838671de64035d75a491ed0a 100644 (file)
@@ -108,7 +108,7 @@ VOID
 ihx(i)
 {
        register Addr_T chksum;
-
+       int byte, bytes, address=0;
        if (i) {
                if (hilo == 0) {
                        chksum = rtval[0];
@@ -120,14 +120,33 @@ ihx(i)
                                chksum++;
                }
                fprintf(ofp, ":%02X", chksum);
+               // how much bytes?
+               for (i=0, bytes=0; i<rtcnt; i++) {
+                 if (rtflg[i]) {
+                   bytes++;
+                 }
+               }
+               byte=0;
                for (i = 0; i < rtcnt ; i++) {
-                       if (rtflg[i]) {
-                               fprintf(ofp, "%02X", rtval[i]);
-                               chksum += rtval[i];
-                       }
-                       if (i == 1) {
-                               fprintf(ofp, "00");
-                       }
+                 if (rtflg[i]) {
+                   switch (byte) {
+                   case 0: 
+                     address=rtval[0]<<8; 
+                     break;
+                   case 1: 
+                     address+=rtval[1]; 
+                     if ((address+bytes)>0xffff) {
+                       fprintf (stderr, "64k boundary cross at %04x\n", address);
+                     }
+                     break;
+                   }
+                   fprintf(ofp, "%02X", rtval[i]);
+                   chksum += rtval[i];
+                   byte++;
+                 }
+                 if (i == 1) {
+                   fprintf(ofp, "00");
+                 }
                }
                fprintf(ofp, "%02X\n", (-chksum) & 0xff);
        } else {
@@ -166,4 +185,4 @@ ihxEntendedLinearAddress(Addr_T a)
     chksum = 2 + 4 + (a & 0xff) + ((a >> 8) & 0xff);    
     
     fprintf(ofp, ":02000004%04X%02X\n", a & 0xffff, (-chksum) & 0xff);
-}
\ No newline at end of file
+}
index 8abd00f4cd3807e9eb5546729889a7e583db20e2..44a8f13f0b83758f506d369bc84d791b97ec8c55 100644 (file)
@@ -420,7 +420,7 @@ link_main()
                sdp.s_area = NULL;
                sdp.s_areax = NULL;
                sdp.s_addr = 0;
-               lastExtendedAddress = -1;
+               // jwk lastExtendedAddress = -1;
                break;
 
        case 'M':
index f6ac50bfff39e80a0d1e8091a034137fc20740de..7a9dbcfb9dc05c6c2f3a4edaa8e150aa2377f6fa 100644 (file)
@@ -52,7 +52,7 @@
 /* Global which holds the upper 16 bits of the last 32 bit area adress
  * output. Useful only for iHex mode.
  */
-int    lastExtendedAddress;
+int    lastExtendedAddress=-1;
 
 /*)Function    VOID    reloc(c)
  *
@@ -536,10 +536,12 @@ relr()
                if (extendedAddress != lastExtendedAddress)
                {
                
-                   #if 0
-                   printf("output extended linear address record 0x%x\n",
-                           extendedAddress);
-                   #endif
+#if 1 // jwk
+                 if (lastExtendedAddress!=-1) {
+                   printf("output extended linear address record 0x%x 0x%x\n",
+                          extendedAddress, lastExtendedAddress);
+                 }
+#endif
                    
                    if (rflag)
                    {