Esempio n. 1
0
        public Frame(Instruction instruction, int TState, IPort1 ip1, IPort2 ip2, PC pc, MAR mar, RAM ram,
                     List <string> ramContents, MDR mdr, IReg ireg, SEQ seq, string wbus_string,
                     AReg areg, ALU alu, Flag flagReg, TReg treg, BReg breg, CReg creg,
                     OReg3 oreg3, OReg4 oreg4, HexadecimalDisplay hexadecimalDisplay)
        {
            InstructionData = instruction;
            if (InstructionData.OpCode.Contains(','))
            {
                InstructionData.OpCode = InstructionData.OpCode.Replace(",", string.Empty);
            }

            this.TState = TState;

            this.AReg = areg.ToString_Frame_Use();
            this.BReg = breg.ToString_Frame_Use();
            this.CReg = creg.ToString_Frame_Use();
            this.TReg = treg.ToString_Frame_Use();
            this.IReg = ireg.ToString_Frame_Use();  // The real ToString() is in use with a substring in it.  This is needed for proper operation
            this.MAR  = mar.ToString_Frame_Use();
            this.MDR  = mdr.RegContent;

            this.PC   = pc.RegContent;
            this.ALU  = alu.ToString();
            this.WBus = wbus_string;

            this.OPort1             = oreg3.ToString_Frame_Use();
            this.OPort2             = oreg4.ToString_Frame_Use();
            this.HexadecimalDisplay = hexadecimalDisplay.RegContent;

            this.RAM = ramContents;

            this.SEQ     = seq.ToString();
            this.WBus    = wbus_string; // I didnt want to mess with the Singleton in the frame, so the value will just be passed as a string
            this.RAM_Reg = ram.ToString_Frame_Use();
            this.Flags   = flagReg.RegContent;

            if (instruction == null)
            {
                this.IReg = "???";
            }

            if (TState > 3)
            {
                Instruction = InstructionData.OpCode;
            }
            else
            {
                Instruction = "???";
            }
        }
Esempio n. 2
0
        }                                             // The reason this is here is that the RAM might change if a STA simular command is issued.

        public Frame(string instruction, int TState, AReg areg, BReg breg, IReg ireg, MReg mreg, OReg oreg, PC pc, ALU alu, List <string> ramContents, RAM ram, SEQ seq, string wbus_string, Flags flags, IDecoder decoder, string SetName = "SAP1EMU")
        {
            this.RAM = new List <string>();

            this.TState = TState;

            this.AReg      = areg.ToString_Frame_Use();
            this.BReg      = breg.ToString_Frame_Use();
            this.IRegShort = ireg.ToString();
            this.IReg      = ireg.ToString_Frame_Use(); // The real ToString() is in use with a substring in it.  This is needed for proper operation
            this.MReg      = mreg.ToString_Frame_Use();
            this.OReg      = oreg.ToString_Frame_Use();
            this.PC        = pc.ToString().Substring(4, 4);
            this.ALU       = alu.ToString();
            this.WBus      = wbus_string;

            this.Overflow_Flag  = flags.Overflow.ToString();
            this.Underflow_Flag = flags.Underflow.ToString();
            this.Zero_Flag      = flags.Zero.ToString();

            foreach (string s in ramContents)
            {
                RAM.Add(s);
            }

            this.SEQ     = seq.ToString();
            this.WBus    = wbus_string; // I didnt want to mess with the Singleton in the frame, so the value will just be passed as a string
            this.RAM_Reg = ram.ToString_Frame_Use();

            if (instruction.Length == 0)
            {
                this.IReg = "???";
            }

            if (TState > 3)
            {
                //Instruction = OpCodeLoader.DecodeInstruction(IReg.Substring(0, 4), SetName); // TODO this is really inifeciant.  Should prob make a service and inject it
                Instruction = decoder.Decode(IReg.Substring(0, 4), SetName);
            }
            else
            {
                Instruction = "???";
            }
        }