OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:54 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Getting VBE framebuffer location returns 0x0000
PostPosted: Sun Sep 11, 2022 11:07 am 
Offline
Member
Member

Joined: Tue Jun 07, 2022 11:23 am
Posts: 78
Location: France
I've made a little piece of code to get me the location of the framebuffer of VBE 0x100 mode
Code:
[ORG 0x7C00]
[BITS 16]

Main:
    mov di, 0xF000 ; just put the info here
    mov ax, 0x4F01 ;mode
    mov cx, 0x0100 ; video mode number
    int 0x10 ;call

    cmp ax, 0x004F
    jne error ;checks for error

    mov ah, 0x0E ; print mode

    mov al, [0xF000 + 0x28] ; 1st byte of the adress

    and al, 0xF0 ; print 1st char
    shr al, 4
    add al, 0x30
    int 0x10

    mov al, [0xF000 + 0x28]

    and al, 0x0F
    add al, 0x30
    int 0x10

    mov al, [0xF000 + 0x2A]

    and al, 0xF0
    shr al, 4
    add al, 0x30
    int 0x10

    mov al, [0xF000 + 0x2A]

    and al, 0x0F
    add al, 0x30
    int 0x10

error:
    jmp $

times 510 - ($-$$) db 0
dw 0xAA55


I think i made it all good, but on the screen it only displays "0000", am I doing something wrong?

_________________
https://github.com/cheyao/Achieve-Core


Top
 Profile  
 
 Post subject: Re: Getting VBE framebuffer location returns 0x0000
PostPosted: Sun Sep 11, 2022 1:59 pm 
Offline
Member
Member
User avatar

Joined: Thu May 12, 2011 7:24 pm
Posts: 89
The segment registers aren't initialized in your code, so there's no guarantee that the information is stored (relative to es) at the same address you're attempting to read it from (relative to ds).

Your code also only prints two bytes of a four byte address, which is probably not what you intended.

_________________
Those who understand Unix are doomed to copy it, poorly.


Top
 Profile  
 
 Post subject: Re: Getting VBE framebuffer location returns 0x0000
PostPosted: Mon Sep 12, 2022 8:57 am 
Offline
Member
Member

Joined: Tue Jun 07, 2022 11:23 am
Posts: 78
Location: France
Oh so I initialized the registers and I got the frambuffer adress is 0xFD000000 which seems a bit odd, but it works in 16 bit mode. but after switching to 64 bit mode, it dosent work :( Is there some way to get to know why? and is there some documentation of the framebuffer adresses?

_________________
https://github.com/cheyao/Achieve-Core


Top
 Profile  
 
 Post subject: Re: Getting VBE framebuffer location returns 0x0000
PostPosted: Mon Sep 12, 2022 10:42 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
cyao1234 wrote:
but after switching to 64 bit mode, it dosent work :( Is there some way to get to know why?

In 64-bit mode, paging is enabled. Do your page tables have an appropriate mapping for physical address 0xFD000000?

cyao1234 wrote:
and is there some documentation of the framebuffer adresses?

What do you mean? On modern PCs, the firmware assigns physical addresses to PCI BARs before your OS boots, and the linear framebuffer address is derived from one of those BARs. The address can change depending on the hardware and firmware configuration.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], FrankRay78, Google [Bot], SemrushBot [Bot] and 62 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