Пример #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]);
            }
        }