OSDev.org
https://forum.osdev.org/

How to set the screen resolution in the loader, which is on
https://forum.osdev.org/viewtopic.php?f=1&t=33799
Page 1 of 1

Author:  mrjbom [ Tue Jul 30, 2019 2:59 am ]
Post subject:  How to set the screen resolution in the loader, which is on

Hey.
I have a question about how to use not a fixed screen resolution in my loader, but depending on the size of the monitor.
My bootloader looks like this:
Code:
bits 32

%define MULTIBOOT_MAGIC 0x1BADB002
%define MULTIBOOT_FLAGS (1<<0 | 1<<1 | 1<<2)

section .text
align 4
multiboot_header:
    dd MULTIBOOT_MAGIC
    dd MULTIBOOT_FLAGS
    dd -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS)
    dd 0
    dd 0
    dd 0
    dd 0
    dd 0
    dd 0
    dd 1280 ; width
    dd 1024 ; height
    dd 32 ; bbp

global start
extern main

start:
  cli
  mov esp, stack_space
  push ebx
  push eax
  call main
  hlt

section .bss
resb 8192
stack_space:


Can I do that? And how?

Author:  zity [ Tue Jul 30, 2019 3:11 am ]
Post subject:  Re: How to set the screen resolution in the loader, which is

As far as I know, this is not possible (please correct me if I am wrong).

However, you can set the resolution in the grub configuration file, such that you don't have to recompile the code to change the resolution.

Code:
menuentry "Kernel" {
   multiboot /boot/kernel.bin
   set gfxpayload=1024x768x32
   boot
}

Author:  mrjbom [ Tue Jul 30, 2019 3:20 am ]
Post subject:  Re: How to set the screen resolution in the loader, which is

How do I change the loader on the assembler in this case?

zity wrote:
As far as I know, this is not possible (please correct me if I am wrong).

However, you can set the resolution in the grub configuration file, such that you don't have to recompile the code to change the resolution.

Code:
menuentry "Kernel" {
   multiboot /boot/kernel.bin
   set gfxpayload=1024x768x32
   boot
}

Author:  GMorgan [ Tue Jul 30, 2019 3:56 am ]
Post subject:  Re: How to set the screen resolution in the loader, which is

https://www.gnu.org/software/grub/manua ... der-layout

Looking at that unset flags 2.

Author:  loonie [ Fri Aug 02, 2019 7:31 am ]
Post subject:  Re: How to set the screen resolution in the loader, which is

One of the bios interrupts gives you info about monitor. I just don't remember which. Its something related to DDC (Display Data Channel). There used to be several pdf versions (on the google) of docs describing precise return format.
You should find what you need in ralf brown interrupt list.
Monitor size they give there is in millimeters or even centimeters - which means heavily rounded, but better than nothing.

However, for modern monitor + videocard you simply take highest resolution returned by VBE and that'll be native resolution. Instead, screen size is valuable mainly to calculate size of GUI elements.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/