Exemple #1
0
        public AssemblerModel()
        {
            _size   = 256; // Leave this at 256 (many of our attributes are 8 bit)
            _memory = new Bit12[_size];
            for (int i = 0; i < _size; i++)
            {
                _memory[i] = new Bit12(0);
            }
            _memoryStack     = new MyStack <Bit12>(_memory);
            _undoStack       = new CircularStack <UndoStorage>(1000);
            _instructionPtr  = 0;
            _workingRegister = new Bit12(0);
            _input           = new Bit12(0);
            _output          = new Bit12(0);
            _labels          = new Dictionary <string, byte>();

            resetMemory();
        }
Exemple #2
0
 public UndoStorage(Bit12[] memory
                    , MyStack <Bit12> memoryStack
                    , byte instructionPtr
                    , Bit12 workingRegister
                    , Bit12 input
                    , Bit12 output)
 {
     _memory      = new Bit12[memory.Length];
     _memoryStack = new MyStack <Bit12>(_memory);
     Array.Copy(memory, _memory, memory.Length);
     for (int i = 0; i < memoryStack.size(); i++)
     {
         _memoryStack.push(_memory[255 - i]);
     }
     _instructionPtr  = instructionPtr;
     _workingRegister = workingRegister;
     _output          = output;
 }