Hey.
Based on this page, you can understand that the standard VGA BIOS memory includes VGA 320 * 200 with 256 colors. I have a question, how to use a particular mod? How to write in bit color?
How to work with VGA video mod? How to encode pixels?
Re: How to work with VGA video mod? How to encode pixels?
Little note at first, if you want use graphic mode and you want use BIOS, dont work with VGA, implement VESA, it contain all modes what you need. VGA is good if you want write driver for graphic card, because you can learn a lot about it.
How use particular mode? At first you must make a decision if you want start graphic mode from BIOS, or without BIOS. If you dont want use BIOS, complete code is in http://files.osdev.org/mirrors/geezer/o ... cs/modes.c .
Here is code for writing pixels:
How use particular mode? At first you must make a decision if you want start graphic mode from BIOS, or without BIOS. If you dont want use BIOS, complete code is in http://files.osdev.org/mirrors/geezer/o ... cs/modes.c .
Here is code for writing pixels:
Code: Select all
void write_vga_pixel(uint32_t line, uint32_t column, uint8_t color) {
uint8_t *vga_memory = (uint8_t *) 0xA0000;
uint32_t offset=0;
offset=( (line*320) + column);
vga_memory[offset]=color;
}
Re: How to work with VGA video mod? How to encode pixels?
How to use it working in BIOS?Klakap wrote:Little note at first, if you want use graphic mode and you want use BIOS, dont work with VGA, implement VESA, it contain all modes what you need. VGA is good if you want write driver for graphic card, because you can learn a lot about it.
How use particular mode? At first you must make a decision if you want start graphic mode from BIOS, or without BIOS. If you dont want use BIOS, complete code is in http://files.osdev.org/mirrors/geezer/o ... cs/modes.c .
Here is code for writing pixels:Code: Select all
void write_vga_pixel(uint32_t line, uint32_t column, uint8_t color) { uint8_t *vga_memory = (uint8_t *) 0xA0000; uint32_t offset=0; offset=( (line*320) + column); vga_memory[offset]=color; }
Re: How to work with VGA video mod? How to encode pixels?
You must be in real mode and use assembler:
And you are in graphic mode.
Code: Select all
mov ah, 0 ;BIOS VGA mode interrupt
mov al, 0x13 ;320x200x8 bpp graphic mode
int 0x10 ;call bios interrupt
Re: How to work with VGA video mod? How to encode pixels?
As far as I know, GRUB loads my kernel into protected mode right away. Is that right? How do I then use 320x200x8bpp graphic mode?Klakap wrote:You must be in real mode and use assembler
Re: How to work with VGA video mod? How to encode pixels?
You'd have to drop back to real mode. If you are using GRUB it can initialise the framebuffer for you.
Honestly all of the BIOS stuff is going away. You might be better off using UEFI if you plan to write your kernel in long mode.
Honestly all of the BIOS stuff is going away. You might be better off using UEFI if you plan to write your kernel in long mode.