VESA
Re:VESA
Google for the VBE BIOS specification, first result is www.vesa.org/vbe3.pdf -- read it. Second, either before your OS switches to protected mode, or after if you have Virtual-8086 support, make the call to switch to a video mode of your choosing, being careful to set the "linear framebuffer" bit. By setting up a linear framebuffer, you don't need to bank-switch or resort to any other primitive, 80's style tricks to access video memory.
Re:VESA
You put a 4 at the beginning of the mode number's, so for
"640*480*256" the mode number is 0x101 for bank mode
or 0x4101 for lfb.
You can do this for the mode number's.
To use lfb in pmode (nopaging) you simply do this
ps: this "ModeInfo_PhysBasePtr" is in the vesa_info you should of filled in.
\\\\||////
(@@)
ASHLEY4.
"640*480*256" the mode number is 0x101 for bank mode
or 0x4101 for lfb.
You can do this for the mode number's.
To use lfb in pmode (nopaging) you simply do this
Code: Select all
mov ax,linear_sel
mov es,ax
mov edi,[ModeInfo_PhysBasePtr]
mov ecx, 640*480
mov al,byte[color]
rep stosb
\\\\||////
(@@)
ASHLEY4.
Re:VESA
So i updated in my bootloader to use VESA to this:
VESA:
mov ax, 4F00h
mov bx, 0x1000
mov es, bx
mov di, 0x10
int 10h
mov ax, 0x4F02
mov bx, 0x4118
int 10h
And what about that code that you wrote to me to use in pmode without paging? If I use PMODE, so I have to use that code? And if yes, so where can I find linear_sel , ModeInfo_PhysBasePtr etc. ?
Im using 0x118 vesa mode, maybe thats wrong?
VESA:
mov ax, 4F00h
mov bx, 0x1000
mov es, bx
mov di, 0x10
int 10h
mov ax, 0x4F02
mov bx, 0x4118
int 10h
And what about that code that you wrote to me to use in pmode without paging? If I use PMODE, so I have to use that code? And if yes, so where can I find linear_sel , ModeInfo_PhysBasePtr etc. ?
Im using 0x118 vesa mode, maybe thats wrong?
Re:VESA
Go here: http://board.flatassembler.net/viewtopic.php?t=2301
To my message by me (ASHLEY4) and download
"vesa256.zip" this has full code ,and a bin file put this on the boot sector of a floppy with rawrite etc.
To run the demo.
In the code you will fined the mode numbers for 640*480*256 lfb, put the mode you want in place of that number.
Take a look at the code to see how its done.
and let me know if demo works on you pc.
ps: if you put another mode in, you will need to mod the fill screen with pixals, as in the size of screen x the number of bytes per pixel.
\\\\||////
(@@)
ASHLEY4.
To my message by me (ASHLEY4) and download
"vesa256.zip" this has full code ,and a bin file put this on the boot sector of a floppy with rawrite etc.
To run the demo.
In the code you will fined the mode numbers for 640*480*256 lfb, put the mode you want in place of that number.
Take a look at the code to see how its done.
and let me know if demo works on you pc.
ps: if you put another mode in, you will need to mod the fill screen with pixals, as in the size of screen x the number of bytes per pixel.
\\\\||////
(@@)
ASHLEY4.
Re:VESA
When I chage video mode to 0x4118 and change
mov ecx,640*480/4
to
mov ecx,1024*768/4
it just fills less than half of screen.
That's because there was mistake:
mov ecx,640*480/4 is wrong.
It should be replaced with this:
mov ecx,640*480 I think or somethink similar.
I changed to mov ecx, 1024*768 because I'm using 0x4118
Maybe just my PC was having some problems, or maybe there really was a problem.
BTW, I tested it on Virtual PC.
Thanks, it really helped to me. Can I make some changes on it and integrated it to my OS?
mov ecx,640*480/4
to
mov ecx,1024*768/4
it just fills less than half of screen.
That's because there was mistake:
mov ecx,640*480/4 is wrong.
It should be replaced with this:
mov ecx,640*480 I think or somethink similar.
I changed to mov ecx, 1024*768 because I'm using 0x4118
Maybe just my PC was having some problems, or maybe there really was a problem.
BTW, I tested it on Virtual PC.
Thanks, it really helped to me. Can I make some changes on it and integrated it to my OS?
Re:VESA
Hi thanks for letting me know it works ok.
It may look wrong, but i used a "stosd" to mov a dword, instead of "stosb", if i had used "stosb" then you would be right, but as i am only filling the screen in one color it is quicker to move a dword and divide 640*480 by 4.
Also your problem with only filling half of the screen, is because the demo goes in pmode, you are going over 1mb, so you need to enable A20 to fill rest of screen.
I f you look at my demo for the 512b compo, you will notice that at the bottom is black, i faded it to black to hide the last 1 & 1/2 inch's which was not filled with color because
the a20 was not enabled ( i only had 512 bytes, to get into pmode, with full 24bit vesa graphics, atapi driver, and ipod image, cdplayer, menu ) so no room for A20.
Screenshot here: http://www.falconrybells.co.uk/page2.htm
down load here:
http://512.decard.net/?body=entries
Give it a try, may not work on all pc, some of the code for the demo you down loaded is from it.
\\\\||////
(@@)
ASHLEY4.
Code: Select all
mov [color],0xcccccccc
render_screen:
mov edi,[ModeInfo_PhysBasePtr]
mov ecx,640*480/4
mov eax,[color]
cld
rep stosd ;<*** this is stosd, not stosb
Also your problem with only filling half of the screen, is because the demo goes in pmode, you are going over 1mb, so you need to enable A20 to fill rest of screen.
I f you look at my demo for the 512b compo, you will notice that at the bottom is black, i faded it to black to hide the last 1 & 1/2 inch's which was not filled with color because
the a20 was not enabled ( i only had 512 bytes, to get into pmode, with full 24bit vesa graphics, atapi driver, and ipod image, cdplayer, menu ) so no room for A20.
Screenshot here: http://www.falconrybells.co.uk/page2.htm
down load here:
http://512.decard.net/?body=entries
Give it a try, may not work on all pc, some of the code for the demo you down loaded is from it.
\\\\||////
(@@)
ASHLEY4.
Re:VESA
Forgot to put, yes you may do with it what you like, a mention would be nice () .
This will fill your screen, once A20 is enabled.
My mode in the demo you down loaded was for 256 color's , so it only has 1 byte per pixal, your's vesa mode is for 4 bytes per pixal.
\\\\||////
(@@)
ASHLEY4.
This will fill your screen, once A20 is enabled.
Code: Select all
;*****************************
; render's graphic screen.
;*****************************
mov [color],0xcccccccc
render_screen:
mov edi,[ModeInfo_PhysBasePtr]
mov ecx,1024*768
mov eax,[color]
cld
rep stosd
\\\\||////
(@@)
ASHLEY4.
Re:VESA
OK, going big thanks for you, because you helped me a little
You are using a structure, but I had to erase that structure, because i have kernel, and i couldn't find another way how to do it. I need VESA to work on my kernel too, so I instead of having so much work and using structure, I put all info about VESA to memory, so I can reach that memory from my kernel and work with VESA.
Thanks.
You are using a structure, but I had to erase that structure, because i have kernel, and i couldn't find another way how to do it. I need VESA to work on my kernel too, so I instead of having so much work and using structure, I put all info about VESA to memory, so I can reach that memory from my kernel and work with VESA.
Thanks.
Re:VESA
Problems again :'( .
I was having a break for a week, and now I am continuing on VESA programming.
It doesn't put pixel on the screen.
I am initializeing VESA like this:
I put pixel like this:
What is wrong here? Can someone help me please?
I was having a break for a week, and now I am continuing on VESA programming.
It doesn't put pixel on the screen.
I am initializeing VESA like this:
Code: Select all
VESA:
mov ax, 4f00h
mov bx, 0x1000
mov es, bx
mov di, 0x0FFF
int 10h
cmp ax, 004Fh
jne novesa
mov ax, 4f01h ; set vesa screen mode information
mov bx, 0x1000
mov es, bx
mov di, 0x11FF
mov cx, 0x4118
int 10h
mov ax, 4f02h ; set vesa screen mode
mov bx, 0x4118
int 10h
cmp ax, 004Fh
jne novesa2
jmp PMode
novesa:
mov si, msgNoVesa
call Print
novesa2:
mov si, msgNoVesa2
call Print
Code: Select all
mov eax, [0x111FF+0x28]
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
Re:VESA
Code: Select all
mov eax, [0x111FF+0x28]
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
Your VESA info is going to 0x10FFF, and your mode info is at 0x111FF. Why the unaligned addresses? It might be marginally faster to put them at 0x11000 and 0x11000+sizeof(mode_info).