Re: vesa. vga, graphics in general
Posted: Thu Sep 04, 2008 4:06 am
interesting. Would that mean that other newer cards also support this? What about GF8800 ? Is there somewhere a database?
The Place to Start for Operating System Developers
http://f.osdev.org/
So we can then safely assume other nVidia cards have it as well. Now, if ATi would also support it (anyone care to check? :)), it could be a useable alternative to plain VESA VBE.Jeko wrote:NVIDIA GeForce 6600
There is a small problem. My NVIDIA card says that it supports VBE/AF (version 1 or 1.1 I don't remember), but I don't tried it, so there can be problems with the implementation.jal wrote:So we can then safely assume other nVidia cards have it as well. Now, if ATi would also support it (anyone care to check? ), it could be a useable alternative to plain VESA VBE.Jeko wrote:NVIDIA GeForce 6600
JAL
Yeah, I was too lazy to mention that in my previous post, but that thought did cross my mind. So, what are you waiting for, go try it out! *cough* :)Jeko wrote:There is a small problem. My NVIDIA card says that it supports VBE/AF (version 1 or 1.1 I don't remember), but I don't tried it, so there can be problems with the implementation.
I wish...Dex wrote:for this we would be best working together
Code: Select all
;----------------------------------------------------;
; BuffToScreen. ;Puts whats in the buffer to screen ;
;----------------------------------------------------;
BuffToScreen:
cmp [ModeInfo_BitsPerPixel],24
jne Try32
call BuffToScreen24
jmp wehavedone24
Try32:
cmp [ModeInfo_BitsPerPixel],32
jne wehavedone24
call BuffToScreen32
wehavedone24:
ret
;----------------------------------------------------;
; BuffToScreen24 32bpp ;
;----------------------------------------------------;
BuffToScreen32:
pushad
push es
mov ax,8h
mov es,ax
mov edi,[ModeInfo_PhysBasePtr]
mov esi,VesaBuffer
xor eax,eax
mov ecx,eax
mov ax,[ModeInfo_XResolution]
mov cx,[ModeInfo_YResolution]
mul ecx
mov ecx,eax
cld
cli
rep movsd
sti
pop es
popad
ret
;----------------------------------------------------;
; BuffToScreen24 24bpp ;
;----------------------------------------------------;
BuffToScreen24:
pushad
push es
mov ax,8h
mov es,ax
xor eax,eax
mov ecx,eax
mov ebx,eax ;ccc
mov ax,[ModeInfo_YResolution]
mov ebp,eax
lea eax,[ebp*2+ebp]
mov edi,[ModeInfo_PhysBasePtr]
mov esi,VesaBuffer
cld
.l1:
mov cx,[ModeInfo_XResolution]
shr ecx,2
.l2:
mov eax,[esi] ;eax = -- R1 G1 B1
mov ebx,[esi+4] ;ebx = -- R2 G2 B2
shl eax,8 ;eax = R1 G1 B1 --
shrd eax,ebx,8 ;eax = B2 R1 G1 B1
stosd
mov ax,[esi+8] ;eax = -- -- G3 B3
shr ebx,8 ;ebx = -- -- R2 G2
shl eax,16 ;eax = G3 B3 -- --
or eax,ebx ;eax = G3 B3 R2 G2
stosd
mov bl,[esi+10] ;ebx = -- -- -- R3
mov eax,[esi+12] ;eax = -- R4 G4 B4
shl eax,8 ;eax = R4 G4 B4 --
mov al,bl ;eax = R4 G4 B4 R3
stosd
add esi,16
loop .l2
sub ebp,1
ja .l1
pop es
popad
ret
This code has a bug - there's no guarantee that all pixels are visible. For example, the video display memory might be arranged as 1024 pixels wide where only the first 800 pixels are sent to the monitor. This is why the VBE mode information structure tells you the number of bytes per scanline.Dex wrote:Here is the test program, it runs on DexOS to use it get DexOS from my site and use the program in the below zip (FpsTest.dex).
Code: Select all
movzx ebx, word [ModeInfo_YResolution]
mov edx, [ModeInfo_PhysBasePtr]
movzx ebp,word [ModeInfo_XResolution]
movzx eax, word [ModeInfo_LinBytesPerScanLine]
mov esi, VesaBuffer
.nextLine:
mov ecx, ebp
mov edi, edx
rep movsd
add edx, eax
sub ebx, 1
ja .nextLine
Code: Select all
BuffToScreen:
cmp byte [bufferChangedFlag], 0 ;Did the buffer change since last time?
je .done ; no, skip it
; ** other stuff **
mov byte [bufferChangedFlag], 0
.done:
ret
Code: Select all
xor ebx, ebx ;ebx = current screen line
mov edx, [ModeInfo_PhysBasePtr]
movzx ebp,word [ModeInfo_XResolution]
movzx eax, word [ModeInfo_LinBytesPerScanLine]
mov esi, VesaBuffer
.nextLine:
btr dword [lineModifiedFlags], ebx ;Was the screen line modified?
jnc .skipLine ; no, skip it completely
mov ecx, ebp
mov edi, edx
rep movsd
.skipLine:
add edx, eax
inc ebx
cmp ebx, word [ModeInfo_YResolution]
jb .nextLine
Code: Select all
mov eax, [sourceBuffer + edx]
cmp [changeBuffer + edx],eax ;Has this dword changed?
je .skip ; no, don't need to update video display memory
mov [changeBuffer + edx],eax ;Update the change buffer
mov [videoDisplayMemory + edx],eax ;Update the video display memory
.skip:
add edx,4
Code: Select all
mov eax, [sourceBuffer + edx]
mov ebx, [sourceBuffer + edx + 4]
mov ecx, [sourceBuffer + edx + 8]
mov ebp, [sourceBuffer + edx + 12]
cmp [changeBuffer + edx],eax ;Has this dword changed?
je .skip1 ; no, don't need to update video display memory
mov [changeBuffer + edx],eax ;Update the change buffer
mov [videoDisplayMemory + edx],eax ;Update the video display memory
.skip1:
cmp [changeBuffer + edx + 4],ebx ;Has this dword changed?
je .skip2 ; no, don't need to update video display memory
mov [changeBuffer + edx + 4],ebx ;Update the change buffer
mov [videoDisplayMemory + edx + 4],ebx ;Update the video display memory
.skip2:
cmp [changeBuffer + edx + 8],ecx ;Has this dword changed?
je .skip3 ; no, don't need to update video display memory
mov [changeBuffer + edx + 8],ecx ;Update the change buffer
mov [videoDisplayMemory + edx + 8],ecx ;Update the video display memory
.skip3:
cmp [changeBuffer + edx + 12],ebp ;Has this dword changed?
je .skip4 ; no, don't need to update video display memory
mov [changeBuffer + edx + 12],ebp ;Update the change buffer
mov [videoDisplayMemory + edx + 12],ebp ;Update the video display memory
.skip4:
add edx,16
Code: Select all
if(videoBufferSize * 32 < totalRamSize) useNormalMethod();
else useChangeBufferMethod();