/// <summary>
        /// The IFrame is a colour setting for EVERY Pixel - the dimensions can be guessed at
        /// </summary>
        /// <param name="f">I Framedef</param>
        /// <returns>Parsed IFrame</returns>
        private IFrameDef GetIFrame(FrameDef f)
        {
            IFrameDef result = new IFrameDef()
            {
                PalIndex = new List <byte>()
            };

            if (f.Type != FrameType.I)
            {
                return(result);
            }
            if (f.Count != f.Data.Length / 2)
            {
                Console.WriteLine($"  ERROR IFrame length mismatch !! {f.Count} vs actual {f.Data.Length / 2}");
                return(result);
            }

            Width  = (ushort)Math.Sqrt(f.Count);
            Height = (ushort)(f.Count / Width);
            Console.WriteLine($"  IFrame dimension {Width}x{Height}");

            for (int i = 0; i < f.Count; i++)
            {
                result.PalIndex.Add(byte.Parse(f.Data.Substring(i * 2, 2), NumberStyles.AllowHexSpecifier));
            }

            return(result);
        }
        /// <summary>
        /// The P Frame addresses specific pixels - but encodes the position in a single byte - or in 2 bytes
        /// for 8bit - Row is in the high nybble, column is in the low nybble
        /// </summary>
        /// <param name="f">P Framedef</param>
        /// <returns>Parsed PFrame</returns>
        private PFrameDef GetPFrame(FrameDef f)
        {
            PFrameDef result = new PFrameDef()
            {
                Pix = new List <PFrameItem>()
            };
            bool b8 = (f.Count * 4 == f.Data.Length);

            if (b8)
            {
                Console.WriteLine($"  PFrame 8 bit position");
            }
            else
            {
                Console.WriteLine($"  PFrame 16 bit position");
            }


            if (f.Type != FrameType.P)
            {
                return(result);
            }

            for (int i = 0; i < f.Count; i++)
            {
                PFrameItem item = new PFrameItem();

                if (b8)
                {
                    item.Y   = byte.Parse(f.Data.Substring(i * 4, 1), NumberStyles.AllowHexSpecifier);
                    item.X   = byte.Parse(f.Data.Substring(i * 4 + 1, 1), NumberStyles.AllowHexSpecifier);
                    item.Pal = byte.Parse(f.Data.Substring(i * 4 + 2, 2), NumberStyles.AllowHexSpecifier);
                    //Console.WriteLine($"{item.X},{item.Y} = {item.Pal}");
                }
                else  // long 256 bits per line ?
                {
                    var y = byte.Parse(f.Data.Substring(i * 6, 2), NumberStyles.AllowHexSpecifier);
                    var x = byte.Parse(f.Data.Substring(i * 6 + 2, 2), NumberStyles.AllowHexSpecifier);

                    // we know the width/height if we had an Iframe - or assume 18x18 ?
                    item.Y   = (byte)((x + y * 256) / Width);
                    item.X   = (byte)((x + y * 256) % Width);
                    item.Pal = byte.Parse(f.Data.Substring(i * 6 + 4, 2), NumberStyles.AllowHexSpecifier);
                    //Console.WriteLine($"{item.X},{item.Y} = {item.Pal}   {f.Data.Substring(i * 6 + 2, 2)},{f.Data.Substring(i * 6, 2)}={f.Data.Substring(i * 6 + 4, 2)}");
                }
                result.Pix.Add(item);
            }

            return(result);
        }