Click here to Skip to main content
15,892,199 members
Articles / General Programming / Algorithms

A Simulator for Knuth's MIX Computer

Rate me:
Please Sign up or sign in to vote.
4.91/5 (26 votes)
2 Feb 2011CPOL7 min read 55.8K   668   34  
Assembler and Simulator for Don Knuth's MIX Computer from The Art of Computer Programming.
using System;
using System.Collections.Generic;

namespace MIXLib
{
    public class MIXInstruction
    {
        private Action<MIXWord, byte, byte> executionProc;
        public string Name { get; private set; }

        public MIXInstruction(string name, Action<MIXWord, byte, byte> executionProc)
        {
            this.Name = name;
            this.executionProc = executionProc;
        }

        public void Execute(MIXWord address, byte index, byte field)
        {
            executionProc(address, index, field);
        }

        public void Execute(MIXWord address, byte index, byte left, byte right)
        {
            executionProc(address, index, (byte)(left * 8 + right));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer
Greece Greece
I am a software developer (mainly in C# and T-SQL) for a project management company in Athens, Greece. I have been working with computers since early 1987. I am adept at Pascal, C, C++, Java (my MSc was sponsored by Sun Microsystems), Lisp, Scheme, F#, C# VB.Net, Perl and some others that are too obscure to mention. When I want a quick and dirty solution to a programming problem I use a functional language, such as Haskell, Scheme or, more recently, F#.

I also play the keyboards and compose music.

---------------------------------------------------------

MSc Distributed Systems and Networks - University of Kent at Canterbury
BEng Computer Systems Engineering - University of Kent at Canterbury

Comments and Discussions