ihx(i)
{
register Addr_T chksum;
-
+ int byte, bytes, address=0;
if (i) {
if (hilo == 0) {
chksum = rtval[0];
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 {
chksum = 2 + 4 + (a & 0xff) + ((a >> 8) & 0xff);
fprintf(ofp, ":02000004%04X%02X\n", a & 0xffff, (-chksum) & 0xff);
-}
\ No newline at end of file
+}
/* 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)
*
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)
{