lib/mapfiles/map-file.js
/**
     * Tries to reconstruct segments information from contiguous named addresses
     */
Tries to reconstruct segments information from contiguous named addresses
Tries to reconstruct segments information from contiguous named addresses
reconstructSegmentsFromNamedAddresses() {
        let currentUnit = false;
        let addressStart = 0;
        for (let idxSymbol = 0; idxSymbol < this.namedAddresses.length; ++idxSymbol) {
            const symbolObject = this.namedAddresses[idxSymbol];
            if (symbolObject.addressInt < this.preferredLoadAddress) continue;
            if (!currentUnit) {
                addressStart = symbolObject.addressInt;
                currentUnit = symbolObject.unitName;
            } else if (symbolObject.unitName !== currentUnit) {
                const segmentLen = symbolObject.addressInt - addressStart;
                this.reconstructedSegments.push({
                    addressInt: addressStart,
                    address: addressStart.toString(16),
                    endAddress: (addressStart + segmentLen).toString(16),
                    segmentLength: segmentLen,
                    unitName: currentUnit,
                });
                addressStart = symbolObject.addressInt;
                currentUnit = symbolObject.unitName;
            }
            if (idxSymbol === this.namedAddresses.length - 1) {
                this.reconstructedSegments.push({
                    addressInt: addressStart,
                    address: addressStart.toString(16),
                    segmentLength: -1,
                    unitName: symbolObject.unitName,
                });
            }
        }
    }
reconstructSegmentsFromNamedAddresses ( ) { let currentUnit = false ; let addressStart = 0 ; for ( let idxSymbol = 0 ; idxSymbol < this . namedAddresses . length ; ++ idxSymbol ) { const symbolObject = this . namedAddresses [ idxSymbol ] ; if ( symbolObject . addressInt < this . preferredLoadAddress ) continue ; if ( ! currentUnit ) { addressStart = symbolObject . addressInt ; currentUnit = symbolObject . unitName ; } else if ( symbolObject . unitName !== currentUnit ) { const segmentLen = symbolObject . addressInt - addressStart ; this . reconstructedSegments . push ( { addressInt : addressStart , address : addressStart . toString ( 16 ) , endAddress : ( addressStart + segmentLen ) . toString ( 16 ) , segmentLength : segmentLen , unitName : currentUnit , } ) ; addressStart = symbolObject . addressInt ; currentUnit = symbolObject . unitName ; } if ( idxSymbol === this . namedAddresses . length - 1 ) { this . reconstructedSegments . push ( { addressInt : addressStart , address : addressStart . toString ( 16 ) , segmentLength : - 1 , unitName : symbolObject . unitName , } ) ; } } }
Tries to reconstruct segments information from contiguous named addresses
Tries to reconstruct segments information from contiguous named addresses