0

I'm developing a hobby OS ,I want to draw something in vga mode when OS is in protected mode. I'm using the multiboot2 to guide my OS to step in and I setup the VGA as 1024 X 768 X 32 ,then I paint the whole screen like this :

memset ((void *) 0xA0000,0x0F,1024 * 768 * 4); 

but encounted an exception,I found that VGA buffer address starts at 0xA00000 but ends at 0xB0000 ,totally 64K, the whole 1024 * 768 * 32 screen need rather than the 64K buffer.

So,How to fill the whole screent ? Any help would be appreciated ...

true_casey
  • 79
  • 1
  • 11
  • Did you use the BIOS for choosing the video mode or did you do it with a custom routine or not at all (default's `0x3`)? Which one did you choose? What exception do you get? Are you on an emulator? Maybe you need to adjust the video memory size in it. And please improve the look of your question, it has severe formatting lacks. – cadaniluk Aug 01 '16 at 12:01
  • thks for answering, 1.I used the grub2 (multiboot2) to guide my hobby OS in ,i set the VGA working with 1024 * 768 * 32 way,that means i did nothing about the BIOS call. 2.my question is, 0xA0000 to 0xB0000 ,just has 64k bytes ,but 1024 * 768 * 32 needs rather more than 64k 3.there is nothing about whether OS is running on an emulator – true_casey Aug 01 '16 at 12:32
  • I'm a bit unclear about the details. You're running on the bare hardware, right? "i set the VGA working with 1024 * 768 * 32 way" How did you do that? Configured GRUB that way? "i did nothing about the BIOS call" So you didn't use [`ax=0x00/int 0x10`](http://www.ctyme.com/intr/rb-0069.htm) with one of [those](http://www.columbia.edu/~em36/wpdos/videomodes.txt)? If there is any, could you show the code you use to initialize the VGA subystem, i.e., set the resolution, color/monochrome mode, etc., please? – cadaniluk Aug 01 '16 at 12:39
  • This is handled by [VESA VBE](http://flint.cs.yale.edu/cs422/readings/hardware/vbe3.pdf). That document has all the answers you need about windowing the frame buffer. – Margaret Bloom Aug 02 '16 at 07:19
  • thks ,this is what I need , VESA VBE .. – true_casey Aug 03 '16 at 09:46
  • see [Display an array of color in C](https://stackoverflow.com/a/21699076/2521214) and look for `VESApage` you speciffy which page you want to map to `A000:0000` and fill its 64KByte ... then set next page and so on ... But if you are in protected mode or do not/can't use **VESA** interrupts or have **LFB** set on than you need to handle this differently (but that is not my cup of tea). – Spektre Sep 24 '17 at 10:07

0 Answers0