Beispiel #1
0
        public void Link_AssignLabelAddress()
        {
            ExecutableModule notUsed = Linker.Link(m_relModules);

            CheckAssignedLabelAddress(
                TestUtils.MakeArray(
                    LabelDefinitionTest.Make("SUB", 0x0000, SUB_Address),
                    LabelDefinitionTest.Make("ADDEND", 0x0000, ADDEND_Address),
                    LabelDefinitionTest.Make("ADD1234", 0x0001, ADD1234_Address)),
                m_subRelModule, "SUB プログラムのラベル");
            CheckAssignedLabelAddress(
                TestUtils.MakeArray(
                    LabelDefinitionTest.Make("MAIN", 0x0000, MAIN_Address),
                    LabelDefinitionTest.Make("LBL101", 0x0000, LBL101_Address),
                    LabelDefinitionTest.Make("LTRL0001", 0x0005, LTRL0001_Address)),
                m_mainRelModule, "MAIN プログラムのラベル。'=3456' のリテラルのラベルが生成される");
        }
Beispiel #2
0
        public void ResolveReferringAddress()
        {
            LabelAddressResolver labelAddrResolver = LabelAddressResolverTest.Make();
            const UInt16         LabelAddress      = 0x2468;
            LabelDefinition      labelDef          = LabelDefinitionTest.Make("LBL001", 0, LabelAddress);

            labelAddrResolver.LabelTable.RegisterForUnitTest(labelDef);

            const Int32    WordCount   = 4;
            WordCollection actualWords = WordCollectionTest.MakeWords(WordCount);
            MemoryOffset   wordOffset  = new MemoryOffset(1);
            LabelReference labelRef    = LabelReference.MakeForUnitTest(labelDef.Label, wordOffset);

            labelRef.ResolveReferringAddress(labelAddrResolver, actualWords);

            WordCollection expectedWords = WordCollectionTest.MakeWords(WordCount);

            expectedWords[wordOffset] = new Word(LabelAddress);
            TestUtils.CheckEnumerable(
                expectedWords, actualWords,
                "ラベルを参照する語の値がそのラベルのアドレスに置き換えられる");
        }