vesa bank switching
Posted: Sat Jan 10, 2004 12:10 pm
Im implementing a simple qui and using vesa. I set my video mode in my second stage loader and I want to store WinFuncPtr pointer, which holds a pointer to switch bank in protected mode part. But I couldnt manage to do it. I have some problems with pointers I think. Here is what Im doing:
and here is my bank switching code:
But SetBank doesnt work. I think there is a problem in first line but not so sure. Ill be glad if someone check it and help me..
Code: Select all
...
lGetVesaInfo:
mov ax, 0
mov es, ax
mov di, VesaInfo
mov ax, 4F00h
int 10h
cmp AX, 004Fh
jne $
okVESA:
mov ax, 4F02h
mov bx, 115h ; 800*600*24
int 10h
cmp AX, 004Fh
jne $
mov di, ModeInfo
mov ax, 4F01h
mov cx, 115h
int 10h
mov dword eax, [ModeInfo+12]
mov dword [VESA_WINFUNCPTR], eax
...
Code: Select all
void SetBank(unsigned int BankNo)
{
void (*WinFuncPtr)(void) = (void *)VESA_WINFUNCPTR;
__asm__ __volatile__ ("movw %w0, %%bx" : : "rm" (0) );
__asm__ __volatile__ ("movw %w0, %%dx" : : "rm" (BankNo) );
WinFuncPtr();
}