Пример #1
0
        /// <summary>
        /// Compiles and runs
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CompileAndRunItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // create a source module from the text
                SourceModule sourceModule = new SourceModule(programText.Text);

                // compile it
                SunaCompiler compiler     = new SunaCompiler();
                LinkedModule linkedModule = compiler.Compile(sourceModule);

                // Show the simulator if it's not
                AppleWinThread.Show(true);

                // enter monitor so that the Apple ][ is not using memory that we want
                // not used
                Machine.ExecuteProgram(linkedModule.GetImage(), linkedModule.BaseAddress);
            }
            catch (NotImplementedException niX)
            {
                MessageBox.Show("Feature not implemented: " + niX.Message);
            }
            catch (CompileException cX)
            {
                MessageBox.Show("Compile exception: " + cX.Message);
            }
        }
Пример #2
0
        public void TestBeep()
        {
            LinkedModule linkedModule = CompileResource("Beep.suna");

            byte[] expected =
                new byte[] {
                0x20,
                0x3A,
                0xFF,
                0x20,
                0x3A,
                0xFF,
                0x20,
                0x3A,
                0xFF,
                0x60
            };
            var actual = linkedModule.GetImage();

            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; ++i)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
Пример #3
0
        public bool UpdateLinkedModule(LinkedModule module)
        {
            var target = GetLinkedModule(module.Id);

            if (target != null)
            {
                target.ProjectModuleId = module.ProjectModuleId;
                target.Description     = module.Description;

                return(_context.SaveChanges() == 0);
            }
            return(false);
        }
Пример #4
0
 public bool RemoveSchedule(LinkedModule schedule)
 {
     _context.LinkedModules.Remove(schedule);
     return(_context.SaveChanges() == 0);
 }
Пример #5
0
 public bool AddLinkedModule(LinkedModule module)
 {
     _context.LinkedModules.Add(module);
     return(_context.SaveChanges() == 0);
 }