private bool AddToSymbolCollection(SymbolCollection newSymbols, SymbolHelper newSymbol, List<CodeBlock> newCodeBlocks)
{
if (newSymbol.Length >= 800) return false;
foreach (SymbolHelper sh in newSymbols)
{
if (sh.Flash_start_address == newSymbol.Flash_start_address)
{
// Console.WriteLine("Already in collection: " + sh.Flash_start_address.ToString("X8"));
return false;
}
// not allowed to overlap
/* else if (newSymbol.Flash_start_address > sh.Flash_start_address && newSymbol.Flash_start_address < (sh.Flash_start_address + sh.Length))
{
Console.WriteLine("Overlapping map: " + sh.Flash_start_address.ToString("X8") + " " + sh.X_axis_length.ToString() + " x " + sh.Y_axis_length.ToString());
Console.WriteLine("Overlapping new: " + newSymbol.Flash_start_address.ToString("X8") + " " + newSymbol.X_axis_length.ToString() + " x " + newSymbol.Y_axis_length.ToString());
return false;
}*/
}
newSymbols.Add(newSymbol);
newSymbol.CodeBlock = DetermineCodeBlockByByAddress(newSymbol.Flash_start_address, newCodeBlocks);
return true;
}