Exemplo n.º 1
0
        // Try to construct a tape file from file data. Returns null if not a tape file, throws exceptions for bad tape files.
        // (Note that some error conditions aren't caught right here.)
        public static Tape Load(byte[] tapeFile)
        {
            Tape result = null;

            if (Encoding.ASCII.GetString(tapeFile, 0, 12) == "C64-TAPE-RAW")
            {
                var version = tapeFile[12];
                if (version > 1) throw new Exception("This tape has an unsupported version");
                var size = BitConverter.ToUInt32(tapeFile, 16);
                if (size + 20 != tapeFile.Length)
                {
                    throw new Exception("Tape file header specifies a length that doesn't match the file size");
                }
                result = new Tape(version, tapeFile, 20, tapeFile.Length);
            }
            return result;
        }
Exemplo n.º 2
0
 public void Insert(Tape tape)
 {
     _tape = tape;
 }
Exemplo n.º 3
0
 public void RemoveMedia()
 {
     _tape = null;
 }