示例#1
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            baseAddress = 0x0a7c;
            i           = new AnonymousInstruction(this);
            instructionSet.AddInstruction(baseAddress, i);
        }
示例#2
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress = 0x4e40;
            IInstruction i           = new AnonymousInstruction(this);

            for (int v = 0; v < 16; v++)
            {
                instructionSet.AddInstruction(baseAddress + v, i);
            }
        }
示例#3
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress = 0x4840;
            IInstruction i           = new AnonymousInstruction(this);

            for (int reg = 0; reg < 8; reg++)
            {
                instructionSet.AddInstruction(baseAddress + reg, i);
            }
        }
示例#4
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x5000;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0x5040;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0x5080;
                    i           = new AnonymousInstruction2(this);
                }

                for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                {
                    if (sz == 0 && ea_mode == 1)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && ea_reg > 1)
                        {
                            break;
                        }
                        for (int imm = 0; imm < 8; imm++)
                        {
                            instructionSet.AddInstruction(baseAddress + (imm << 9) + (ea_mode << 3) + ea_reg, i);
                        }
                    }
                }
            }
        }
示例#5
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x0a00;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0x0a40;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0x0a80;
                    i           = new AnonymousInstruction2(this);
                }

                for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                {
                    if (ea_mode == 1)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && (ea_reg == 2 || ea_reg == 3 || ea_reg == 4))
                        {
                            continue;
                        }
                        instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }
        }
示例#6
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress = 0x50c8;
            IInstruction i           = new AnonymousInstruction(this);

            for (int cc = 0; cc < 16; cc++)
            {
                for (int r = 0; r < 8; r++)
                {
                    instructionSet.AddInstruction(baseAddress + (cc << 8) + r, i);
                }
            }
        }
示例#7
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xb000;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xb040;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0xb080;
                    i           = new AnonymousInstruction2(this);
                }

                for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                {
                    if (ea_mode == 1 && sz == 0)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && ea_reg > 4)
                        {
                            break;
                        }
                        for (int r = 0; r < 8; r++)
                        {
                            instructionSet.AddInstruction(baseAddress + (r << 9) + (ea_mode << 3) + ea_reg, i);
                        }
                    }
                }
            }
        }
示例#8
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress = 0x6000;
            IInstruction ib          = new AnonymousInstruction(this);
            IInstruction iw          = new AnonymousInstruction1(this);

            for (int cc = 0; cc < 16; cc++)
            {
                instructionSet.AddInstruction(baseAddress + (cc << 8), iw);
                for (int dis = 1; dis < 256; dis++)
                {
                    instructionSet.AddInstruction(baseAddress + (cc << 8) + dis, ib);
                }
            }
        }
示例#9
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress = 0x4ec0;
            IInstruction i           = new AnonymousInstruction(this);

            for (int ea_mode = 2; ea_mode < 8; ea_mode++)
            {
                if (ea_mode == 3 || ea_mode == 4)
                {
                    continue;
                }
                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 3)
                    {
                        break;
                    }
                    instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                }
            }
        }
示例#10
0
        public static IInstruction Read(this IInstructionSet set, IReadOnlyMemoryBlock memory, long address, out int size)
        {
            byte[] data = new byte[set.MaxInstructionSize];

            size = set.MinInstructionSize;
            int i = 0;

            while (true)
            {
                memory.Read(address + i, data, i, size - i);
                i = size;

                (IInstruction instruction, int additional) = set.Read(data, 0, size);
                if (instruction != null)
                {
                    return(instruction);
                }

                size += additional;
            }
        }
示例#11
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x0000;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0x0040;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0x0080;
                    i           = new AnonymousInstruction2(this);
                }

                for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                {
                    if (ea_mode == 1)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && (ea_reg == 2 || ea_reg == 3 || ea_reg == 4))
                        {
                            continue;
                        }
                        instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }
        }
示例#12
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 2; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xd0c0;
                    i           = new AnonymousInstruction(this);
                }
                else
                {
                    baseAddress = 0xd1c0;
                    i           = new AnonymousInstruction1(this);
                }

                for (int reg = 0; reg < 8; reg++)
                {
                    for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                    {
                        for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                        {
                            if (ea_mode == 7 && ea_reg > 4)
                            {
                                break;
                            }
                            instructionSet.AddInstruction(baseAddress + (reg << 9) + (ea_mode << 3) + ea_reg, i);
                        }
                    }
                }
            }
        }
        public void ChangeInstructionSet(string selected)
        {
            switch (_activeDocumentType)
            {
            case AsmType.RadAsm: _radAsm1SelectedSet = GetInstructionSetByName(selected, _radAsm1InstructionSets); break;

            case AsmType.RadAsm2: _radAsm2SelectedSet = GetInstructionSetByName(selected, _radAsm2InstructionSets); break;

            default: return;
            }

            var optionProvider = GeneralOptionProvider.Instance;
            var optionModel    = GeneralOptionModel.Instance;

            switch (_activeDocumentType)
            {
            case AsmType.RadAsm: optionProvider.Asm1SelectedSet = _radAsm1SelectedSet == null ? string.Empty : _radAsm1SelectedSet.ToString(); break;

            case AsmType.RadAsm2: optionProvider.Asm2SelectedSet = _radAsm2SelectedSet == null ? string.Empty : _radAsm2SelectedSet.ToString(); break;
            }

            optionModel.Save();
            InstructionsUpdatedInvoke(_activeDocumentType);
        }
示例#14
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress = 0x50c0;
            IInstruction i           = new AnonymousInstruction(this);

            for (int ea_mode = 0; ea_mode < 8; ea_mode++)
            {
                if (ea_mode == 1)
                {
                    continue;
                }
                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 1)
                    {
                        break;
                    }
                    for (int cc = 0; cc < 16; cc++)
                    {
                        instructionSet.AddInstruction(baseAddress + (cc << 8) + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }
        }
示例#15
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress = 0x81c0;
            IInstruction i           = new AnonymousInstruction(this);

            for (int ea_mode = 0; ea_mode < 8; ea_mode++)
            {
                if (ea_mode == 1)
                {
                    continue;
                }
                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 4)
                    {
                        break;
                    }
                    for (int r = 0; r < 8; r++)
                    {
                        instructionSet.AddInstruction(baseAddress + (r << 9) + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }
        }
示例#16
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 2; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x4880;
                    i           = new AnonymousInstruction(this);
                }
                else
                {
                    baseAddress = 0x48c0;
                    i           = new AnonymousInstruction1(this);
                }

                for (int reg = 0; reg < 8; reg++)
                {
                    instructionSet.AddInstruction(baseAddress + reg, i);
                }
            }
        }
示例#17
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xe108;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xe148;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0xe188;
                    i           = new AnonymousInstruction2(this);
                }

                for (int imm = 0; imm < 8; imm++)
                {
                    for (int reg = 0; reg < 8; reg++)
                    {
                        instructionSet.AddInstruction(baseAddress + (imm << 9) + reg, i);
                    }
                }
            }

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xe128;
                    i           = new AnonymousInstruction3(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xe168;
                    i           = new AnonymousInstruction4(this);
                }
                else
                {
                    baseAddress = 0xe1a8;
                    i           = new AnonymousInstruction5(this);
                }

                for (int imm = 0; imm < 8; imm++)
                {
                    for (int reg = 0; reg < 8; reg++)
                    {
                        instructionSet.AddInstruction(baseAddress + (imm << 9) + reg, i);
                    }
                }
            }

            baseAddress = 0xe3c0;
            i           = new AnonymousInstruction6(this);
            for (int ea_mode = 2; ea_mode < 8; ea_mode++)
            {
                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 1)
                    {
                        break;
                    }
                    instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                }
            }
        }
示例#18
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xe100;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xe140;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0xe180;
                    i           = new AnonymousInstruction2(this);
                }

                for (int imm = 0; imm < 8; imm++)
                {
                    for (int reg = 0; reg < 8; reg++)
                    {
                        instructionSet.AddInstruction(baseAddress + (imm << 9) + reg, i);
                    }
                }
            }

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xe120;
                    i           = new AnonymousInstruction3(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xe160;
                    i           = new AnonymousInstruction4(this);
                }
                else
                {
                    baseAddress = 0xe1a0;
                    i           = new AnonymousInstruction5(this);
                }

                for (int imm = 0; imm < 8; imm++)
                {
                    for (int reg = 0; reg < 8; reg++)
                    {
                        instructionSet.AddInstruction(baseAddress + (imm << 9) + reg, i);
                    }
                }
            }

            baseAddress = 0xe1c0;
            i           = new AnonymousInstruction6(this);
            for (int ea_mode = 2; ea_mode < 8; ea_mode++)
            {
                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 1)
                    {
                        break;
                    }
                    instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                }
            }
        }
示例#19
0
 public void Register(IInstructionSet instructionSet)
 {
     instructionSet.AddInstruction(0x4afc, new AnonymousInstruction(this));
 }
示例#20
0
 public CentralProcessingUnit(IMemory memory, IRegisterBank registerBank, IInstructionSet instructionSet)
 {
     Memory         = memory;
     RegisterBank   = registerBank;
     InstructionSet = instructionSet;
 }
示例#21
0
 public SimpleAssembler(IInstructionSet instructions)
 {
     this.instructions = instructions.GetAll().ToDictionary(i => i.Name.Trim());
     this.parser       = new Parser(this.instructions.Keys.ToArray());
 }
示例#22
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xd100;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xd140;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0xd180;
                    i           = new AnonymousInstruction2(this);
                }

                for (int regx = 0; regx < 8; regx++)
                {
                    for (int regy = 0; regy < 8; regy++)
                    {
                        instructionSet.AddInstruction(baseAddress + (regx << 9) + regy, i);
                    }
                }
            }

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0xd108;
                    i           = new AnonymousInstruction3(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0xd148;
                    i           = new AnonymousInstruction4(this);
                }
                else
                {
                    baseAddress = 0xd188;
                    i           = new AnonymousInstruction5(this);
                }

                for (int regx = 0; regx < 8; regx++)
                {
                    for (int regy = 0; regy < 8; regy++)
                    {
                        instructionSet.AddInstruction(baseAddress + (regx << 9) + regy, i);
                    }
                }
            }
        }
 // - IDSPExSession Implementation -----------------------------------------------------------
 /// <summary>
 /// Adds a DSPEx Instruction set for handling remotely-initiated transactions.
 /// </summary>
 /// <param name="instructionSet"></param>
 public void AddInstructionSet(IInstructionSet instructionSet)
 {
     m_instructionSets.Add(instructionSet);
 }
示例#24
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x9000;
                    i           = new AnonymousInstruction(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0x9040;
                    i           = new AnonymousInstruction1(this);
                }
                else
                {
                    baseAddress = 0x9080;
                    i           = new AnonymousInstruction2(this);
                }

                for (int reg = 0; reg < 8; reg++)
                {
                    for (int ea_mode = 0; ea_mode < 8; ea_mode++)
                    {
                        for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                        {
                            if (ea_mode == 7 && ea_reg > 4)
                            {
                                break;
                            }
                            instructionSet.AddInstruction(baseAddress + (reg << 9) + (ea_mode << 3) + ea_reg, i);
                        }
                    }
                }
            }

            for (int sz = 0; sz < 3; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x9100;
                    i           = new AnonymousInstruction3(this);
                }
                else if (sz == 1)
                {
                    baseAddress = 0x9140;
                    i           = new AnonymousInstruction4(this);
                }
                else
                {
                    baseAddress = 0x9180;
                    i           = new AnonymousInstruction5(this);
                }

                for (int reg = 0; reg < 8; reg++)
                {
                    for (int ea_mode = 2; ea_mode < 8; ea_mode++)
                    {
                        for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                        {
                            if (ea_mode == 7 && ea_reg > 1)
                            {
                                break;
                            }
                            instructionSet.AddInstruction(baseAddress + (reg << 9) + (ea_mode << 3) + ea_reg, i);
                        }
                    }
                }
            }
        }
示例#25
0
        public void Register(IInstructionSet instructionSet)
        {
            int          baseAddress;
            IInstruction i;

            for (int sz = 0; sz < 2; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x4880;
                    i           = new AnonymousInstruction(this);
                }
                else
                {
                    baseAddress = 0x48c0;
                    i           = new AnonymousInstruction1(this);
                }

                for (int ea_mode = 2; ea_mode < 8; ea_mode++)
                {
                    if (ea_mode == 3)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && ea_reg > 1)
                        {
                            break;
                        }
                        instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }

            for (int sz = 0; sz < 2; sz++)
            {
                if (sz == 0)
                {
                    baseAddress = 0x4c80;
                    i           = new AnonymousInstruction2(this);
                }
                else
                {
                    baseAddress = 0x4cc0;
                    i           = new AnonymousInstruction3(this);
                }

                for (int ea_mode = 2; ea_mode < 8; ea_mode++)
                {
                    if (ea_mode == 4)
                    {
                        continue;
                    }
                    for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                    {
                        if (ea_mode == 7 && ea_reg > 3)
                        {
                            break;
                        }
                        instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }
        }
示例#26
0
        public void Register(IInstructionSet instructionSet)
        {
            if (instructionSet is null)
            {
                throw new System.ArgumentNullException(nameof(instructionSet));
            }

            int          baseAddress = 0x0140;
            IInstruction i;

            for (int ea_mode = 0; ea_mode < 8; ea_mode++)
            {
                if (ea_mode == 1)
                {
                    continue;
                }
                if (ea_mode == 0)
                {
                    i = new AnonymousInstruction(this);
                }
                else
                {
                    i = new AnonymousInstruction1(this);
                }

                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 1)
                    {
                        break;
                    }
                    for (int r = 0; r < 8; r++)
                    {
                        instructionSet.AddInstruction(baseAddress + (r << 9) + (ea_mode << 3) + ea_reg, i);
                    }
                }
            }

            baseAddress = 0x0840;
            for (int ea_mode = 0; ea_mode < 8; ea_mode++)
            {
                if (ea_mode == 1)
                {
                    continue;
                }
                if (ea_mode == 0)
                {
                    i = new AnonymousInstruction2(this);
                }
                else
                {
                    i = new AnonymousInstruction3(this);
                }

                for (int ea_reg = 0; ea_reg < 8; ea_reg++)
                {
                    if (ea_mode == 7 && ea_reg > 1)
                    {
                        break;
                    }
                    instructionSet.AddInstruction(baseAddress + (ea_mode << 3) + ea_reg, i);
                }
            }
        }