Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteRenderer" /> class.
 /// </summary>
 /// <param name="layerType">
 /// Layer type (available at <see cref="DefaultLayers"/>).
 /// Example: new SpriteRenderer(DefaultLayers.Alpha)
 /// </param>
 /// <param name="samplerMode">
 /// Sampler mode <see cref="AddressMode"/>
 /// Example: new SpriteRenderer(DefaultLayers.Alpha)
 /// </param>
 public SpriteRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("SpriteRenderer" + instances++, layerType)
 {
     this.Transform2D = null;
     this.Sprite = null;
     this.samplerMode = samplerMode;            
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AnimatedSpriteRenderer" /> class.
 /// </summary>
 /// <param name="layer">Layer type.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public AnimatedSpriteRenderer(Type layer, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("AnimatedSpriteRenderer" + instances++, layer)
 {
     this.Transform2D = null;
     this.Sprite = null;            
     this.Animation2D = null;
     this.samplerMode = samplerMode;
 }
Example #3
0
 /// <summary>
 /// Enables the Dynamic Host Configuration Protocol (DHCP) for service with this network interface.
 /// </summary>
 public void EnableDhcp()
 {
     try
     {
         _startupAddressMode = AddressMode.DHCP;
         UpdateConfiguration((int)UpdateOperation.Dhcp);
     }
     finally
     {
         ReloadSettings();
     }
 }
Example #4
0
 /// <summary>
 /// Copies sampler state from other.
 /// </summary>
 /// <param name="other">The other sampler state.</param>
 public void Copy([NotNull] SamplerState other)
 {
     Changed();
     filter        = other.filter;
     mipmapFilter  = other.mipmapFilter;
     addressU      = other.addressU;
     addressV      = other.addressV;
     addressW      = other.addressW;
     mipLODBias    = other.mipLODBias;
     maxAnisotropy = other.maxAnisotropy;
     minMipmap     = other.minMipmap;
     maxMipmap     = other.maxMipmap;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SkeletalRenderer" /> class.
 /// </summary>
 /// <param name="layerType">Type of the layer.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public SkeletalRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("SkeletalRenderer" + instances++, layerType)
 {
     this.Transform2D = null;
     this.samplerMode = samplerMode;
     this.material    = new BasicMaterial2D()
     {
         LayerType = layerType, SamplerMode = this.samplerMode
     };
     this.position        = new Vector2();
     this.scale           = new Vector2(1);
     this.ActualDebugMode = DebugMode.Bones;
 }
Example #6
0
        private static AddressMode GetAddressMode(int offset)
        {
            AddressMode mode = addressingModes[Data.GetROMByte(offset)];

            if (mode == AddressMode.IMMEDIATE_M_FLAG_DEPENDENT)
            {
                return(Data.GetMFlag(offset) ? AddressMode.IMMEDIATE_8 : AddressMode.IMMEDIATE_16);
            }
            else if (mode == AddressMode.IMMEDIATE_X_FLAG_DEPENDENT)
            {
                return(Data.GetXFlag(offset) ? AddressMode.IMMEDIATE_8 : AddressMode.IMMEDIATE_16);
            }
            return(mode);
        }
Example #7
0
 public static STACKFRAME64 InitializeStackFrame64(AddressMode AddrMode, ulong OffsetPC, ulong OffsetFrame, ulong OffsetStack, ulong OffsetBStore)
 {
     STACKFRAME64 StackFrame = new STACKFRAME64();
     StackFrame.AddrPC.Mode = AddrMode;
     StackFrame.AddrPC.Offset = OffsetPC;
     StackFrame.AddrReturn.Mode = AddrMode;
     StackFrame.AddrFrame.Mode = AddrMode;
     StackFrame.AddrFrame.Offset = OffsetFrame;
     StackFrame.AddrStack.Mode = AddrMode;
     StackFrame.AddrStack.Offset = OffsetStack;
     StackFrame.AddrBStore.Offset = OffsetBStore;
     StackFrame.AddrBStore.Mode = AddrMode;
     return StackFrame;
 }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkInterface"/> class.
        /// </summary>
        /// <param name="interfaceIndex"></param>
        protected NetworkInterface(int interfaceIndex)
        {
            _interfaceIndex       = interfaceIndex;
            _networkInterfaceType = NetworkInterfaceType.Unknown;
            _startupAddressMode   = AddressMode.Invalid;
            _specificConfigId     = uint.MaxValue;
            _automaticDns         = true;

            _ipv6Address        = new uint[4];
            _ipv6NetMask        = new uint[4];
            _ipv6GatewayAddress = new uint[4];
            _ipv6dnsAddress1    = new uint[4];
            _ipv6dnsAddress2    = new uint[4];
        }
        /// <summary>
        /// Set the method by which the sonar obtains an IP address.
        /// </summary>
        /// <param name="mode">the method by which the sonar obtains an IP address. </param>
        public void SetAddressMode(AddressMode mode)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("BVTNetworkSettings");
            }
            int error_code = NativeMethods.BVTNetworkSettings_SetAddressMode(_handle, ((int)mode));

            GC.KeepAlive(this);
            if (0 != error_code)
            {
                throw new SdkException(error_code);
            }
        }
Example #10
0
        public static STACKFRAME64 InitializeStackFrame64(AddressMode AddrMode, ulong OffsetPC, ulong OffsetFrame, ulong OffsetStack, ulong OffsetBStore)
        {
            STACKFRAME64 StackFrame = new STACKFRAME64();

            StackFrame.AddrPC.Mode       = AddrMode;
            StackFrame.AddrPC.Offset     = OffsetPC;
            StackFrame.AddrReturn.Mode   = AddrMode;
            StackFrame.AddrFrame.Mode    = AddrMode;
            StackFrame.AddrFrame.Offset  = OffsetFrame;
            StackFrame.AddrStack.Mode    = AddrMode;
            StackFrame.AddrStack.Offset  = OffsetStack;
            StackFrame.AddrBStore.Offset = OffsetBStore;
            StackFrame.AddrBStore.Mode   = AddrMode;
            return(StackFrame);
        }
Example #11
0
 public OpCode(
     byte hex,
     Operation operation,
     AddressMode addressMode,
     byte bytes,
     int cycles,
     StatusFlags affectsFlags)
 {
     Hex          = hex;
     Operation    = operation;
     AddressMode  = addressMode;
     Bytes        = bytes;
     Cycles       = cycles;
     AffectsFlags = affectsFlags;
 }
Example #12
0
        /// <summary>
        /// Enables an application to set and use a static IPv4 address.
        /// </summary>
        /// <param name="ipv4Address">Holds the IPv4 address to use. </param>
        /// <param name="ipv4SubnetMask">Contains the IPv4 address's subnet mask.</param>
        /// <param name="ipv4GatewayAddress">Specifies the IPv4 address of the gateway. </param>
        public void EnableStaticIPv4(string ipv4Address, string ipv4SubnetMask, string ipv4GatewayAddress)
        {
            try
            {
                _ipv4Address        = (uint)IPAddressFromString(ipv4Address);
                _ipv4NetMask        = (uint)IPAddressFromString(ipv4SubnetMask);
                _ipv4GatewayAddress = (uint)IPAddressFromString(ipv4GatewayAddress);
                _startupAddressMode = AddressMode.Static;

                UpdateConfiguration((int)UpdateOperation.Dhcp);
            }
            finally
            {
                ReloadSettings();
            }
        }
Example #13
0
        /// <summary>
        /// Creates a new instance of the cached sampler.
        /// </summary>
        /// <param name="context">The GPU context the sampler belongs to</param>
        /// <param name="descriptor">The Maxwell sampler descriptor</param>
        public Sampler(GpuContext context, SamplerDescriptor descriptor)
        {
            MinFilter minFilter = descriptor.UnpackMinFilter();
            MagFilter magFilter = descriptor.UnpackMagFilter();

            bool seamlessCubemap = descriptor.UnpackSeamlessCubemap();

            AddressMode addressU = descriptor.UnpackAddressU();
            AddressMode addressV = descriptor.UnpackAddressV();
            AddressMode addressP = descriptor.UnpackAddressP();

            CompareMode compareMode = descriptor.UnpackCompareMode();
            CompareOp   compareOp   = descriptor.UnpackCompareOp();

            ColorF color = new ColorF(
                descriptor.BorderColorR,
                descriptor.BorderColorG,
                descriptor.BorderColorB,
                descriptor.BorderColorA);

            float minLod     = descriptor.UnpackMinLod();
            float maxLod     = descriptor.UnpackMaxLod();
            float mipLodBias = descriptor.UnpackMipLodBias();

            float maxRequestedAnisotropy = GraphicsConfig.MaxAnisotropy >= 0 && GraphicsConfig.MaxAnisotropy <= 16 ? GraphicsConfig.MaxAnisotropy : descriptor.UnpackMaxAnisotropy();
            float maxSupportedAnisotropy = context.Capabilities.MaximumSupportedAnisotropy;

            if (maxRequestedAnisotropy > maxSupportedAnisotropy)
            {
                maxRequestedAnisotropy = maxSupportedAnisotropy;
            }

            HostSampler = context.Renderer.CreateSampler(new SamplerCreateInfo(
                                                             minFilter,
                                                             magFilter,
                                                             seamlessCubemap,
                                                             addressU,
                                                             addressV,
                                                             addressP,
                                                             compareMode,
                                                             compareOp,
                                                             color,
                                                             minLod,
                                                             maxLod,
                                                             mipLodBias,
                                                             maxRequestedAnisotropy));
        }
Example #14
0
        // SBC - Subtract with Carry
        void sbc(AddressMode mode, ushort address)
        {
            byte data     = _memory.Read(address);
            int  notCarry = (!C ? 1 : 0);

            byte result = (byte)(A - data - notCarry);

            SetZn(result);

            // If an overflow occurs (result actually less than 0)
            // the carry flag is cleared
            C = (A - data - notCarry) >= 0 ? true : false;

            V = ((A ^ data) & (A ^ result) & 0x80) != 0;

            A = result;
        }
Example #15
0
 // ASL - Arithmetic Shift Left
 void asl(AddressMode mode, ushort address)
 {
     if (mode == AddressMode.Accumulator)
     {
         C   = IsBitSet(A, 7);
         A <<= 1;
         SetZn(A);
     }
     else
     {
         byte data = _memory.Read(address);
         C = IsBitSet(data, 7);
         byte dataUpdated = (byte)(data << 1);
         _memory.Write(address, dataUpdated);
         SetZn(dataUpdated);
     }
 }
Example #16
0
 public Operand(byte code, Mnemonic mnemonic, AddressMode addressMode, byte maxTim, byte len, Func <Operand, Cpu, Operand> run,
                Func <Operand, Cpu, Operand> runSpecific, byte tim = 1, byte addressLo = 0, byte addressHi = 0, byte value = 0,
                byte result = 0)
 {
     Code        = code;
     Mnemonic    = mnemonic;
     AddressMode = addressMode;
     MaxTim      = maxTim;
     Len         = len;
     Run         = run;
     RunSpecific = runSpecific;
     Tim         = tim;
     AddressLo   = addressLo;
     AddressHi   = addressHi;
     Value       = value;
     Result      = result;
 }
Example #17
0
 public SamplerInfo(SamplerType type, TextureFilter minFilter, TextureFilter magFilter, TextureFilter mipFilter, AddressMode addressU, AddressMode addressV,
                    AddressMode addressW, Color borderColor, Comparison comparisonFunction, int maximumAnisotropy,
                    float mipLodBias, float minimumLod, float maximumLod)
 {
     this.Type               = type;
     this.MinFilter          = minFilter;
     this.MagFilter          = magFilter;
     this.MipFilter          = mipFilter;
     this.AddressU           = addressU;
     this.AddressV           = addressV;
     this.AddressW           = addressW;
     this.BorderColor        = borderColor;
     this.ComparisonFunction = comparisonFunction;
     this.MaximumAnisotropy  = maximumAnisotropy;
     this.MipLodBias         = mipLodBias;
     this.MinimumLod         = minimumLod;
     this.MaximumLod         = maximumLod;
 }
Example #18
0
        // ADC - Add with Carry
        void adc(AddressMode mode, ushort address)
        {
            byte data  = _memory.Read(address);
            int  carry = (C ? 1 : 0);

            byte sum = (byte)(A + data + carry);

            SetZn(sum);

            C = (A + data + carry) > 0xFF;

            // Sign bit is wrong if sign bit of operands is same
            // and sign bit of result is different
            // if <A and data> differ in sign and <A and sum> have the same sign, set the overflow flag
            // https://stackoverflow.com/questions/29193303/6502-emulation-proper-way-to-implement-adc-and-sbc
            V = (~(A ^ data) & (A ^ sum) & 0x80) != 0;

            A = sum;
        }
Example #19
0
 private static int Address(int axis, int axisLength, AddressMode mode)
 {
     switch (mode)
     {
         case AddressMode.Clamp:
             return Functions.Max(0, Functions.Min(axisLength - 1, axis));
         case AddressMode.Wrap:
             return Functions.Modulus(axis, axisLength);
         case AddressMode.Mirror:
             {
                 int cycle = axis / axisLength;
                 if (cycle % 2 == 0)
                     return axis - (cycle * axisLength);
                 else
                     return -axis + (cycle * axisLength) + (axisLength - 1);
             }
     }
     return axis;
 }
Example #20
0
        public static int GetInstructionLength(int offset)
        {
            AddressMode mode = GetAddressMode(offset);

            switch (mode)
            {
            case AddressMode.IMPLIED:
            case AddressMode.ACCUMULATOR:
                return(1);

            case AddressMode.CONSTANT_8:
            case AddressMode.IMMEDIATE_8:
            case AddressMode.DIRECT_PAGE:
            case AddressMode.DIRECT_PAGE_X_INDEX:
            case AddressMode.DIRECT_PAGE_Y_INDEX:
            case AddressMode.DIRECT_PAGE_S_INDEX:
            case AddressMode.DIRECT_PAGE_INDIRECT:
            case AddressMode.DIRECT_PAGE_X_INDEX_INDIRECT:
            case AddressMode.DIRECT_PAGE_INDIRECT_Y_INDEX:
            case AddressMode.DIRECT_PAGE_S_INDEX_INDIRECT_Y_INDEX:
            case AddressMode.DIRECT_PAGE_LONG_INDIRECT:
            case AddressMode.DIRECT_PAGE_LONG_INDIRECT_Y_INDEX:
            case AddressMode.RELATIVE_8:
                return(2);

            case AddressMode.IMMEDIATE_16:
            case AddressMode.ADDRESS:
            case AddressMode.ADDRESS_X_INDEX:
            case AddressMode.ADDRESS_Y_INDEX:
            case AddressMode.ADDRESS_INDIRECT:
            case AddressMode.ADDRESS_X_INDEX_INDIRECT:
            case AddressMode.ADDRESS_LONG_INDIRECT:
            case AddressMode.BLOCK_MOVE:
            case AddressMode.RELATIVE_16:
                return(3);

            case AddressMode.LONG:
            case AddressMode.LONG_X_INDEX:
                return(4);
            }
            return(1);
        }
 /// <summary>
 /// Create a full 48 bit COSIL instruction
 /// </summary>
 /// <param name="Instruction">Opcode for this instruction</param>
 /// <param name="Mode">Addressing mode required</param>
 /// <param name="ins1">Parameter one (8 bits)</param>
 /// <param name="ins2">Parameter two (32 bits)</param>
 /// <returns>A full 6 byte instruction in an array</returns>
 public Instruction(byte Instruction, AddressMode Mode, byte ins1, int ins2)
 {
     // create a blank byte array ready for the COSIL instruction format of 6 bits, 2 bits, 8 bits, 32 bits
     InstructionBytecode = new byte[6];
     // create a blank binary array ready for getting the first byte of the instruction
     bool[] eightBit = new bool[8];
     // get the binary value of just the instruction
     eightBit = BitOperations.GetBinaryValue(Instruction);
     // set the ad mode for the instruction byte
     if (Mode == AddressMode.RegisterRegister)
     {
         eightBit[6] = false;
         eightBit[7] = false;
     }
     else if (Mode == AddressMode.RegisterValue)
     {
         eightBit[6] = true;
         eightBit[7] = false;
     }
     else if (Mode == AddressMode.ValueRegister)
     {
         eightBit[6] = false;
         eightBit[7] = true;
     }
     else if (Mode == AddressMode.ValueValue)
     {
         eightBit[6] = true;
         eightBit[7] = true;
     }
     // get the instruction back into an eight bit C# byte
     InstructionBytecode[0] = BitOperations.GetByteValue(eightBit);
     // now set the first parameter byte of eight bits
     InstructionBytecode[1] = ins1;
     // now we need to set the remaining 32 bit integer
     byte[] temp = BitConverter.GetBytes(ins2);
     InstructionBytecode[2] = temp[0];
     InstructionBytecode[3] = temp[1];
     InstructionBytecode[4] = temp[2];
     InstructionBytecode[5] = temp[3];
     // finally return the finished instruction
 }
Example #22
0
        public static int InstructionLength(AddressMode mode)
        {
            switch (mode)
            {
            case AddressMode.Implied:
            case AddressMode.Accumulator:
                return(1);

            case AddressMode.Constant8:
            case AddressMode.Immediate8:
            case AddressMode.DirectPage:
            case AddressMode.DirectPageXIndex:
            case AddressMode.DirectPageYIndex:
            case AddressMode.DirectPageSIndex:
            case AddressMode.DirectPageIndirect:
            case AddressMode.DirectPageXIndexIndirect:
            case AddressMode.DirectPageIndirectYIndex:
            case AddressMode.DirectPageSIndexIndirectYIndex:
            case AddressMode.DirectPageLongIndirect:
            case AddressMode.DirectPageLongIndirectYIndex:
            case AddressMode.Relative8:
                return(2);

            case AddressMode.Immediate16:
            case AddressMode.Address:
            case AddressMode.AddressXIndex:
            case AddressMode.AddressYIndex:
            case AddressMode.AddressIndirect:
            case AddressMode.AddressXIndexIndirect:
            case AddressMode.AddressLongIndirect:
            case AddressMode.BlockMove:
            case AddressMode.Relative16:
                return(3);

            case AddressMode.Long:
            case AddressMode.LongXIndex:
                return(4);
            }

            return(1);
        }
Example #23
0
        // LSR - Logical Shift Right
        void lsr(AddressMode mode, ushort address)
        {
            if (mode == AddressMode.Accumulator)
            {
                C   = (A & 1) == 1;
                A >>= 1;

                SetZn(A);
            }
            else
            {
                byte value = _memory.Read(address);
                C = (value & 1) == 1;

                byte updatedValue = (byte)(value >> 1);

                _memory.Write(address, updatedValue);

                SetZn(updatedValue);
            }
        }
Example #24
0
        /// <summary>
        /// Creates a new texture sampler object.
        /// </summary>
        /// <param name="filter">The filtering mode.</param>
        /// <param name="addressMode">The coordinate addressing mode.</param>
        /// <param name="aniso">The anisotropic filtring level.</param>
        /// <param name="color">The border color for ClampToBorder sampling.</param>
        public Sampler
        (
            TextureFilter filter    = TextureFilter.Linear,
            AddressMode addressMode = AddressMode.ClampToEdge,
            AnisotropyLevel aniso   = AnisotropyLevel.None,
            ClampBorderColor color  = ClampBorderColor.OpaqueBlack
        )
        {
            Filter      = filter;
            AddressMode = addressMode;
            Anisotropy  = aniso;
            BorderColor = color;

            unchecked
            {
                int hash = 14461 * (5051 + filter.GetHashCode());
                hash *= (5051 + addressMode.GetHashCode());
                hash *= (5051 + aniso.GetHashCode());
                _hash = hash * (5051 + color.GetHashCode());
            }
        }
Example #25
0
        private static string FormatOperandAddress(int offset, AddressMode mode)
        {
            int address = Util.GetIntermediateAddress(offset);

            if (address < 0)
            {
                return("");
            }
            if (Data.GetLabel(address) != "")
            {
                return(Data.GetLabel(address));
            }

            int count = BytesToShow(mode);

            if (mode == AddressMode.RELATIVE_8 || mode == AddressMode.RELATIVE_16)
            {
                address = Util.GetROMWord(offset + 1);
            }
            address &= ~(-1 << (8 * count));
            return(Util.NumberToBaseString(address, Util.NumberBase.Hexadecimal, 2 * count, true));
        }
Example #26
0
        public int Step()
        {
            // If we are stalling, stall for a cycle
            if (stall > 0)
            {
                --stall;
                return(1);
            }

            UInt64 startCycles = cycles;

            HandleInterrupt();

            byte        opCode = memory.Read(pc);
            AddressMode mode   = (AddressMode)INSTRUCTION_MODES [opCode];
            AddressInfo info   = GetAddress(mode);

            pc     += INSTRUCTION_SIZES [opCode];
            cycles += INSTRUCTION_CYCLES [opCode];

            if (info.pageCrossed)
            {
                cycles += INSTRUCTION_PAGE_CYCLES [opCode];
            }

            StepInfo step = new StepInfo {
                address = info.address,
                pc      = pc,
                mode    = mode
            };

                        #if UNITY_EDITOR
            LogInstruction(opCode, step);
                        #endif

            table [opCode] (step);

            return((int)(cycles - startCycles));
        }
Example #27
0
        /// <summary>
        /// Creates a new instance of the cached sampler.
        /// </summary>
        /// <param name="context">The GPU context the sampler belongs to</param>
        /// <param name="descriptor">The Maxwell sampler descriptor</param>
        public Sampler(GpuContext context, SamplerDescriptor descriptor)
        {
            MinFilter minFilter = descriptor.UnpackMinFilter();
            MagFilter magFilter = descriptor.UnpackMagFilter();

            AddressMode addressU = descriptor.UnpackAddressU();
            AddressMode addressV = descriptor.UnpackAddressV();
            AddressMode addressP = descriptor.UnpackAddressP();

            CompareMode compareMode = descriptor.UnpackCompareMode();
            CompareOp   compareOp   = descriptor.UnpackCompareOp();

            ColorF color = new ColorF(
                descriptor.BorderColorR,
                descriptor.BorderColorG,
                descriptor.BorderColorB,
                descriptor.BorderColorA);

            float minLod     = descriptor.UnpackMinLod();
            float maxLod     = descriptor.UnpackMaxLod();
            float mipLodBias = descriptor.UnpackMipLodBias();

            float maxAnisotropy = descriptor.UnpackMaxAnisotropy();

            HostSampler = context.Renderer.CreateSampler(new SamplerCreateInfo(
                                                             minFilter,
                                                             magFilter,
                                                             addressU,
                                                             addressV,
                                                             addressP,
                                                             compareMode,
                                                             compareOp,
                                                             color,
                                                             minLod,
                                                             maxLod,
                                                             mipLodBias,
                                                             maxAnisotropy));
        }
Example #28
0
        private AddressMode GetMode(byte mode)
        {
            AddressMode addressMode = AddressMode.Invalid;

            if (mode == 0)
            {
                addressMode = AddressMode.Self;
            }
            else if (mode == 1)
            {
                addressMode = AddressMode.Here;
            }
            else if (mode >= 2 && mode <= NearSlots + 1)
            {
                addressMode = AddressMode.Near;
            }
            else if (mode >= NearSlots + 2 && mode <= NearSlots + SameSlots + 1)
            {
                addressMode = AddressMode.Same;
            }

            return(addressMode);
        }
Example #29
0
        private static string FormatOperandAddress(int offset, AddressMode mode)
        {
            int address = Util.GetEffectiveAddress(offset);

            if (address < 0)
            {
                return("");
            }
            int pc = Util.ConvertSNEStoPC(address);

            if (pc >= 0 && !string.IsNullOrEmpty(Data.GetLabel(pc)))
            {
                return(Data.GetLabel(pc));
            }

            int count = BytesToShow(mode);

            if (mode == AddressMode.RELATIVE_8 || mode == AddressMode.RELATIVE_16)
            {
                address = Util.GetROMWord(offset + 1);
            }
            address &= ~(-1 << (8 * count));
            return(Util.NumberToBaseString(address, Util.NumberBase.Hexadecimal, 2 * count, true));
        }
Example #30
0
 /// <summary>
 /// Gets the current address mode from the specified byte
 /// </summary>
 /// <param name="b">Address mode byte</param>
 public void GetAddressMode(byte b)
 {
     AdMode = GetLastTwo(b);
     if (AdMode == 0)
     {
         opMode = AddressMode.RegReg;
     }
     else if (AdMode == 1)
     {
         opMode = AddressMode.ValReg;
     }
     else if (AdMode == 2)
     {
         opMode = AddressMode.RegVal;
     }
     else if (AdMode == 3)
     {
         opMode = AddressMode.ValVal;
     }
     else
     {
         throw new Exception("[CRITICAL ERROR] Invalid address mode at " + IP + " (" + AdMode + ").");
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteAtlasRenderer" /> class.
 /// </summary>
 /// <param name="layerType">Type of the layer.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public SpriteAtlasRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("SpriteAtlasRenderer" + instances++, layerType)
 {
     this.SamplerMode = samplerMode;
 }
Example #32
0
        /// <summary>
        /// Sets the name of the machine to be used when none is specified in the address.
        /// </summary>
        /// <param name="mode"></param>
        /// <exception cref="InvalidOperationException"></exception>
        public static void InitializeAddressMode(AddressMode mode)
        {
            if (Local != null)
                throw new InvalidOperationException("The local address has already been initialized, switching address modes is no longer possible.");

            addressMode = mode;
        }
Example #33
0
 public MemoryOperand(AddressMode mode, PrimitiveType type, RegisterStorage reg) : base(type)
 {
     Mode = mode;
     Register = reg;
 }
        public async Task <QueryResult> GetPostCodeAddressesAsync(string postCode, AddressMode mode)
        {
            var result = new QueryResult();

            var urlBase = (mode == AddressMode.Basic) ? _options.BasicApiUrl : _options.RapidApiUrl;

            var url = String.Format(urlBase + "?postcode={0}&response=data_formatted&key={1}", postCode, _options.ApiKey);

            var jsonString = await GetResponseAsync(url);


            var jsonResponseObject = JsonConvert.DeserializeObject <dynamic>(jsonString);


            if (jsonResponseObject != null)
            {
                switch (mode)
                {
                case AddressMode.Rapid:
                {
                    if (jsonResponseObject.delivery_points != null)
                    {
                        //If the node list contains address nodes then move on.
                        int i = 0;

                        foreach (var node in jsonResponseObject.delivery_points)
                        {
                            ClsAddress address = new ClsAddress()
                            {
                                AddressID    = i,
                                AddressLine1 = node.line_1,
                                AddressLine2 = node.line_2,
                                Department   = node.department_name,
                                Organisation = node.organisation_name,

                                County   = jsonResponseObject.traditional_county,
                                PostCode = jsonResponseObject.postcode,
                                Town     = jsonResponseObject.town
                            };

                            result.Addresses.Add(address);
                            i++;
                        }
                    }
                    else
                    {
                        foreach (var node in jsonResponseObject)
                        {
                            // Get the details of the error message and return it the user.
                            switch ((string)node.Value)
                            {
                            case "0001":
                                result.Status = QueryStatus.PostCodeNotFound;
                                break;

                            case "0002":
                                result.Status = QueryStatus.InvalidPostCodeFormat;
                                break;

                            case "7001":
                                result.Status = QueryStatus.DemoLimitExceeded;
                                break;

                            case "8001":
                                result.Status = QueryStatus.InvalidOrNoAccessToken;
                                break;

                            case "8003":
                                result.Status = QueryStatus.AccountCrediteAllowanceExceeded;
                                break;

                            case "8004":
                                result.Status = QueryStatus.AccessDeniedDueToAccessRules;
                                break;

                            case "8005":
                                result.Status = QueryStatus.AccessDeniedAccountSuspended;
                                break;

                            case "9001":
                                result.Status = QueryStatus.InternalServerError;
                                break;

                            default:
                                result.Status = QueryStatus.Unknown;
                                break;
                            }
                        }
                    }
                }
                break;

                case AddressMode.Basic:
                {
                    if (jsonResponseObject.thoroughfare_count > 0)
                    {
                        //If the node list contains address nodes then move on.
                        int i = 0;

                        foreach (var node in jsonResponseObject.thoroughfares)
                        {
                            ClsAddress address = new ClsAddress()
                            {
                                AddressID    = i,
                                AddressLine1 = node.line_1,
                                AddressLine2 = node.line_2,
                                Department   = node.department_name,
                                Organisation = node.organisation_name,

                                County   = jsonResponseObject.traditional_county,
                                PostCode = jsonResponseObject.postcode,
                                Town     = jsonResponseObject.town
                            };

                            result.Addresses.Add(address);
                            i++;
                        }
                    }
                    else
                    {
                        foreach (var node in jsonResponseObject)
                        {
                            // Get the details of the error message and return it the user.
                            switch ((string)node.Value)
                            {
                            case "0001":
                                result.Status = QueryStatus.PostCodeNotFound;
                                break;

                            case "0002":
                                result.Status = QueryStatus.InvalidPostCodeFormat;
                                break;

                            case "7001":
                                result.Status = QueryStatus.DemoLimitExceeded;
                                break;

                            case "8001":
                                result.Status = QueryStatus.InvalidOrNoAccessToken;
                                break;

                            case "8003":
                                result.Status = QueryStatus.AccountCrediteAllowanceExceeded;
                                break;

                            case "8004":
                                result.Status = QueryStatus.AccessDeniedDueToAccessRules;
                                break;

                            case "8005":
                                result.Status = QueryStatus.AccessDeniedAccountSuspended;
                                break;

                            case "9001":
                                result.Status = QueryStatus.InternalServerError;
                                break;

                            default:
                                result.Status = QueryStatus.Unknown;
                                break;
                            }
                        }
                    }
                }
                break;
                }
            }
            else
            {
                result.Status = QueryStatus.Unknown;
            }
            return(result);
        }
Example #35
0
 public BNO055IMU(string i2cFriendlyName = "I2C1", AddressMode imuAddress = AddressMode.AddressA)
 {
     this.I2CFriendlyName = i2cFriendlyName;
     this.IMUAddress      = imuAddress;
 }
Example #36
0
		public static D3DAddressMode Convert ( AddressMode addressMode ) 
		{
			return (D3DAddressMode)(int)addressMode;
		}
Example #37
0
        /// <summary>
        /// Sets the name of the machine to be used when none is specified in the address.
        /// </summary>
        /// <param name="mode"></param>
        /// <exception cref="InvalidOperationException"></exception>
        public static void InitializeAddressMode(AddressMode mode)
        {
            addressMode = mode;

            if (preventChanges)
                throw new InvalidOperationException("Overwriting a previously set address mode is a very dangerous operation. If you think that your scenario warrants it, you can catch this exception and continue.");
        }
Example #38
0
 /// <summary>
 /// Creates a new instance of sampler state
 /// </summary>
 /// <param name="filter"></param>
 /// <param name="addressMode"></param>
 /// <param name="borderColor"></param>
 /// <param name="comparison"></param>
 /// <returns></returns>
 public static SamplerState Create( Filter filter, AddressMode addressMode, Color4 borderColor, ComparisonFunc cmpFunc = ComparisonFunc.Always )
 {
     return new SamplerState() {
         Filter			=	filter,
         Address			=	addressMode,
         BorderColor		=	borderColor,
         ComparisonFunc	=	cmpFunc,
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BillboardRenderer" /> class.
 /// </summary>
 /// <param name="layerType">
 /// Layer type (available at <see cref="DefaultLayers"/>).
 /// Example: new SpriteRenderer(DefaultLayers.Alpha)
 /// </param>
 /// <param name="samplerMode">
 /// Sampler mode <see cref="AddressMode"/>
 /// Example: new SpriteRenderer(DefaultLayers.Alpha)
 /// </param>
 public BillboardRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("BillboardRenderer" + instances++)
 {
     this.samplerMode = samplerMode;
     this.LayerType = layerType;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SkeletalRenderer" /> class.
 /// </summary>
 /// <param name="layerType">Type of the layer.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public SkeletalRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("SkeletalRenderer" + instances++, layerType)
 {
     this.Transform2D = null;
     this.samplerMode = samplerMode;
     this.material = new BasicMaterial2D() { LayerType = layerType, SamplerMode = this.samplerMode };
     this.position = new Vector2();
     this.scale = new Vector2(1);
     this.ActualDebugMode = DebugMode.Bones;
 }
 /// <summary>
 /// Sets the default values
 /// </summary>
 protected override void DefaultValues()
 {
     base.DefaultValues();
     this.samplerMode = AddressMode.PointClamp;
     this.meshes = new List<Tuple<StandardMaterial, Mesh>>();
     this.originTranslation = Matrix.Identity;
 }
Example #42
0
 /// <summary>
 /// Sets the name of the machine to be used when none is specified in the address.
 /// </summary>
 /// <param name="mode"></param>
 /// <exception cref="InvalidOperationException"></exception>
 public static void InitializeAddressMode(AddressMode mode)
 {
     addressMode = mode;
 }
Example #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteAtlasRenderer" /> class.
 /// </summary>
 /// <param name="layerType">Type of the layer.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public SpriteAtlasRenderer(Type layerType, AddressMode samplerMode = AddressMode.LinearClamp)
     : base("SpriteAtlasRenderer" + instances++, layerType)
 {
     this.SamplerMode = samplerMode;
 }
Example #44
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TiledMap" /> class.
        /// </summary>
        /// <param name="tmxPath">TMX file path.</param>
        /// <param name="layerType">Render layer associated to this Tiled Map</param>
        /// <param name="samplerMode">The sampler mode.</param>
        public TiledMap(string tmxPath, Type layerType, AddressMode samplerMode)
        {
            if (string.IsNullOrEmpty(tmxPath))
            {
                throw new ArgumentNullException("tmxPath");
            }

            this.tmxPath = tmxPath;
            this.tilesets = new List<Tileset>();
            this.layerType = layerType;
            this.samplerMode = samplerMode;
            this.minLayerDrawOrder = -100;
            this.maxLayerDrawOrder = 100;

            this.tmxMap = new TmxMap(this.tmxPath);
            this.Version = this.tmxMap.Version;
            this.Orientation = (TiledMapOrientationType)((int)this.tmxMap.Orientation);
            this.RenderOrder = (TiledMapRenderOrderType)((int)this.tmxMap.RenderOrder);
            this.Width = this.tmxMap.Width;
            this.Height = this.tmxMap.Height;
            this.TileWidth = this.tmxMap.TileWidth;
            this.TileHeight = this.tmxMap.TileHeight;
            this.BackgroundColor = new Color(this.tmxMap.BackgroundColor.R, this.tmxMap.BackgroundColor.G, this.tmxMap.BackgroundColor.B);

            this.tileLayers = new Dictionary<string, TiledMapLayer>();
            this.TileLayers = new ReadOnlyDictionary<string, TiledMapLayer>(this.tileLayers);

            this.objectLayers = new Dictionary<string, TiledMapObjectLayer>();
            this.ObjectLayers = new ReadOnlyDictionary<string, TiledMapObjectLayer>(this.objectLayers);
        }
Example #45
0
		/// <summary>
		/// Creates a new instance of sampler state
		/// </summary>
		/// <param name="filter"></param>
		/// <param name="addressMode"></param>
		/// <param name="borderColor"></param>
		/// <param name="comparison"></param>
		/// <returns></returns>
		public static SamplerState Create ( Filter filter, AddressMode addressMode, Color4 borderColor, ComparisonFunc cmpFunc = ComparisonFunc.Always, int maxMipLevel = int.MaxValue )
		{
			return new SamplerState() {
				Filter			=	filter,
				Address			=	addressMode,
				BorderColor		=	borderColor,
				ComparisonFunc	=	cmpFunc,
				MaxMipLevel		=	maxMipLevel,
			};
		}
Example #46
0
        public VariableInfo(Architecture arch, TargetBinaryReader reader)
        {
            Index = reader.ReadLeb128 ();
            Offset = reader.ReadSLeb128 ();
            Size = reader.ReadLeb128 ();
            BeginLiveness = reader.ReadLeb128 ();
            EndLiveness = reader.ReadLeb128 ();

            MonoType = new TargetAddress (
                reader.TargetMemoryInfo.AddressDomain, reader.ReadAddress ());

            Mode = (AddressMode) (Index & AddressModeFlags);
            Index = (int) ((long) Index & ~AddressModeFlags);

            Report.Debug (DebugFlags.JitSymtab, "VARIABLE INFO: {0} {1} {2} {3} {4}",
                      Mode, Index, Offset, Size, arch);

            if ((Mode == AddressMode.Register) || (Mode == AddressMode.RegOffset))
                Index = arch.RegisterMap [Index];

            Report.Debug (DebugFlags.JitSymtab, "VARIABLE INFO #1: {0}", Index);

            HasLivenessInfo = (BeginLiveness != 0) && (EndLiveness != 0);
        }
        /// <summary>
        /// Method compiling the source into the bytecode executable
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public string Decompile()
        {
            //
            if (Executable.Length == 0)
            {
                throw new Exception("Executable cannot be empty!");
            }
            else
            {
                List <byte[]> splitted      = new List <byte[]>();//This list will contain all the splitted arrays.
                int           lengthToSplit = 6;

                int arrayLength = Executable.Length;

                for (int i = 0; i < arrayLength; i = i + lengthToSplit)
                {
                    byte[] val = new byte[lengthToSplit];

                    if (arrayLength < i + lengthToSplit)
                    {
                        lengthToSplit = arrayLength - i;
                    }
                    Array.Copy(Executable, i, val, 0, lengthToSplit);
                    splitted.Add(val);


                    foreach (byte[] bytearray in splitted)
                    {
                        byte[] operation   = bytearray;
                        string Line        = "";
                        byte   Instruction = BitOperations.GetFirstSix(operation[0]);
                        byte   AddrMode    = BitOperations.GetAddressMode(operation[0]);
                        string param1      = "";
                        string param2      = "";

                        string      instr       = GetInstruction(Instruction);
                        AddressMode AddressMode = (AddressMode)AddrMode;

                        if (AddressMode == AddressMode.RegisterRegister)
                        {
                            param1 = GetRegister(operation[1]);
                            param2 = GetRegister(operation[2]);
                        }
                        else if (AddressMode == AddressMode.ValueRegister)
                        {
                            int    num   = 0;
                            byte[] value = new byte[] { operation[2], operation[3] };
                            foreach (byte b in value)
                            {
                                num += b;
                            }
                            param1 = num.ToString();

                            int    num2   = 0;
                            byte[] value2 = new byte[] { operation[4], operation[5] };
                            foreach (byte b in value)
                            {
                                num2 += b;
                            }
                            param2 = num2.ToString();
                        }
                        else if (AddressMode == AddressMode.RegisterValue)
                        {
                            param1 = GetRegister(operation[1]);
                            byte[] value = new byte[] { operation[2], operation[3], operation[4], operation[5] };
                            int    num   = 0;
                            foreach (byte b in value)
                            {
                                num += b;
                            }
                            param2 = num.ToString();
                        }
                        else if (AddressMode == AddressMode.ValueValue)
                        {
                            byte[] value1 = new byte[] { operation[1], operation[2] };
                            int    num1   = 0;
                            foreach (byte b in value1)
                            {
                                num1 += b;
                            }
                            byte[] value2 = new byte[] { operation[3], operation[4] };
                            int    num2   = 0;
                            foreach (byte b in value2)
                            {
                                num2 += b;
                            }
                            param1 = num1.ToString();
                            param2 = num2.ToString();
                        }
                        else
                        {
                            param1 = "";
                            param2 = "";
                        }

                        Line        = instr + " " + param1 + " " + param2 + "\n";
                        SourceCode += Line;
                    }
                }

                return(SourceCode);
            }
        }
        /// <summary>
        /// Sets the default values
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.SamplerMode = AddressMode.LinearClamp;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TiledMapLayerRenderer" /> class.
 /// </summary>
 /// <param name="layerType">The layer type.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public TiledMapLayerRenderer(Type layerType, AddressMode samplerMode)
     : base(layerType)
 {
     this.samplerMode = samplerMode;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TiledMapLayerRenderer" /> class.
 /// </summary>
 /// <param name="layerType">The layer type.</param>
 /// <param name="samplerMode">The sampler mode.</param>
 public TiledMapLayerRenderer(Type layerType, AddressMode samplerMode)
     : base(layerType)
 {
     this.meshes = new List<Tuple<BasicMaterial2D, Mesh>>();
     this.samplerMode = samplerMode;
 }