Ejemplo n.º 1
0
        private byte[] GenerateLine(ushort address)
        {
            var lineValues = new byte[LINE_SIZE];

            for (var i = 0; i < LINE_SIZE; i++)
            {
                lineValues[i] = this.Memory.Content[address + i];
            }

            var lineData = new byte[WIDTH];

            for (var i = 0; i < LINE_SIZE; i++)
            {
                var lineBit = 7;
                for (var bit = 0; bit < WIDTH; bit++)
                {
                    if (Bit.IsSet(lineValues[i], bit))
                    {
                        lineData[lineBit] = Bit.Set(lineData[lineBit], i, true);
                    }
                    lineBit -= 1;
                }
            }

            return(lineData);
        }
Ejemplo n.º 2
0
        public void TestIsSetWithInt()
        {
            int x = A | D;

            Assert.IsTrue(Bit.IsSet(x, A), "Expected: true, because A is set in x");
            Assert.IsFalse(Bit.IsSet(x, B), "Expected: false, because B is not set in x");
            Assert.IsTrue(Bit.IsSet(x, D), "Expected: true, because D is set in x");
        }
Ejemplo n.º 3
0
        public void TestIsSetWithLong()
        {
            long x = AA | DD;

            Assert.IsTrue(Bit.IsSet(x, AA), "Expected: true, because AA is set in x");
            Assert.IsFalse(Bit.IsSet(x, BB), "Expected: false, because BB is not set in x");
            Assert.IsTrue(Bit.IsSet(x, DD), "Expected: true, because DD is set in x");
        }
Ejemplo n.º 4
0
        public void TestIsSetWithEnum()
        {
            X x = X.A | X.D;

            Assert.IsTrue(Bit.IsSet(x, X.A), "Expected: true, because A is set in x");
            Assert.IsFalse(Bit.IsSet(x, X.B), "Expected: false, because B is not set in x");
            Assert.IsTrue(Bit.IsSet(x, X.D), "Expected: true, because D is set in x");
        }
Ejemplo n.º 5
0
 /// <summary>
 /// testet, ob das Bit gesetzt ist
 /// </summary>
 /// <param name="b"></param>
 /// <param name="bit"></param>
 /// <returns></returns>
 protected bool BitIsSet(byte b, byte bit)
 {
     return(Bit.IsSet(b, bit));
 }