protected override void completeEntry(string value)
        {
            Extended_Memory em = _parent._m_Extended_Memory;

            em.fromString(value);
            em.incrementCounter();
        }
Example #2
0
        private bool _read(bool readStack, bool readProg, bool readMem)
        {
            uint pmemctr = progMem.getCounter();
            uint ememctr = extMem.getCounter();
            //uint callStackDeclared = 0; presented in dump file, but not used
            uint callStackActual = 0;
            byte regAddress      = 0;

            while (true)
            {
                bool result = _sd.readln(_text, PROGRAM_LINE_LENGTH);
                _text = _sd.__text;
                if (result && _text.Length == 0)
                {
                    break;
                }
                if (_text.Length == 0)
                {
                    continue;
                }
                if (_text[0] == '#')
                {
                    continue;
                }
                if (readProg)
                {
                    if (UniversalValue._startsWith_P(_text, "PC="))
                    {
                        progMem.setCounter(_text.Substring(3));
                        pmemctr = progMem.getCounter();
                        continue;
                    }
                    if (UniversalValue._isProgramAddress(_text))
                    {
                        string[] ptr = UniversalValue._selectAddress(_text);
                        if (ptr[0].Length < 4 && ptr[1].Length < 1)
                        {
                            continue;                                         // string too short or incorrectly formed
                        }
                        progMem.setCounter(ptr[0]);
                        progMem.replaceLine(ptr[1]);  // TODO: name conversion
                        continue;
                    }
                    if (UniversalValue._isReturnStackAddress(_text))
                    {
                        string[] ptr = UniversalValue._selectAddress(_text);
                        if (ptr[0].Length < 4 && ptr[1].Length < 1)
                        {
                            continue;                                         // string too short or incorrectly formed
                        }
                        progMem.setCallStackValues(callStackActual++, ptr[0], ptr[1]);
                        continue;
                    }
                }
                if (readMem)
                {
                    if (UniversalValue._startsWith_P(_text, "MC="))
                    {
                        extMem.setCounter(_text.Substring(3));
                        ememctr = extMem.getCounter();
                        continue;
                    }
                    if (UniversalValue._isMemoryAddress(_text))
                    {
                        string[] ptr = UniversalValue._selectAddress(_text);
                        if (ptr[0].Length < 4 && ptr[1].Length < 1)
                        {
                            continue;                                         // string too short or incorrectly formed
                        }
                        extMem.setCounter(ptr[0]);
                        extMem.fromString(ptr[1]);
                        continue;
                    }
                }
                if (readStack)
                {
                    if (UniversalValue._startsWith_P(_text, "DISPL="))
                    {
                        _receiverRequested = _text.Substring(6);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "X="))
                    {
                        rpnStack.X.fromString(_text.Substring(2));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "Y="))
                    {
                        rpnStack.Y.fromString(_text.Substring(2));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "Z="))
                    {
                        rpnStack.Z.fromString(_text.Substring(2));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "T="))
                    {
                        rpnStack.T.fromString(_text.Substring(2));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "Bx="))
                    {
                        rpnStack.Bx.fromString(_text.Substring(3));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "DMODE=DEG"))
                    {
                        rpnStack.setDMode(0);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "DMODE=RAD"))
                    {
                        rpnStack.setDMode(1);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "DMODE=GRD"))
                    {
                        rpnStack.setDMode(2);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "EMODE=OVR"))
                    {
                        progMem.setEMode(0);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "EMODE=INS"))
                    {
                        progMem.setEMode(1);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "DMODE=SHF"))
                    {
                        progMem.setEMode(2);
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "LX="))
                    {
                        rpnStack.setLabel(0, _text.Substring(3));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "LY="))
                    {
                        rpnStack.setLabel(1, _text.Substring(3));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "LZ="))
                    {
                        rpnStack.setLabel(2, _text.Substring(3));
                        continue;
                    }
                    if (UniversalValue._startsWith_P(_text, "LT="))
                    {
                        rpnStack.setLabel(3, _text.Substring(3));
                        continue;
                    }
                    regAddress = UniversalValue._isRegisterAddress(_text);
                    if (regAddress < Register_Memory.REGISTER_MEMORY_NVALS)
                    {
                        UniversalValue uv = regMem._registerAddress(regAddress);
                        uv.fromString(_text.Substring(4));
                        continue;
                    }
                }
            }// while
            progMem.setCounter(pmemctr);
            extMem.setCounter(ememctr);
            return(false);
        }