Exemple #1
0
        private Configuration SetupFibonacci()
        {
            var compileInstructionSet = new Dictionary <string, string>()
            {
                { "set", "0001" },   // Set
                { "sto", "0010" },   // Store
                { "add", "0011" },   // Add
                { "ada", "0100" },   // Add from address
                { "out", "0101" },   // Output
                { "jmp", "0110" },   // Jump
                { "lda", "0111" },   // Load
                { "hlt", "1111" }    // Halt
            };

            AssemblyCompiler.CompileAssembly(compileInstructionSet, "fibonacci.txt", "bytecode.txt");
            var configuration = new ConfigurationFibonacci(
                new ReadonlyMemory("bytecode.txt"),
                new RandomAccessMemory(),
                new SegmentDisplay(graphics),
                new Accumulator()
                );
            var instructionSet = new InstructionSetFibonacci(configuration);

            configuration.AttachInstructionSet(instructionSet);
            return(configuration);
        }
 public InstructionSetFibonacci(ConfigurationFibonacci configuration) : base(configuration)
 {
 }