StartsWith() public static method

public static StartsWith ( string str1, ushort str2ptr ) : bool
str1 string
str2ptr ushort
return bool
Exemplo n.º 1
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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static ushort SearchFile(string fn)
        {
            new Inline("push es");
            Registers.ES = FDC.FATSeg;
            ushort ptr = 0, ret = 0;
            string fn2 = FDC.ConvertFileName(fn);

            for (ushort i = 0; i < FDC.RDE; i++, ptr += 0x20)
            {
                if (Str.StartsWith(fn2, ptr))
                {
                    Registers.DI = (ushort)(ptr + 0x1a);                      // start sector
                    new Inline("mov ax, [es:di]");
                    ret = Registers.AX;
                    break;
                }
            }
            new Inline("pop es");
            return(ret);
        }