vesa bank switching
vesa bank switching
hi,
Can anybody suggest be the correct way to switch bank.
I tried to use funk 05h real mode.
How to do in protected mode.
Can anybody suggest be the correct way to switch bank.
I tried to use funk 05h real mode.
How to do in protected mode.
Re:vesa bank switching
2 options
1. Switch to real mode and use the Vesa Bios funtion either through Int 10h or direct call ( not too good. but only doing this when the ban changes improves things)
2. Use a V86 task. better than switching to real mode
The best is to use VESA 2.0 and LFB modes.
Does any one have better ideas?
1. Switch to real mode and use the Vesa Bios funtion either through Int 10h or direct call ( not too good. but only doing this when the ban changes improves things)
2. Use a V86 task. better than switching to real mode
The best is to use VESA 2.0 and LFB modes.
Does any one have better ideas?
Re:vesa bank switching
..
Last edited by Perica on Tue Dec 05, 2006 9:28 pm, edited 1 time in total.
Re:vesa bank switching
Isn't the protected mode bank switching function dependent on VESA 2.0+ support? (correct me if I'm wrong)
Instead of using that why not use the LFB modes?
Instead of using that why not use the LFB modes?
Re:vesa bank switching
Yes it needs 2.0+ support. Do you have some examples how to use linear frame buffer.Code Slasher wrote: Isn't the protected mode bank switching function dependent on VESA 2.0+ support? (correct me if I'm wrong)
thanks
Re:vesa bank switching
I dont have any code yet, but basically you use the VESA Function that gets VIDEO MODE INFORMATION for the mode you want to use and then in the structure that it generates there is a field that hold the Physical address of the Liner Frame Buffer. It is a 32bit address which you can just write to if you are not using paging or map to a linear address of your choice and use the linear address once paging is on.
Its best to read the VBE3.pdf file for the full details.
Its best to read the VBE3.pdf file for the full details.
Re:vesa bank switching
Here is code for vesa bank swiching (real-mode)
I also have code for vesa 2 linear,For seting up 640x480x24bpp,If you need it ?.
ASHLEY4.
Code: Select all
mov ax,4f02h? ;set vesa 1.0 screen mode
mov bx,101h? ;640*480*256
int 10h
mov dx,0xa000
mov ds,dx? ? ? ? ? ? ? ;sets up registers
call window
rain:
xor dx,dx? ? ? ;(pages-1)
mouse:
push dx
call window
xor bx,bx
mov al, 0cch
call dog
pop dx
cmp dx,4
je rain
inc dx
mov ah,01h
int 16h
jz mouse
mov ax,0003h
int 10h
mov ax,4c00h? ? ? ; This is just
int 21h? ? ? ? ? ? ? ? ; for test ,take it out in your OS
window:
mov ax,4f05h? ? ;vesa 1 window select
mov bx,0
int 10h? ? ? ? ;dx is? the reqired window
xor bx,bx
ret
dog:? ? ? ? ;(4*2^16)+45056 pixels
mov [bx],al
inc bx
cmp bx,$00000
jne dog
ret
ASHLEY4.
Re:vesa bank switching
Thanks,
but i am confused when to switch bank.
I switch bank after 64k mem in a000 is full. But how to know which bank to switch.
I did it like this.
But it will be very slow since i have to switch in every pixel plot.
but i am confused when to switch bank.
I switch bank after 64k mem in a000 is full. But how to know which bank to switch.
I did it like this.
Code: Select all
offset = (HRES * y) + x;
banksize = (modeinfo.wingranularity) * 1024;
bankno = offset / banksize;
offset = offset % banksize;
set_bank(bankno); /* this does a bank switch to bankno */
SVGA[offset] = c_color;
please,ASHLEY4 wrote:
I also have code for vesa 2 linear,For seting up 640x480x24bpp,If you need it ?.
ASHLEY4.
Re:vesa bank switching
No, you dont switch on every pixel
You should store the current bank number (initially it will be zero) in a variable say _bnumber. THen when you calculate the bank number for the pixel you are about to draw compare it to _bnumber. If they are diffent then you switch banks to the new bank number and update _bnumber to the new bank number. if they are the same,just plot the pixel. so if the window gran is 64k you switch only on every 64k pixels (well average is close to that)
You should store the current bank number (initially it will be zero) in a variable say _bnumber. THen when you calculate the bank number for the pixel you are about to draw compare it to _bnumber. If they are diffent then you switch banks to the new bank number and update _bnumber to the new bank number. if they are the same,just plot the pixel. so if the window gran is 64k you switch only on every 64k pixels (well average is close to that)
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:vesa bank switching
iirc, VBE2 has a pmode interface for bank switching (which should be a bit better supported than VBE3's full pmode interface
Re:vesa bank switching
hi,
I found some tutor saying.
"Also, note that attempting to use SVGA with real-mode or *16-bit protected-mode code* will be almost impossible as it is so slow due to the 64k segment size limit. Only 32-bit programs should use SVGA."
http://www.sylpher.com/dosuser/dosgames.htm
is it correct.
I found some tutor saying.
"Also, note that attempting to use SVGA with real-mode or *16-bit protected-mode code* will be almost impossible as it is so slow due to the 64k segment size limit. Only 32-bit programs should use SVGA."
http://www.sylpher.com/dosuser/dosgames.htm
is it correct.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:vesa bank switching
well, 'realmode' programs will indeed have hard time using 1600x1200x32bpp with a 64KB window ... however, if you have no choice, you have no choice
I would rather say this by "if you fear about performance penalties of window switching, do your stuff in protected/unreal mode".
I would rather say this by "if you fear about performance penalties of window switching, do your stuff in protected/unreal mode".
Re:vesa bank switching
Also if you must use it (Vesa1 banked) :'( , Design your gui to use as many X movements and not as many Y movements.
eg: Take a game, If i shoot across the screen, It's the same speed if it's a bank or linear, But if i shoot up the screen its slower, With banked than linear.
I know this is not always possible, But keep it in mined .
ASHLEY4.
eg: Take a game, If i shoot across the screen, It's the same speed if it's a bank or linear, But if i shoot up the screen its slower, With banked than linear.
I know this is not always possible, But keep it in mined .
ASHLEY4.