Beispiel #1
0
        public override void activate(string prevReceiver)
        {
            base.activate(prevReceiver);
            if (prevReceiver.StartsWith("PROG"))
            {
                tick(0);
                return;
            }
            LCD_Manager    lm = _parent._m_Hardware_LCD;
            Program_Memory pm = _parent._m_Program_Memory;

            lm.clearScreen();
            lm.outputStatus(
                pm.getCounter(),
                _parent._m_Extended_Memory.getCounter(),
                pm.getEModeName(),
                "   ");
            int display_PC = (int)pm.getCounter();

            string[] _displayLines = pm.getPreviousLines(LCD_Manager.SCREEN_ROWS - 1);
            for (int i = 10, j = 0, k = display_PC; i >= 0; i--, j++, k--)
            {
                if (k < 0)
                {
                    lm.eraseTerminalLine((uint)i);
                    continue;
                }
                string s = k.ToString("0000");
                s += (k == display_PC) ? "> " : "  ";
                lm.outputTerminalLine((uint)i, s + _displayLines[j]);
            }
            lm.forcePaint();
        }
Beispiel #2
0
        public override byte tick(byte scancode)
        {
            LCD_Manager    lm = _parent._m_Hardware_LCD;
            Program_Memory pm = _parent._m_Program_Memory;

            lm.updateStatusPC(pm.getCounter());
            lm.updateStatusMC(_parent._m_Extended_Memory.getCounter());
            lm.updateStatusDMODE(pm.getEModeName());
            int display_PC = (int)pm.getCounter();

            string[] _displayLines = pm.getPreviousLines(LCD_Manager.SCREEN_ROWS - 1);
            for (int i = 10, j = 0, k = display_PC; i >= 0; i--, j++, k--)
            {
                if (k < 0)
                {
                    lm.eraseTerminalLine((uint)i);
                    continue;
                }
                string s = k.ToString("0000");
                s += (k == display_PC) ? "> " : "  ";
                lm.updateTerminalLine((uint)i, s + _displayLines[j]);
            }
            lm.requestUpdate();
            return(0);
        }
        private bool _writeProgram()
        {
            if (_sd.println_P("#"))
            {
                return(true);
            }
            if (_sd.println_P("# MK-52 program"))
            {
                return(true);
            }
            if (_sd.println_P("#"))
            {
                return(true);
            }
            uint ctr = progMem.getCounter();

            if (_sd.print("PC="))
            {
                return(true);
            }
            if (_sd.println(ctr.ToString("0000")))
            {
                return(true);
            }
            progMem.setCounter(0);
            while (!progMem.isAtEnd())
            {
                string ptr = progMem.getCurrentLine();
                if (ptr.Length == 0)
                { // empty lines ignored
                    progMem.incrementCounter();
                    continue;
                }
                if (_sd.print_P("P") ||
                    _sd.print(progMem.getCounter().ToString("0000")) ||
                    _sd.print_P(": ") ||
                    _sd.println(ptr))
                {
                    progMem.setCounter(ctr);
                    return(true);
                }
                progMem.incrementCounter();
            }
            progMem.setCounter(ctr);
            return(false);
        }