OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Aug 25, 2019 11:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to set the screen resolution in the loader, which is on
PostPosted: Tue Jul 30, 2019 2:59 am 
Offline

Joined: Sun Jul 21, 2019 7:34 am
Posts: 20
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?


Top
 Profile  
 
 Post subject: Re: How to set the screen resolution in the loader, which is
PostPosted: Tue Jul 30, 2019 3:11 am 
Offline
Member
Member
User avatar

Joined: Mon Jul 13, 2009 5:52 am
Posts: 98
Location: Denmark
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
}


Top
 Profile  
 
 Post subject: Re: How to set the screen resolution in the loader, which is
PostPosted: Tue Jul 30, 2019 3:20 am 
Offline

Joined: Sun Jul 21, 2019 7:34 am
Posts: 20
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
}


Top
 Profile  
 
 Post subject: Re: How to set the screen resolution in the loader, which is
PostPosted: Tue Jul 30, 2019 3:56 am 
Offline

Joined: Sun Jul 14, 2019 4:27 pm
Posts: 21
https://www.gnu.org/software/grub/manua ... der-layout

Looking at that unset flags 2.


Top
 Profile  
 
 Post subject: Re: How to set the screen resolution in the loader, which is
PostPosted: Fri Aug 02, 2019 7:31 am 
Offline

Joined: Sat Jul 06, 2019 3:24 pm
Posts: 4
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group