Page 1 of 1

VESA 2.0 and protected mode

Posted: Sun Jun 17, 2007 12:48 pm
by ComputerPsi
I figured out that I have to use the vesa 4F0A function for video int 10. to get the protected mode version of the bank switch function. My computer supports only the BL=0 version, were all three functions are given in a table at once. More information can be found on the ralf brown's list. Anyway, I tried copying all the code and executing it, but that didn't work.. then I tried executing it right from the VESA video area.. that didn't work either.
I tried looking it up on google.. it seems this function is not known of..
I tried running this in 32-bit protected mode. Anybody know the solution? Anybody every try to do this? I'm in 800x600x256 resultion...

Re: VESA 2.0 and protected mode

Posted: Sun Jun 17, 2007 2:46 pm
by Combuster
ComputerPsi wrote:I tried looking it up on google.. it seems this function is not known of..
Google harder:
http://www.inversereality.org/tutorials ... svesa.html

Unfortunately it uses DPMI but you maybe a comparison will reveal the cause of the bug.

Posted: Sun Jun 17, 2007 5:41 pm
by ComputerPsi
Yeah.. I saw that link already. I tells you how to address the area, but no real example of using it.
..actually I even tried emailing the guy from that link..
Anybody used it before?

Posted: Mon Jun 18, 2007 10:28 am
by ComputerPsi
I'm still trying to figure out why it won't run. The following code copies the VESA protected mode code to "VesaFunctions":

Code: Select all

	cld

	mov ax,0x4f0a
	mov bl,0
	int 0x10       ;CX=Length of code
	cmp al,0x4f
	jnz .VESANotPresent

	push es
	pop ds
	mov si,di
	push cs
	pop es
	mov di,VESAFunctions

	rep movsb
The following code attempts to run the Bank Switching function. The function address is written as the first word (two bytes) of VESAFunctions:

Code: Select all

	mov si,[VESAFunctions]
	add si,VESAFunctions
	call si
For some reason, the system resets on the call command.
I have disassembled the VESA protected mode code my computer gave. It doesn't seem to be accessing any memory dangerously. The current CS is of Ring 0, Executable and Readable. Here is the copy of the Bank Switching code I am trying to run. It seems some command here resets the computer... :

Code: Select all

Taken from C000:5014

0:

24 00 58 00 B2 00 08 00-85 90 1F 90 B4 90 B8 90
18 90 14 90 C0 90 C3 90-C1 90 FF FF FF FF 4D 4C
00 90 00 90 56 52 E8 1A-01 00 00 87 F2 0A FF 75

00000000  skipping 0x24 bytes

Switch Bank:

00000024  56                push esi
00000025  52                push edx
00000026  E81A010000        call 0x145
0000002B  87F2              xchg esi,edx
0000002D  0AFF              or bh,bh
0000002F  7510              jnz 0x41
00000031  668BC6            mov ax,si
00000034  B2B4              mov dl,0xb4
00000036  0ADB              or bl,bl
00000038  740E              jz 0x48
0000003A  B2B8              mov dl,0xb8
0000003C  80FB01            cmp bl,0x1
0000003F  7407              jz 0x48
00000041  5A                pop edx
00000042  5E                pop esi
00000043  66B84F01          mov ax,0x14f
00000047  C3                ret

00000048  D0E0              shl al,1
0000004A  EE                out dx,al
0000004B  42                inc edx
0000004C  42                inc edx
0000004D  FEC0              inc al
0000004F  EE                out dx,al
00000050  5A                pop edx
00000051  5E                pop esi
00000052  66B84F00          mov ax,0x4f
00000056  C3                ret


00000145  50                push eax
00000146  53                push ebx
00000147  51                push ecx
00000148  52                push edx
00000149  57                push edi

0000014A  E800000000        call 0x14f	;EDI=IP
0000014F  5F                pop edi

00000150  662E8B9FCFFEFFFF  mov bx,[cs:edi+0xfffffecf]
00000158  662E8B97D1FEFFFF  mov dx,[cs:edi+0xfffffed1]
00000160  2E8A8FD3FEFFFF    mov cl,[cs:edi+0xfffffed3]
00000167  668BF2            mov si,dx
0000016A  B2E0              mov dl,0xe0
0000016C  66ED              in ax,dx
0000016E  663BC3            cmp ax,bx
00000171  7419              jz 0x18c
00000173  B6FF              mov dh,0xff
00000175  66ED              in ax,dx
00000177  663BC3            cmp ax,bx
0000017A  7509              jnz 0x185
0000017C  B284              mov dl,0x84
0000017E  EC                in al,dx
0000017F  38C8              cmp al,cl
00000181  7409              jz 0x18c
00000183  B2E0              mov dl,0xe0
00000185  FECE              dec dh
00000187  75EC              jnz 0x175
00000189  668BD6            mov dx,si
0000018C  32D2              xor dl,dl
0000018E  668BF2            mov si,dx
00000191  5F                pop edi
00000192  5A                pop edx
00000193  59                pop ecx
00000194  5B                pop ebx
00000195  58                pop eax
00000196  C3                ret
Anybody find anything? I've been trying to figure this thing out for some time now.. :(

Posted: Mon Jun 18, 2007 2:57 pm
by ComputerPsi
Okay.. I figured it out. Nasm made it a far call for some reason. When I type in "call near si" it Nasm gave me a warning, but it worked. :)