Page 1 of 1
Vesa Graphics Programming
Posted: Sun Sep 23, 2007 5:01 pm
by gzaloprgm
Hi, I am new in this forum. I am currently making a small OS.
I have already read vesa mode tutorials.
I switch to 800*600*32 Vesa mode in my bootloader, using bios interruptions.
Then I load PMode and A20, and I load my kernel from floppy.
But I don't know how to do bank Switching in PMode, can anyone help me?
Otherwise if I write directly to the memory I can't write in the whole screen.
Please Help me!
Greetings
Gonzalo
Posted: Sun Sep 23, 2007 5:43 pm
by piranha
Make your OS have memory management, task switching, and all of that. Don't even bother with the GUI until the OS can do that, and maybe load a binary file from a floppy.
A GUI is not an OS.
Translation: GUI != OS.
-JL
Posted: Sun Sep 23, 2007 5:50 pm
by OrOS
^ points up. My OS is completly built around a GUI, with the command line loading in that. You want to base it off of a gui instead of jumping right into a command shell, go for it. But he's right, you do need many other things for it to be an 'OS.' Don't lose your priorities.
Re: Vesa Graphics Programming
Posted: Mon Sep 24, 2007 2:42 am
by AJ
gzaloprgm wrote:
But I don't know how to do bank Switching in PMode, can anyone help me?
Hello,
I would suggest using a linear frame buffer instead of attempting to write in banks. To do this, set bit 14 of ax when you call function 0x4F02 and use the physical base pointer in the mode structure to determine where to write.
Your alternatives are:
* Use v86 mode for bank switching (slooooow!).
* Use the VBE protected mode interface, which is optional so you need to have some method of bank switching even if the entry point is not implemented in your BIOS.
Cheers,
Adam
Posted: Mon Sep 24, 2007 11:35 am
by Dex
As AJ as pointed out if you have LFB you should use that, but some cards even new ones, only have bank
.
So in that case, there is away to change bank from PMode in some cards
.
Now i have not tried it myself, but this code does work with some cards, it will also need moding to suite your OS.
Code: Select all
; bankswitch for S3 cards
; Modifying the set_bank -function is mostly enough
; for different Vesa 1.2 setups.
set_bank:
cli
cmp al,[0xfff2]
je retsb
mov [0xfff2],al
push ax
push dx
mov ah,al
mov dx,0x03D4
mov al,0x39
out dx,al
inc dl
mov al,0xA5
out dx,al
dec dl
mov al,6Ah
out dx,al
inc dl
mov al,ah
out dx,al
dec dl
mov al,0x39
out dx,al
inc dl
mov al,0x5A
out dx,al
dec dl
pop dx
pop ax
retsb:
ret
Also this may help, the site a bit slow though.
http://my.execpc.com/~geezer/os/slfb.asm
Posted: Mon Sep 24, 2007 12:08 pm
by gzaloprgm
piranha wrote:Make your OS have memory management, task switching, and all of that. Don't even bother with the GUI until the OS can do that, and maybe load a binary file from a floppy.
Thanks! I know that an OS is much more than a GUI, I just asked for vesa video modes, because I wanna make a Command Line Interface, but in vesa, so I can make high resolution console, use my other fonts, more colors, etcetera. The last thing I'll do is a GUI.
Thanks, I am now writing the switch part.
Posted: Mon Sep 24, 2007 11:33 pm
by os64dev
Well i also have a higher resolution console 90x60 to be precise with my own font, yet it is still in text mode and thus fast and very compatible (if your monitor supports it).
and piranha had a valid point. If you write you vesa commandline and font routines chances are you will have to rewrite them as your OS progresses.
Posted: Wed Sep 26, 2007 12:01 am
by Avarok
If I may guys,
He's saying (I think) he wants to switch the video mode while he's still in 16 bit mode. This is very sensible and rarely used. It allows you to avoid vm86 mode altogether.
So, he's trying to switch to a high resolution graphical video mode and then later when he gets around to writing the GUI, he'll actually start putting stuff on it.
As long as you have a means of debugging, kudos on ya m8. : p
I can't answer your question personally though.
Posted: Wed Sep 26, 2007 1:22 am
by JamesM
This is very sensible and rarely used.
What makes you think it's rarely used? What are all those "Popping into real-mode and back" posts on the forums about then?
Plus, GRUB can do this for you (if you ask it to).
Posted: Wed Sep 26, 2007 1:46 am
by AJ
Avarok wrote:He's saying (I think) he wants to switch the video mode while he's still in 16 bit mode.
gzaloprgm wrote:
I switch to 800*600*32 Vesa mode in my bootloader, using bios interruptions.
...
But I don't know how to do bank Switching in PMode, can anyone help me?
I interpret this as we are already in a VESA mode and PMode and now need to do bank switching (gzaloprgm isn't using a lfb).
I switch VESA modes using v86 and there is no reason why that is any less workable than switching while still in real mode (especially if you are using GRUB).
Cheers,
Adam[/quote]