Example #1
0
        static void CarregarInstrucoes(string fileName)
        {
            using (var binaryReader = new BinaryReader(File.OpenRead(fileName)))
            {
                byte[] bytes   = ReadBytesInOrder(binaryReader, 4);
                int    address = TEXT_SECTION_START;

                while (bytes.Any())
                {
                    _memory.Write(address, bytes);
                    bytes    = ReadBytesInOrder(binaryReader, 4);
                    address += 4;
                }
            }
        }
Example #2
0
        private void Sw(Instruction_I instruction)
        {
            int register = _registers.Read(instruction.RS).AsInt();
            int address  = register + instruction.Immediate;

            var word = _registers.Read(instruction.RT).Reverse().ToArray();

            _memory.Write(address, word);
        }