Exemple #1
0
 protected bool CreateCasFile(byte[] programbytes, CasFileContent casContent)
 {
     try
     {
         CasFileWriter writer = new CasFileWriter(BuildSettings.CasFilePath, BuildSettings.CopyProtected, CasFileType.ProgramFile, casContent, BuildSettings.AutoRun);
         writer.Write(programbytes);
         return(true);
     }
     catch (TvcBasicException e)
     {
         OnBuildMessageSent($"'{BuildSettings.CasFilePath}' létrehozása sikertelen:{e.Message}");
         return(false);
     }
 }
        public void IntegrationTest1()
        {
            List <string> programrows = new List <string>
            {
                "ORG $3000",
                "RST $30",
                "DB  $05",
                "LD  BC,$010C",
                "RST $30",
                "DB  $03",
                "LD  DE,SZOVEG",
                "LD  BC,21",
                "RST $30",
                "DB  $02",
                "RET",
                "SZOVEG  DB 'ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP'"
            };

            string fileName = @"IntegrationTest1.cas";

            var assembler = new Z80Assembler(programrows);
            var assembled = assembler.BuildProgram();

            Assert.AreEqual(assembled, true);

            var  loader          = new TvcBasicLoader(assembler.AssembledProgram, 1, 1, 0x3000);
            bool loaderGenerated = loader.GenerateBasicLoader();

            Assert.AreEqual(loaderGenerated, true);

            CasFileWriter writer = new CasFileWriter(fileName);

            writer.Write(loader.BasicLoaderProgramBytes.ToArray());

            var bytesOfCreatedFile = File.ReadAllBytes(fileName);
            var bytesOfBaseFile    = File.ReadAllBytes(IntegrationTest1TestFileName);

            Assert.AreEqual(bytesOfCreatedFile.SequenceEqual(bytesOfBaseFile), true);
        }