Ejemplo n.º 1
0
        private void SaveRegisterValuesIntoMemory(OpCodeData opCodeData)
        {
            Byte   numberOfRegisters        = _registers.NumberOfRegisters();
            UInt16 instructionRegisterValue = _instructionRegister.GetRegisterValue();

            for (Byte index = 0; index < numberOfRegisters; index++)
            {
                _memory.SetValueAtLocation((UInt16)(instructionRegisterValue + index), _registers.GetRegisterValue(index));
            }
        }
Ejemplo n.º 2
0
        private void LoadFont()
        {
            Byte memoryAddress = 0x0;

            // 0
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 1
            _memory.SetValueAtLocation(memoryAddress++, 0x20);
            _memory.SetValueAtLocation(memoryAddress++, 0x60);
            _memory.SetValueAtLocation(memoryAddress++, 0x20);
            _memory.SetValueAtLocation(memoryAddress++, 0x20);
            _memory.SetValueAtLocation(memoryAddress++, 0x70);
            // 2
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 3
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 4
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            // 5
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 6
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 7
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0x20);
            _memory.SetValueAtLocation(memoryAddress++, 0x40);
            _memory.SetValueAtLocation(memoryAddress++, 0x40);
            // 8
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // 9
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x10);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // A
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            // B
            _memory.SetValueAtLocation(memoryAddress++, 0xE0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xE0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xE0);
            // C
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // D
            _memory.SetValueAtLocation(memoryAddress++, 0xE0);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0x90);
            _memory.SetValueAtLocation(memoryAddress++, 0xE0);
            // E
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            // F
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0xF0);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
            _memory.SetValueAtLocation(memoryAddress++, 0x80);
        }