static void SetVesaMode() { Registers.ES = 0; ushort res = VESA.Resolution; ushort mode = VESA.CGA_Full; if (res > 320) { mode += 3; } if (res > 640) { mode += 3; } if (res > 800) { mode += 3; } if (res > 1024) { mode += 3; } if (res > 1280) { mode += 3; } ushort bpp = VESA.Bpp; while (mode >= VESA.CGA_High) { if (bpp > 16 && VESA.TryMode(mode, VESAInfoAddr, VESAInfoDetailsAddr)) { return; } mode--; if (VESA.TryMode(mode, VESAInfoAddr, VESAInfoDetailsAddr)) { return; } mode -= 2; } // VESA not supported... Registers.DI = VESAInfoAddr; new Inline("mov byte [es:di], 'N'"); VESA.SetVGA(); }
public static bool TryMode(ushort mode, ushort pInfo, ushort pInfoDetails) { if (!VESA.SetMode((ushort)(mode | VESA.LinearMode))) { return(false); } if (!VESA.GetInfo(pInfo)) { return(false); } if (!VESA.GetInfoDetails(mode, pInfoDetails)) { return(false); } return(true); }