How to use framebuffer SVGA in the BIOS?
How to use framebuffer SVGA in the BIOS?
Hey. I apologize for this stupid question.
With the text output in text mode, when working in protected mode, writing 2 bits(character + color) in with 0x000B8000 I figured out. But how do I work in SVGA mode? I want access to pixels or something. To create a drawing. To work, as I understand it, you have in memory from 0x000A0000. How's the recording going? Where to read about it?
With the text output in text mode, when working in protected mode, writing 2 bits(character + color) in with 0x000B8000 I figured out. But how do I work in SVGA mode? I want access to pixels or something. To create a drawing. To work, as I understand it, you have in memory from 0x000A0000. How's the recording going? Where to read about it?
Re: How to use framebuffer SVGA in the BIOS?
hi,
There are some useful links
Drawing In Protected Mode and VESA Video Modes
hope this helped.
First, you'll need to set a video mode. This can be done by grub(https://www.gnu.org/software/grub/manua ... iboot.html for multiboot 1 specification, or https://www.gnu.org/software/grub/manua ... iboot.html for multiboot 2 specification) or can be done by bios int 0x10.mrjbom wrote:But how do I work in SVGA mode?
That's only for VGA Graphics mode, let me explain. In VGA modes, you have memory from 0xB0000-0xB7FFF(monochrome text), 0xB8000-0xBFFFF(color text, the one you were using) and 0xA0000-0xAFFFF(VGA Graphics mode). However, for SVGA there is a framebuffer address, and you won't know the exact address since it might change, for example: the qemu framebuffer address is 0xFD000000, the bochs fb address is 0xE0000000. The address can be given pretty much the same way you'd set a video mode. In grub, you'll pass a flag wich will give you the fb address, or can be also given through the bios int 0x10.mrjbom wrote:To create a drawing. To work, as I understand it, you have in memory from 0x000A0000
There are some useful links
Drawing In Protected Mode and VESA Video Modes
hope this helped.
Re: How to use framebuffer SVGA in the BIOS?
Can I boot into VESA mode? How do I do this with GRUB? What flag for GRUB to specify?
Re: How to use framebuffer SVGA in the BIOS?
b Those are for other flags, which you can see in the mboot specification 1.
Then you have 4 options more. The first one, will indicate grub if it haves to use graphics mode or text mode. put for text mode, and for graphics mode. The next will indicate the width of the video mode, in case of , that means no preference to you. The same goes to the next option, but with the width. and the last option, is the bpp(bits per pixel), wich an zero means no preference(note that all the last 4 options have to be with "dd" and then the value.)
For multiboot 2, you need to declare a separate header wich you'll need to include. The header needs to be declared like this:
And the last three as dd, wich will declare the width, height and bpp. I strongly recommend you to read the specification that i gave you.
btw http://www.ctyme.com/intr/int.htm there you have a page with all the interrupts. in 0x10, search for svga, and you'll have what you can do with the bios int 0x10.
Code: Select all
Well, if you say that you start your computer and instantly you have a video mode, then not. But if you say by setting it up with grub or your own bootloader, then yes.mrjbom wrote:Can I boot into VESA mode?
For grub, it depends what multiboot specification you use. If multiboot one, you'll need to add the 1 << 2 flag, and then below the checksum, you'll need to pass the options for the flag, which are:mrjbom wrote:How do I do this with GRUB?
Code: Select all
dd 0
dd 0
dd 0
dd 0
dd 0
Then you have 4 options more. The first one, will indicate grub if it haves to use graphics mode or text mode. put
Code: Select all
dd 1
Code: Select all
dd 0
Code: Select all
dd 0
For multiboot 2, you need to declare a separate header wich you'll need to include. The header needs to be declared like this:
Code: Select all
dw 5
dw 0
dd 20
btw http://www.ctyme.com/intr/int.htm there you have a page with all the interrupts. in 0x10, search for svga, and you'll have what you can do with the bios int 0x10.
Re: How to use framebuffer SVGA in the BIOS?
I use the first GRUB specification.alberinfo wrote:For grub, it depends what multiboot specification you use. If multiboot one, you'll need to add the 1 << 2 flag
My
Code: Select all
bootloader.asm
Code: Select all
bits 32
section .text
;multiboot spec
align 4
dd 0x1BADB002 ;magic
dd 1 << 2 ;flags
dd - (0x1BADB002 + 1 << 2) ;checksum
dd 0
dd 0
dd 0
dd 0
dd 0
global start
extern kmain
start:
mov ah, 00h
mov al, 13h
int 10h
cli
mov esp, stack_space
call kmain
hlt
section .bss
resb 8192
stack_space:
Code: Select all
no multiboot headers found
What's wrong?
Re: How to use framebuffer SVGA in the BIOS?
well, it seems that you're not putting
see how you do align 4, and then you have a header with all you need. also, the last three lines will set up an 800*600 mode with 8 bpp, but you can use the modes available for vesa.(you can see them into the interrupt list, int 0x10, ax 0x4F02)
this into a header. also, just if you want(it will make your life easier) declare the flags apart, and then use them into the header, so after all it should look like this.mrjbom wrote:dd 0x1BADB002 ;magic
dd 1 << 2 ;flags
dd - (0x1BADB002 + 1 << 2) ;checksum
dd 0
dd 0
dd 0
dd 0
dd 0
Code: Select all
%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 800 ; here you put the width you want
dd 600 ; here you put the height you want
dd 8 ; here you put the bpp you want
Re: How to use framebuffer SVGA in the BIOS?
Great, VESA's on. Now I'm trying to paint the first pixel white. I use QEMU for emulation, its video buffer address is 0xFD000000. I try to record pixels like this800*600 mode with 8 bpp
Code: Select all
byte* vesaaddr = (byte*)0xFD000000;
vesaaddr[0] = 255;
vesaaddr[1] = 255;
vesaaddr[2] = 255;
vesaaddr[3] = 255;
vesaaddr[4] = 255;
vesaaddr[5] = 255;
vesaaddr[6] = 255;
vesaaddr[7] = 255;
Re: How to use framebuffer SVGA in the BIOS?
It doesn't work. In kernel.asm file I put 800x600 32 bbp. I copied the putpixel function and try to call it like this: putpixel(0xFD000000, 1, 1, 0x7800); I should see a red pixel in the top left corner. But I don't see him.
Re: How to use framebuffer SVGA in the BIOS?
well, there are a few things. First: you should fill more part of the screen(first of all, for seeing if all is working). What i normally do for this is so it will fill the screen with the color. if it doesn't work or crashes, then something is wrong. Second:
Code: Select all
memset(fb, color)
i don't know where did you get that red is that color. red is 0xFF0000. https://www.rapidtables.com/web/color/h ... codes.html, into this page you can see pretty much every color you'd want, and search for your own colors. also remember to use the hex value of the color.mrjbom wrote:0x7800
Re: How to use framebuffer SVGA in the BIOS?
No effect it does not.
memset takes three parameters, I tried to use it like this: memset((void*)0xFD000000, 0xFF0000, sizeof(0xFD000000);
memset takes three parameters, I tried to use it like this: memset((void*)0xFD000000, 0xFF0000, sizeof(0xFD000000);
The color I took from here is "Drawing In Protected Mode", The "Color" section provides examples of colors.alberinfo wrote:Code: Select all
memset(fb, color)
alberinfo wrote: Second:i don't know where did you get that red is that color. red is 0xFF0000. https://www.rapidtables.com/web/color/h ... codes.html, into this page you can see pretty much every color you'd want, and search for your own colors. also remember to use the hex value of the color.mrjbom wrote:0x7800
Re: How to use framebuffer SVGA in the BIOS?
Literaly from the page:mrjbom wrote:The color I took from here is "Drawing In Protected Mode", The "Color" section provides examples of colors.
Which means that this is for an 15 bpp modeE.g. you will have xRRRRRGGGGGBBBBB for 15-bits mode, meaning that #ff0000 red is there 0x7800