コード例 #1
0
        public bool Load(BinaryReader sr)
        {
            int x = 0, y = 0;

            for (var i = 0; i < TotalBytes; i++)
            {
                var b         = new C64MemoryModel.Types.Byte(sr.ReadByte());
                var physicalX = x * 8;

                SetPixel(physicalX, y, b.Bit7 ? 1 : 0);
                SetPixel(physicalX + 1, y, b.Bit6 ? 1 : 0);
                SetPixel(physicalX + 2, y, b.Bit5 ? 1 : 0);
                SetPixel(physicalX + 3, y, b.Bit4 ? 1 : 0);
                SetPixel(physicalX + 4, y, b.Bit3 ? 1 : 0);
                SetPixel(physicalX + 5, y, b.Bit2 ? 1 : 0);
                SetPixel(physicalX + 6, y, b.Bit1 ? 1 : 0);
                SetPixel(physicalX + 7, y, b.Bit0 ? 1 : 0);
                x++;

                if (x <= 2)
                {
                    continue;
                }

                x = 0;
                y++;
            }
            return(true);
        }
コード例 #2
0
 public void SetAt(int subX, int subY, bool set)
 {
     var b = new Byte(Identity);
     if (subY == 0)
     {
         if (subX == 0)
             b.Bit0 = set;
         else if (subX == 1)
             b.Bit1 = set;
         else
             throw new ArgumentOutOfRangeException();
         Identity = b.Value;
         return;
     }
     if (subY == 1)
     {
         if (subX == 0)
             b.Bit2 = set;
         else if (subX == 1)
             b.Bit3 = set;
         else
             throw new ArgumentOutOfRangeException();
         Identity = b.Value;
         return;
     }
     throw new ArgumentOutOfRangeException();
 }
コード例 #3
0
        public void SetBytes(byte[] bytes)
        {
            if (bytes == null || bytes.Length != TotalBytes)
            {
                throw new ArgumentException();
            }

            var b = new C64MemoryModel.Types.Byte[TotalBytes];

            for (var i = 0; i < TotalBytes; i++)
            {
                b[i] = new C64MemoryModel.Types.Byte(bytes[i]);
            }

            SetBytes(b);
        }
コード例 #4
0
        public byte[] GetBytes()
        {
            var ret = new byte[TotalBytes];
            var i   = 0;

            for (var y = 0; y < Height; y++)
            {
                for (var x = 0; x < 3; x++)
                {
                    var physicalX = 8 * x;
                    var b         = new C64MemoryModel.Types.Byte(IsSet(physicalX, y), IsSet(physicalX + 1, y), IsSet(physicalX + 2, y), IsSet(physicalX + 3, y), IsSet(physicalX + 4, y), IsSet(physicalX + 5, y), IsSet(physicalX + 6, y), IsSet(physicalX + 7, y));
                    ret[i] = b.Value;
                    i++;
                }
            }

            return(ret);
        }