Example #1
0
        private void SaveQuetzal(byte dest, int nextPC)
        {
            Quetzal quetzal = new Quetzal();
            quetzal.AddBlock("IFhd", MakeIFHD(nextPC - 1));
            quetzal.AddBlock("CMem", CompressRAM());
            quetzal.AddBlock("Stks", SerializeStacks());

            using (Stream stream = io.OpenSaveFile(quetzal.Length))
            {
                if (stream == null)
                {
                    StoreResult(dest, 0);
                    return;
                }

                try
                {
                    quetzal.WriteToStream(stream);
                    StoreResult(dest, 1);
                }
                catch
                {
                    StoreResult(dest, 0);
                }
            }
        }
Example #2
0
        private void SaveQuetzal(byte dest, int nextPC)
        {
            Quetzal quetzal = new Quetzal();

            quetzal.AddBlock("IFhd", MakeIFHD(nextPC - 1));
            quetzal.AddBlock("CMem", CompressRAM());
            quetzal.AddBlock("Stks", SerializeStacks());

            using (Stream stream = io.OpenSaveFile(quetzal.Length))
            {
                if (stream == null)
                {
                    StoreResult(dest, 0);
                    return;
                }

                try
                {
                    quetzal.WriteToStream(stream);
                    StoreResult(dest, 1);
                }
                catch
                {
                    StoreResult(dest, 0);
                }
            }
        }
Example #3
0
#pragma warning disable 0169
        private bool SaveQuetzal(int savedPC)
        {
            Quetzal quetzal = new Quetzal();
            // savedPC points to the result storage byte (V3) or branch offset (V4+) of the save instruction
            quetzal.AddBlock("IFhd", MakeIFHD(savedPC));
            quetzal.AddBlock("CMem", CompressRAM());
            quetzal.AddBlock("Stks", SerializeStacks());

            using (Stream stream = io.OpenSaveFile(quetzal.Length))
            {
                if (stream == null)
                {
                    return false;
                }

                try
                {
                    quetzal.WriteToStream(stream);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }
Example #4
0
#pragma warning disable 0169
        private bool SaveQuetzal(int savedPC)
        {
            Quetzal quetzal = new Quetzal();

            // savedPC points to the result storage byte (V3) or branch offset (V4+) of the save instruction
            quetzal.AddBlock("IFhd", MakeIFHD(savedPC));
            quetzal.AddBlock("CMem", CompressRAM());
            quetzal.AddBlock("Stks", SerializeStacks());

            using (Stream stream = io.OpenSaveFile(quetzal.Length))
            {
                if (stream == null)
                {
                    return(false);
                }

                try
                {
                    quetzal.WriteToStream(stream);
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }