コード例 #1
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
        private static WordCollection MakeLinkedWords(
            ItemSelectableCollection <RelocatableModule> relModules)
        {
            WordCollection linkedWords = new WordCollection();

            relModules.ForEach((relModule) => linkedWords.Add(relModule.Words));
            return(linkedWords);
        }
コード例 #2
0
ファイル: Assembler.cs プロジェクト: tt195361/Casl2Simulator
 /// <summary>
 /// 一連のプログラムをアセンブルし、一連の再配置可能モジュールを生成します。
 /// </summary>
 /// <param name="programs">アセンブルする一連のプログラムです。</param>
 /// <returns>生成した一連の再配置可能モジュールを返します。</returns>
 internal static ItemSelectableCollection <RelocatableModule> Assemble(
     this ItemSelectableCollection <Casl2Program> programs)
 {
     // 一連のプログラムをアセンブルし、その結果をチェックし、一連の再配置可能モジュールを生成する。
     return(programs.DoAssemble()
            .Check()
            .MakeItemSelectableCollection(programs.SelectedItemIndex));
 }
コード例 #3
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
        private static ExecutableModule MakeExecutableModule(
            this ItemSelectableCollection <RelocatableModule> relModules)
        {
            MemoryAddress  execStartAddress = GetExecStartAddress(relModules);
            WordCollection linkedWords      = MakeLinkedWords(relModules);

            return(new ExecutableModule(LoadAddress, execStartAddress, linkedWords));
        }
コード例 #4
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
        private static MemoryAddress GetExecStartAddress(
            ItemSelectableCollection <RelocatableModule> relModules)
        {
            RelocatableModule selectedRelModule  = relModules.SelectedItem;
            EntryPoint        selectedEntryPoint = selectedRelModule.EntryPoint;

            return(selectedEntryPoint.ExecStartAddress);
        }
コード例 #5
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
        /// <summary>
        /// 指定の再配置可能モジュールを結合し実行可能モジュールを生成します。
        /// </summary>
        /// <param name="relModules">結合する再配置可能モジュールです。</param>
        /// <returns>生成した実行可能モジュールを返します。</returns>
        internal static ExecutableModule Link(this ItemSelectableCollection <RelocatableModule> relModules)
        {
            EntryPointTable entryPointTable = new EntryPointTable();

            m_entryPointTableForUnitTest = entryPointTable;
            return(relModules.AssignLabelAddress()
                   .RegisterEntryPoints(entryPointTable)
                   .ResolveLabelReferences(entryPointTable)
                   .MakeExecutableModule());
        }
コード例 #6
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
        private static ItemSelectableCollection <RelocatableModule> AssignLabelAddress(
            this ItemSelectableCollection <RelocatableModule> relModules)
        {
            MemoryAddress baseAddress = LoadAddress;

            foreach (RelocatableModule relModule in relModules)
            {
                relModule.AssignLabelAddress(baseAddress);

                MemorySize wordsSize = relModule.GetWordsSize();
                baseAddress = baseAddress.Add(wordsSize);
            }

            return(relModules);
        }
コード例 #7
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
 private static ItemSelectableCollection <RelocatableModule> ResolveLabelReferences(
     this ItemSelectableCollection <RelocatableModule> relModules, EntryPointTable entryPointTable)
 {
     relModules.ForEach((relModule) => relModule.ResolveLabelReferences(entryPointTable));
     return(relModules);
 }
コード例 #8
0
ファイル: Linker.cs プロジェクト: tt195361/Casl2Simulator
 private static ItemSelectableCollection <RelocatableModule> RegisterEntryPoints(
     this ItemSelectableCollection <RelocatableModule> relModules, EntryPointTable entryPointTable)
 {
     relModules.ForEach((relModule) => relModule.RegisterEntryPointTo(entryPointTable));
     return(relModules);
 }
コード例 #9
0
 private Casl2Project(params Casl2Program[] programs)
 {
     m_name     = InitialProjectName;
     m_programs = new ItemSelectableCollection <Casl2Program>(programs);
 }