| Author |
| Thread |
 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
VBE (vesa 3)
This topic is not relative to FASM (the best !) but I think somebody here can help me.
The problem:
in real mode I try to commute a integrated graphic card (onbord on ASRockP4VM890) to 0x4155 mode (LFB).
the 0x04f01 function tell me that this mode is supported ;
the 0x04f02 function return OK with bx=0x4155 ;
but nothing happened and
the 0x04f03 fucntion return OK with bx=0x0155 (no LFB !).
Can you tell me somethings about that ?
Thanks and have a good 2008 year.
|
15 Jan 2008, 12:43 |
|
Dex4u
Joined: 08 Feb 2005
Posts: 1564
Location: web
|
I have a vesa demo, put your mode and see what happens.
http://www.dex4u.com/demos/VesaDemo.zip
Last edited by Dex4u on 23 Feb 2008, 14:21; edited 1 time in total
|
15 Jan 2008, 13:57 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
does 4F01 tell you that mode is supported with LFB? In other words, is bit 7 of ModeAttributes set?
|
15 Jan 2008, 14:54 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
Thanks, I try it 3 days ago, the mode is OK, the LFB bit is OK, all is in order, but my simply code wont works.
I try other modes vith b14 : it's the same, the commutation of line*pixel is ok but the b14 is clear in the result mode and there is no LFB !
I wait the answer of ASRock ... for a long time !
|
15 Jan 2008, 14:56 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
in Mode Description structure returned by 4F01?
by the way, you shouldn't use fixed mode numbers, those are deprecated. you should list available modes and pick one of those.
|
15 Jan 2008, 15:00 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
Yes, and no ! i have make a typographic error, bit7 (NOT b14) in 'ModeAttributes' (= 0xb9) if bx=0x4115 (or 0x4122, 0x4118 ...)
in the list there is no mode with b14 only without b14
but 0x4f02 return OK (0x004F), in the list there where exotics modes since 0x211 0x20F ... perheaps 16/9 resolutions?
|
15 Jan 2008, 16:09 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
I think your bug is calling 4F01 with 0x4115 as mode number. Mode number is only 0x0115, those upper bits are specific for 4F02, etc...
|
15 Jan 2008, 16:19 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
Ok 'vid' but is the same because if I try 0x4f01 and bx=0x115 ModeAttributes' = 0xb9 mean that's ok for LFB even so 0x4f02 (bx=0x4115) switch only on 0x115
|
15 Jan 2008, 16:47 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
Then i quess your VESA doesn't support LFB, and it is faulty VBE implementation for fixed mode numbers. You shouldn't use them anyway - list available modes.
btw, what is your VESA version?
|
15 Jan 2008, 17:10 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
thanks 'vid' for you interest : probabily the graphic-bios is faultly. ( vesa 3 )
but i see that SG3 cards have others modes and another liste before the first normal one.
tante grazie Mauretto tuo utilitario è ottimo, ma, è sempré la stessa cosà : modo 0x0115, OK LFB OK pero cummutazione NO !
(fa per me un'imbraccio al'ermo di Verdi al' pincio !)
|
15 Jan 2008, 21:10 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
can you post the code?
|
15 Jan 2008, 21:54 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
it's a part of my init sequence (is for a lab analyser)
comments are in French but easy to understand
Code: |
|
;>>>>>>>>>>>>>>>>>>> mode graphique <<<<<<<<<<<<<<<<<<<<<<<<<<<
push 0
pop es ; utile ? déjà 0
mov di, ADR_PILE_INIT - 0x500 ; un tampon de 512 octets en haut de la pile
mov [es:di], dword 'VBE2'
mov ax, 0x4f00 ; test VBE (vesa étendu)
int 0x10
cmp ax, 0x004f
jne .erreur
xor eax, eax
mov eax, [es:di + 0x0a] ; capacités générales du controleur
mov [fs:VBE_capa1], al
mov ax, [es:di + 0x12] ; taille mémoire vidéo en bloc de 64 k.
mov [fs:VBE_nbBloc], ax
mov ax, [es:di + 34]
mov eax, [es:di + 0x0e] ; table des modes vidéo - terminée par 0xFFFF avec une seconde aprés pour les S3
cmp eax, 0
je .PMID
mov esi, eax
and esi, 0xffff
shr eax, 16
mov [fs:VBE_Modes], eax
PMID:
mov edi, 0
push word 0xc000
pop es
mov ecx, 0x8000
; mov al,'P'
mov eax, 'PMID'
cld
@@:
repne scasb
jcxz .erreur
cmp dword [es:edi-1], eax
jne @B
dec edi
; verifier checksum
; jne @B
; ici la structure est trouvée a es:di
xor eax, eax
mov ax, [es:edi + 10]
mov [fs:VBE_SegEcr], ax
push 0
pop es
mov cx, 0x4115 ; 0x112 640*480*32b - 0x115 800*600*32b - 0x118 1024*768*32b - 0x11b 1280*1024*32
mov ax, 0x4f01 ; test VBE (vesa étendu)
int 0x10
cmp ax, 0x004f
jne .erreur
mov ax, [es:di + 0x00] ; capacités controleur pour ce mode
mov [fs:VBE_capa2], ax
mov al, [es:di + 0x02] ; capacité fenetre 1
mov [fs:VBE_capaFen1], al
mov al, [es:di + 0x03] ; capacité fenetre 2
mov [fs:VBE_capaFen2], al
mov ax, [es:di + 0x04] ; alignement obligatoire des adresses de fenetres
mov [fs:VBE_aligneFen], word ax
mov ax, [es:di + 0x06] ; taille mémoire fenetre
mov [fs:VBE_tailleFen], word ax
mov ax, [es:di + 0x08] ; segment fenetre 1
mov [fs:VBE_segmentFen1], word ax
mov ax, [es:di + 0x0a] ; segment fenetre 2
mov [fs:VBE_segmentFen2], word ax
xor eax, eax
mov ax, [es:di + 0x10] ; nombre d'octet par ligne-mémoire (different résolution x)
mov [fs:VBE_nbOctetLigne], word ax
mov ax, [es:di + 0x12] ; largeur
mov [fs:VBE_largeur], word ax
mov ax, [es:di + 0x14] ; hauteur
mov [fs:VBE_hauteur], word ax
movzx eax, byte [es:di + 0x19] ; nombre de bits par pixel
mov [fs:VBE_nbBitPixel], al
mov al, [es:di + 0x1d] ; nombre de pages dans la mémoire vidéo
mov [fs:VBE_nbPage], al
mov eax, [es:di + 40] ; adresse LFB ATTENTION en fait selecteur sur octets 3 et 2 déplacement sur octets 0 et 1
mov ebx, eax
and ebx, 0xffff
mov ax, 0
shr eax, 12
add eax, ebx
mov [fs:VBE_adrVideo], dword eax
mov eax, [es:di + 0x2c] ; adresse "offscreen"
mov [fs:VBE_adrVideo2], dword eax
mov ax, [es:di + 0x30] ; taille "offscreen"
mov [fs:VBE_tailleVideo2], word ax
mov ax, [es:di + 0x32] ; nombre d'octet par ligne-mémoire (different résolution x) LINEAIRE
mov [fs:VBE_nbOctetLigneL], word ax
mov al, [es:di + 0x35] ; nombre de pages dans la mémoire vidéo LINEAIRE
mov [fs:VBE_nbPageL], al
mov eax, [es:di + 0x4d] ; vitesse maxi rafraichissement
mov [fs:VBE_vitesseVideo], dword eax
mov ax, 0x4f0a
xor bx, bx
int 0x10
cmp ax, 0x004f
jne .erreur
mov eax, 0
mov ax, es ; segment en mode réel
shl eax, 4
movzx ebx, di ; déplacement
add eax, ebx ; l'adresse réelle (physique) de la table du mode protégé
mov bx, [es:di] ; le déplacement dans la table pour la fonction 5
add ebx, eax ; l'adresse réelle (physique) de la fonction 5
mov [fs:VBE_adrFct5], dword ebx
movzx ebx, word [es:di + 2]
add ebx, eax
mov [fs:VBE_adrFct7], dword ebx
movzx ebx, word [es:di + 4]
add ebx, eax
mov [fs:VBE_adrFct9], dword ebx
movzx ebx, word [es:di + 6]
cmp ebx, 0
je @F
add ebx, eax
@@: mov [fs:VBE_adrTableES], dword ebx
mov esi, mess_10
mov ax, 0x4f03 ; trouver le mode actuel
int 0x10
cmp ax, 0x004f
jne .erreur
movzx eax, bx ; conserver le mode actuel
push bx
mov bx, 0x4115 ; 0x112 640*480*32b - 0x115 800*600*32b - 0x118 1024*768*32b - 0x11b 1280*1024*32 + b14 = LINEAIRE
; voir b15 pour effacer ?
mov ax, 0x4f02 ; changer le mode
int 0x10
cmp ax, 0x004f
jne .erreur
mov ax, 0x4f03 ; vérifier le mode
int 0x10
cmp ax, 0x004f
jne .erreur
mov esi, mess_12
bt bx, 14
jnc .erreur
mov esi, mess_11
cmp bx, 0x4115
jne .erreur
pop bx
;>>>>>>>>>>> Passage en mode protégé 32 bits <<<<<<<<<<<<<<<<<<
modeP:
sidt [fs:SYS_anciennesIT]
cli ; inhiber toutes les IT
cld
mov al, 255 ; masquer toutes les IT
out 0xa1,al ; 8259A controleur d'interuptions
out 0x21,al
|
|
|
15 Jan 2008, 22:54 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
looks allright... i am afraid it's really VESA bug
btw: shouldn't you check VESA version too, to make code generic?
|
15 Jan 2008, 23:00 |
|
DOS386
Joined: 08 Dec 2006
Posts: 1671
|
If you have DOS available you can check my VESA code :
http://board.flatassembler.net/download.php?id=3915 (46 KiB)
(LFB only !!! If you get graph with it then you have a LFB)
And YES, you should avoid "fixed" mode numbers.
Last edited by DOS386 on 26 Aug 2008, 04:44; edited 1 time in total
|
16 Jan 2008, 01:34 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
Thanks 'dos386' but I hven't DOS, I thinks the problem is an exotic (or secret !) implementation of this vesa-BIOS.
Ok 'vid' it's true but my job is to works on this card only (industrial application)
|
16 Jan 2008, 09:47 |
|
DOS386
Joined: 08 Dec 2006
Posts: 1671
|
Stabia wrote: |
|
but I haven't DOS, I thinks the problem is an exotic
|
|
Maybe ... but existing code verified to work with ATI, NVIDIA and BOCHS could reveal something ...
DOS (write .IMG on a floppy, delete GAMES and MEDIA, add my VESA.EXE, boot, press [0] 2x , "VESA" -> BOOM 
_________________ Bug Nr.: 12345
Title: Hello World program compiles to 100 KB !!!
Status: Closed: NOT a Bug
|
16 Jan 2008, 11:23 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
Quote: |
|
Ok 'vid' it's true but my job is to works on this card only (industrial application)
|
|
bad for you - looks like your card BIOS doesn't support LFB. There are still "tricks to get around", but i'm not sure if i'd use them in realworld app.
|
16 Jan 2008, 18:39 |
|
Stabia
Joined: 15 Jan 2008
Posts: 9
Location: Toulouse (France)
|
I have make some progress : in real mode this card dont share more than 64 k.
At this time I perfom following operations :
- switch on proteted mode
- copy image BIOS
- found "DPMI"
- create some descriptors like in VBE doc. page 21-24
but there is a problem vhen I call the init function (il things is a descriptor fault ?)
my code (comments in French, if you want I can translate) :
Code: |
|
;>>>>>>>>>>> Passage en mode protégé 32 bits <<<<<<<<<<<<<<<<<<
modeP:
sidt [fs:SYS_anciennesIT] ; à quoi ca sert de conserver les IT ?
cli ; inhiber toutes les IT
cld
mov al, 255 ; masquer toutes les IT
out 0xa1,al ; 8259A controleur d'interuptions
out 0x21,al
@@: in al, 0x64
test al, 2
jnz @B
mov al, 0xd1
out 0x64, al ; 8042 clavier : activer 'ligne A20'
@@: in al, 0x64
test al, 2
jnz @B
mov al, 0xdf
out 0x60, al
@@: in al, 0x64
test al, 2
jnz @B
mov al, 0xff
out 0x64, al
lgdt [cs:tmp_gdt]
mov eax, cr0
or eax, 1 ; mode protégé
and eax, 0x1fffffff ; efface b30 = cache en marche b29 ? efface b31 = pas de pagination
mov cr0, eax
jmp pword 0x8:modeProtege ; saut vers le 32 bit protégé avec cs = 0x8
align 8
tmp_gdt:
dw 0x40-1 ; longeur de la table - 1
dd tmp_gdt ; adresse physique de la table
dw 0 ; rien, ces 8 octets sont en fait l'indice [0] de la table qui
; ... n'est pas utilisé dans les descripteurs : pour laisser la
; ... possibilité d'un registre de segment à 0
; sel 0x08
dw 0xffff ; limite 0-15
dw 0x0000 ; base 0-15
db 0x00 ; base 16-23
dw 11001111b *256 + 10011010b ; P=1 | DPL=00 | S=1 code ou data | type = 1010 code execute lire
; G=1 : 4Ko. | D=1 : 32 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 1111
db 0x00 ; base 24-31
; sel 0x10
dw 0xffff
dw 0x0000
db 0x00
dw 11001111b *256 + 10010010b ; P=1 | DPL=00 | S=1 code ou data | type = 0010 data écrire lire
; G=1 : 4Ko. | B=1 : 32 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 1111
db 0x00
; sel 0x18
vbe_copie: ; 100000 0x8000 VOIR 'vbe_code'
dw 0x8000
dw 0x0000
db 0x010
dw 01000000b *256 + 10010010b ; P=1 | DPL=00 | S=1 code ou data | type = 0010 data écrire lire
; G=0 : 1o. | B=1 : 32 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 0000
db 0x00
; sel 0x20
vbe_data: ; 108000 0x600
dw 0x600
dw 0x8000
db 0x010
dw 01000000b *256 + 10010010b ; P=1 | DPL=00 | S=1 code ou data | type = 0010 data écrire lire
; G=0 : 1o. | B=1 : 32 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 0000
db 0x00
; sel 0x28
vbe_pile: ; 108600 0x400
dw 0x400
dw 0x8600
db 0x010
dw 00000000b *256 + 10010010b ; P=1 | DPL=00 | S=1 code ou data | type = 0010 data écrire lire
; G=0 : 1o. | B=0 : 16 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 0000
db 0x00
; sel 0x30
vbe_code: ; 100000 0x8000 VOIR 'vbe_copie'
dw 0x8000
dw 0x0000
db 0x010
dw 00000000b *256 + 10011010b ; P=1 | DPL=00 | S=1 code ou data | type = 1010 code execute lire
; G=0 : 1o. | B=0 : 16 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 0000
db 0x00
; sel 0x38
vbe_ecran: ; 108a00 ; 800*600*4 1 920 000 0x1D4C00 1 875 Ko. / 4 = 0x1d5
dw 0x1d5
dw 0x8a00
db 0x010
dw 11000000b *256 + 10010010b ; P=1 | DPL=00 | S=1 code ou data | type = 0010 data écrire lire
; G=1 : 4Ko. | B=1 : 32 bits | L=0(pas 64 bits!) | AVL=0 | limite 16-19 = 0000
db 0x00
; sel 0x40
;>>>>>>>>>>>>>>>>>>>>>> CODE 32 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
use32
align 4
modeProtege:
mov ax, 0x10 ; second descripteur dans la GTD (0 non-utilisé)
mov ds,ax
mov es,ax
mov gs,ax
mov ss,ax
mov fs,ax
mov es,ax
mov esp, ADR_PILE_INIT
mov eax, cr0
; bt eax, 0
; jnc erreurNoire
and eax, 1
cmp eax, 0
je erreurNoire
;>>>>>>>>>>>>>>>>>>> mode graphique <<<<<<<<<<<<<<<<<<<<<<<<<<<
mov esi, 0xc0000
mov edi, ADR_BASE_BIOS
mov ecx, 0x8000/4 ; 32Ko.
rep movsd ; recopie du BIOS
mov edi, ADR_BASE_BIOS
mov ecx, 0x2000
mov eax, 'PMID'
; mov eax, 'DIMP'
cld
repne scasd
jcxz erreurP
jmp @F
erreurP:
jmp erreurBleue
@@:
sub edi, 4
; verifier checksum
; jne @B
; ici la structure est trouvée
mov [ADR_VAR_SYS+VBE_adrPMID], edi
movzx eax, word[edi + 4]
add eax, ADR_BASE_BIOS
mov [ADR_VAR_SYS+VBE_adrAppel], eax
movzx eax, word[edi + 6]
add eax, ADR_BASE_BIOS
mov [ADR_VAR_SYS+VBE_adrInit], eax
; mov ax, word[edi + 4]
; mov [ADR_VAR_SYS+VBE_depAppel], ax
; mov ax, word[edi + 6]
; mov [ADR_VAR_SYS+VBE_depInit], ax
mov [edi + 8], word 0x20
mov [edi + 10], word 0x38
mov [edi + 12], word 0x38
mov [edi + 14], word 0x38
mov [edi + 16], word 0x18
mov [edi + 18], byte 1
mov edi, ADR_VAR_BIOS
xor eax, eax
mov ecx, 0x600/4
rep stosd ; mettre à 0 la zone des variables du BIOS
mov esp, eax
add eax, 100 ; ATTENTION documentation VBE étrange = en haut de la pile
mov ax, 0x28 ; la pile 16 bits de VBE
mov ss, ax
movsx eax, word [ADR_VAR_SYS+VBE_adrInit]
call pword [eax]
jmp erreurRouge
|
|
the "call pword [eax] dont work an PC reboot.
Last edited by Stabia on 18 Jan 2008, 14:46; edited 2 times in total
|
18 Jan 2008, 14:17 |
|
vid
Verbosity in development
Joined: 05 Sep 2003
Posts: 7108
Location: Slovakia
|
Stabia: edit your post and use [code] tags
|
18 Jan 2008, 14:26 |
|
|
|
Forum Rules:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|
|
|
|
Powered by phpBB © 2001-2005 phpBB Group.
|