GetLength() public static method

public static GetLength ( string str1 ) : ushort
str1 string
return ushort
Exemplo n.º 1
0
        private static string ConvertFileName(string fn)
        {
            ushort len = Str.GetLength(fn);

            Registers.SI = (ushort)(StringPtr.Get(fn) + 1);
            Registers.DI = (ushort)(StringPtr.Get(buffer) + 1);
            for (ushort i = 0; i < 11; i++)
            {
                new Inline("mov byte [cs:di], ' '");
                Registers.DI++;
            }
            Registers.DI = (ushort)(StringPtr.Get(buffer) + 1);
            for (ushort i = 0; i < len; i++)
            {
                new Inline("mov al, [cs:si]");
                Registers.AH = 0;
                Registers.SI++;
                char ch = (char)Registers.AX;
                if (ch == '.')
                {
                    Registers.DI = (ushort)(StringPtr.Get(buffer) + 9);
                }
                else
                {
                    new Inline("mov [cs:di], al");
                    Registers.DI++;
                }
            }
            return(buffer);
        }
Exemplo n.º 2
0
        static void ReadConfig(string config)
        {
            ushort size = ReadFile(ConfigSeg, config);

            if (size == 0)
            {
                Console.WriteLine("Default settings will be applied.");
                return;
            }

            Registers.ES = 0;
            Registers.DI = SizeAddr;
            Registers.AX = size;
            new Inline("mov [es:di], ax");
            Registers.AX = 0;
            new Inline("mov [es:di+2], ax");

            size        *= 512;
            Registers.ES = ConfigSeg;
            for (ushort ptr2 = 0; ptr2 < size;)
            {
                if (Str.StartsWith("VESA_RESOLUTION=", ptr2))
                {
                    ushort n = Str.ReadNumber((ushort)(ptr2 + Str.GetLength("VESA_RESOLUTION=")));
                    if (n > 0)
                    {
                        VESA.Resolution = n;
                    }
                }
                else if (Str.StartsWith("VESA_BPP=", ptr2))
                {
                    ushort n = Str.ReadNumber((ushort)(ptr2 + Str.GetLength("VESA_BPP=")));
                    if (n > 0)
                    {
                        VESA.Bpp = n;
                    }
                }

                while (ptr2 < size)
                {
                    Registers.DI = ptr2;
                    new Inline("mov al, [es:di]");
                    new Inline("mov ah, 0");
                    ushort ch = Registers.AX;
                    ptr2++;
                    if (ch == '\r' || ch == '\n')
                    {
                        break;
                    }
                }
            }
        }