Exemplo n.º 1
0
        private static void DataByteHandler(string bytesIn)
        {
            string[] bytes = bytesIn.Split(',');
            foreach (string db in bytes)
            {
                string data = db.Trim();
                if (CPUDef.isString(data)) // handle strings
                {
                    data = data.Substring(1, data.Length - 2);
                    foreach (char c in data)
                    {
                        fileOutMemory.Add(Convert.ToByte(c));
                        currentAddr++;
                    }
                }
                else
                {
                    ExprResult res = ResolveExpr(data);
                    if (res.undefinedSymbs.Count == 0)
                    {
                        fileOutMemory.Add((byte)res.Result);
                    }
                    else
                    {
                        fileOutMemory.Add(0);
                        ushort         position = (ushort)(currentAddr - originAddr);
                        UnresolvedExpr expr     = new UnresolvedExpr
                        {
                            Position         = position,
                            Type             = SymbolType.BYTE,
                            addrMode         = CPUDef.AddrModes.NO,
                            NbrUndefinedSymb = res.undefinedSymbs.Count,
                            Expr             = data
                        };

                        unsolvedExprList.Add(position, expr);

                        foreach (string symb in res.undefinedSymbs)
                        {
                            UnresolvedSymbol unResSymb = new UnresolvedSymbol();
                            unResSymb.DependingList = new List <string>();
                            unResSymb.ExprList      = new List <ushort>();
                            unResSymb.ExprList.Add(position);
                            AddUnsolvedSymbol(symb, unResSymb);
                        }
                    }

                    currentAddr++;
                }
            }
        }