コード例 #1
0
 public void TestGetSubnetMask()
 {
     var ip          = Addressing.GetLocalIP();
     var mask        = Addressing.GetSubnetMask(ip);
     var amountHosts = Addressing.GetAmountOfHosts(mask);
     var maskNum     = Addressing.ScanNetwork(ip, mask);
 }
コード例 #2
0
 /// <summary>
 /// Operandを生成する際に呼び出します
 /// </summary>
 /// <param name="a"></param>
 /// <param name="addr"></param>
 /// <param name="c"></param>
 /// <param name="bytes"></param>
 public Operand(Addressing a, uint addr, int c, int bytes)
 {
     this.AddressingMode = a;
     this.Addr           = addr;
     this.Cycles         = c;
     this.ArrangeBytes   = bytes;
 }
コード例 #3
0
ファイル: Cpu32bit.cs プロジェクト: xiuzhifu/cpu
 protected override bool IsSupportAddressing(Addressing addressing)
 {
     return
         (addressing == Addressing.eax ||
          addressing == Addressing.ebx ||
          addressing == Addressing.ecx ||
          addressing == Addressing.edx ||
          addressing == Addressing.ebp ||
          addressing == Addressing.esp ||
          addressing == Addressing.esi ||
          addressing == Addressing.edi ||
          addressing == Addressing.ax ||
          addressing == Addressing.bx ||
          addressing == Addressing.cx ||
          addressing == Addressing.dx ||
          addressing == Addressing.ah ||
          addressing == Addressing.bh ||
          addressing == Addressing.ch ||
          addressing == Addressing.dh ||
          addressing == Addressing.al ||
          addressing == Addressing.bl ||
          addressing == Addressing.cl ||
          addressing == Addressing.dl ||
          addressing == Addressing.bp ||
          addressing == Addressing.sp ||
          addressing == Addressing.si ||
          addressing == Addressing.di ||
          addressing == Addressing.cs ||
          addressing == Addressing.ds ||
          addressing == Addressing.es ||
          addressing == Addressing.fs ||
          addressing == Addressing.ss ||
          addressing == Addressing.imm ||
          addressing == Addressing.mem);
 }
コード例 #4
0
 public static I ForMicroservice <I>(ServicePartitionKey partitionKey = null) where I : class, IService
 {
     Debug.Assert(
         typeof(I).Namespace.Contains(Constant.Manager),
         $"Invalid microservice call. Use only the {Constant.Manager} interface to access a microservice.");
     return(ForService <I>(defaultProxyFactory, Addressing.Microservice <I>(), partitionKey));
 }
コード例 #5
0
        private void _ADDR_REL_1()
        {
            m_address = m_PC;
            byte value = getNextMemByte();

            if (value >= b10000000)
            {
                m_address -= (byte)(b11111111 - value);
            }
            else
            {
                m_address += value;
                m_address++; // compensate byte with relative address
            }
            if ((m_PC & 0xFF00) == (m_address & 0xFF00))
            {
                m_State = CPUState.operation; // addressing finished -> execute operation
            }
            else
            {
                m_MaxCycles++; // add 1 cycle when page boundary is crossed
                m_oc.executeAddressing = _ADDR_REL_2;
            }
#if CPU_TRACE
            m_sbDebug.AppendFormat("${0:X4}", m_address);
#endif
            m_addr = Addressing.relative;
        }
コード例 #6
0
 public static Address Map(Addressing address)
 {
     return(new Address()
     {
         City = address.Address2,
     });
 }
コード例 #7
0
        private void _ADDR_ACC()
        {
#if CPU_TRACE
            m_sbDebug.Append("A");
#endif
            m_addr  = Addressing.accumulator;
            m_State = CPUState.operation; // addressing finished -> execute operation
        }
コード例 #8
0
        private void _ADDR_IMM()
        {
            m_OperandValue = getNextMemByte();
#if CPU_TRACE
            m_sbDebug.AppendFormat("#${0:X2}", m_OperandValue);
#endif
            m_addr  = Addressing.immidiate;
            m_State = CPUState.operation; // addressing finished -> execute operation
        }
コード例 #9
0
        private void _ADDR_IND_1()
        {
            m_address = getNextMemWord();
#if CPU_TRACE
            m_sbDebug.AppendFormat("(${0:X4})", m_address);
#endif
            m_addr = Addressing.indirect;
            m_oc.executeAddressing = _ADDR_IND_2;
        }
コード例 #10
0
 public static I ForComponent <I>(ServiceProxyFactory serviceProxyFactory, StatefulService caller, ServicePartitionKey partitionKey = null) where I : class, IService
 {
     if (serviceProxyFactory == null)
     {
         throw new ArgumentNullException(nameof(serviceProxyFactory), "Invalid component call. Must supply service proxy factory.");
     }
     Debug.Assert(caller != null, "Invalid component call. Must supply stateful service caller.");
     return(ForService <I>(serviceProxyFactory, Addressing.Component <I>(caller), partitionKey));
 }
コード例 #11
0
 public void RegisterUser(PizzaBoxContext PizzaBox, Customer customer, Addressing addressing)
 {
     using (var unitofWork = new PizzaBox.Storing.UnitofWork(PizzaBox))
     {
         unitofWork.Address.Add(addressing);
         unitofWork.Customer.Add(customer);
         PizzaBox.SaveChanges();
     }
 }
コード例 #12
0
 public OpCode(byte code, Instruction instruction, Addressing addressing, FetchByte fetchBytes, int cycles, CycleOption option)
 {
     this.Code           = code;
     this.Inst           = instruction;
     this.AddressingMode = addressing;
     this.FetchBytes     = fetchBytes;
     this.Cycles         = cycles;
     this.Option         = option;
 }
コード例 #13
0
        public void SendActivationMail(string userId, string displayName, string email, string activationCode, string websiteUrl)
        {
            var mail = new Mail(new MailSender(), new MailSettings(_configuration));

            mail.Send(Addressing.Create(email, displayName), "Activation", new
            {
                Name = displayName,
                Url  = $"{websiteUrl}/User/Activate#{userId}/{activationCode}"
            });
        }
コード例 #14
0
        private void _ADDR_ZPY_1()
        {
            m_address = getNextMemByte();
#if CPU_TRACE
            byte b = (byte)m_address;
            m_sbDebug.AppendFormat("${0:X2},Y", b);
#endif
            m_addr = Addressing.zeropageY;
            m_oc.executeAddressing = _ADDR_ZPY_2;
        }
コード例 #15
0
        private void _ADDR_ZP()
        {
            m_address = getNextMemByte();
#if CPU_TRACE
            byte b = (byte)m_address;
            m_sbDebug.AppendFormat("${0:X2}", b);
#endif
            m_addr  = Addressing.zeropage;
            m_State = CPUState.operation; // addressing finished -> execute operation
        }
コード例 #16
0
        private void _ADDR_INDY_1()
        {
            m_address = getNextMemByte();
#if CPU_TRACE
            byte b = (byte)m_address;
            m_sbDebug.AppendFormat("(${0:X2}),Y", b);
#endif
            m_addr = Addressing.indirectY;
            m_oc.executeAddressing = _ADDR_INDY_2;
        }
コード例 #17
0
        private void _ADDR_ABS()
        {
            m_address = getNextMemWord();
#if CPU_TRACE
            m_sbDebug.AppendFormat("${0:X4}", m_address);
#endif

            m_addr  = Addressing.absolute;
            m_State = CPUState.operation; // addressing finished -> execute operation
        }
コード例 #18
0
        public void SendForgotPasswordEmail(string userId, string displayName, string email, string confirmationCode, string websiteUrl)
        {
            var mail = new Mail(new MailSender(), new MailSettings(_configuration));

            mail.Send(Addressing.Create(email, displayName), "ResetPassword", new
            {
                Name = displayName,
                Url  = $"{websiteUrl}/User/ResetPassword#{userId}/{confirmationCode}"
            });
        }
コード例 #19
0
    public Int16 ReadWord(Addressing addressing)
    {
        int addr = -GetRegisterAddr(addressing);

        if (addr >= MemSize)
        {
            return(0);
        }
        return((Int16)((Mem[addr + 1] << 8) | Mem[addr]));
    }
コード例 #20
0
    public Int32 ReadInt(Addressing addressing)
    {
        int addr = -GetRegisterAddr(addressing);

        if (addr >= MemSize)
        {
            return(0);
        }
        return((Int32)((Mem[addr + 3] << 24) | (Mem[addr + 2] << 16) | (Mem[addr + 1] << 8) | Mem[addr]));
    }
コード例 #21
0
    public void WriteByte(Addressing addressing, byte b)
    {
        int addr = -GetRegisterAddr(addressing);

        if (addr >= MemSize)
        {
            return;
        }
        Mem[addr] = b;
    }
コード例 #22
0
    public byte ReadByte(Addressing addressing)
    {
        int addr = -GetRegisterAddr(addressing);

        if (addr >= MemSize)
        {
            return(0);
        }
        return(Mem[addr]);
    }
コード例 #23
0
 public void TestGetLocalIP()
 {
     try
     {
         var ip = Addressing.GetLocalIP();
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
コード例 #24
0
ファイル: OpCode.cs プロジェクト: xiuzhifu/cpu
 public int GetRegisterWidth(Addressing addressing)
 {
     for (int i = 0; i < CAddressing.Length; i++)
     {
         if (CAddressing[i].addressing == addressing)
         {
             return(CAddressing[i].width);
         }
     }
     return(0);
 }
コード例 #25
0
    public void WriteWord(Addressing addressing, Int16 w)
    {
        int addr = -GetRegisterAddr(addressing);

        if (addr >= MemSize)
        {
            return;
        }
        Mem[addr]     = (byte)w;
        Mem[addr + 1] = (byte)(w >> 8);
    }
コード例 #26
0
 public int GetRegisterAddr(Addressing addressing)
 {
     for (int i = 0; i < CAddressingAddr.Length; i++)
     {
         if (CAddressingAddr[i].addressing == addressing)
         {
             return(-CAddressingAddr[i].addr);
         }
     }
     return(-1);
 }
コード例 #27
0
ファイル: OpCode.cs プロジェクト: xiuzhifu/cpu
 public void Clear()
 {
     preinst    = Inst.none;
     inst       = Inst.none;
     Register   = null;
     SegReg     = Addressing.none;
     BaseReg    = Addressing.none;
     IndexReg   = Addressing.none;
     Imm        = 0;
     ParamCount = 0;
 }
コード例 #28
0
 public static I ForMicroservice <I>(ServiceProxyFactory serviceProxyFactory, ServicePartitionKey partitionKey = null) where I : class, IService
 {
     if (serviceProxyFactory == null)
     {
         throw new ArgumentNullException(nameof(serviceProxyFactory), "Invalid microservice call. Must supply service proxy factory.");
     }
     Debug.Assert(
         typeof(I).Namespace.Contains(Constant.Manager),
         $"Invalid microservice call. Use only the {Constant.Manager} interface to access a microservice.");
     return(ForService <I>(serviceProxyFactory, Addressing.Microservice <I>(), partitionKey));
 }
コード例 #29
0
ファイル: OpCode.cs プロジェクト: xiuzhifu/cpu
 public string AddressingToString(Addressing addressing)
 {
     for (int i = 0; i < CAddressing.Length; i++)
     {
         if (CAddressing[i].addressing == addressing)
         {
             return(CAddressing[i].name);
         }
     }
     return(null);
 }
コード例 #30
0
ファイル: OpCode.cs プロジェクト: xiuzhifu/cpu
 public bool IsSegRegister(Addressing addressing)
 {
     if (addressing == Addressing.cs || addressing == Addressing.ds ||
         addressing == Addressing.es || addressing == Addressing.fs || addressing == Addressing.ss)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }