コード例 #1
0
ファイル: Assembler.cs プロジェクト: tt195361/Casl2Simulator
        private static IEnumerable <ProgramLine> SetLabelOffset(
            this IEnumerable <ProgramLine> lines, LabelTable lblTable)
        {
            MemoryOffset offset = MemoryOffset.Zero;

            foreach (ProgramLine line in lines)
            {
                line.SetLabelOffset(lblTable, offset);
                Int32 wordCount = line.GetCodeWordCount();
                offset = offset.Add(wordCount);
            }

            return(lines);
        }
コード例 #2
0
        private void CheckAdd(
            UInt16 value, Int32 addend, Boolean success, UInt16 expectedValue, String message)
        {
            MemoryOffset target = new MemoryOffset(value);

            try
            {
                MemoryOffset actual = target.Add(addend);
                Assert.IsTrue(success, message);

                MemoryOffset expected = new MemoryOffset(expectedValue);
                Check(expected, actual, message);
            }
            catch (Casl2SimulatorException)
            {
                Assert.IsFalse(success, message);
            }
        }