flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > OS Construction > VBE (vesa 3)

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
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.
Post 15 Jan 2008, 12:43
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1595
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
Post 15 Jan 2008, 13:57
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
Location: Slovakia
does 4F01 tell you that mode is supported with LFB? In other words, is bit 7 of ModeAttributes set?
Post 15 Jan 2008, 14:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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 !
Post 15 Jan 2008, 14:56
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
Location: Slovakia

Quote:
the LFB bit is OK


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.
Post 15 Jan 2008, 15:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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?
Post 15 Jan 2008, 16:09
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
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...
Post 15 Jan 2008, 16:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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
Post 15 Jan 2008, 16:47
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
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?
Post 15 Jan 2008, 17:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 466
Location: Rome,Italy
try my vesa utility,give you some info about your vesa card and LFB support
http://board.flatassembler.net/topic.php?p=57922#57922
Post 15 Jan 2008, 17:18
View user's profile Send private message Reply with quote
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 !)
Post 15 Jan 2008, 21:10
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
Location: Slovakia
can you post the code?
Post 15 Jan 2008, 21:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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     diADR_PILE_INIT - 0x500     ; un tampon de 512 octets en haut de la pile
        mov     [es:di], dword 'VBE2'
        mov     ax0x4f00              ; test VBE (vesa étendu)
        int     0x10
        cmp     ax0x004f
        jne     .erreur

        xor     eaxeax
        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     eax0
        je      .PMID
        mov     esieax
        and     esi0xffff
        shr     eax16
        mov     [fs:VBE_Modes], eax
PMID:
        mov     edi0
        push    word 0xc000
        pop     es
        mov     ecx0x8000
  ;      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     eaxeax
        mov     ax, [es:edi + 10]
        mov     [fs:VBE_SegEcr], ax

        push    0
        pop     es
        mov     cx0x4115              ; 0x112 640*480*32b - 0x115 800*600*32b -  0x118 1024*768*32b  - 0x11b 1280*1024*32
        mov     ax0x4f01              ; test VBE (vesa étendu)
        int     0x10
        cmp     ax0x004f
        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     eaxeax
        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   eaxbyte [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     ebxeax
        and     ebx0xffff
        mov     ax0
        shr     eax12
        add     eaxebx
        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     ax0x4f0a
        xor     bxbx
        int     0x10
        cmp     ax0x004f
        jne     .erreur

        mov     eax0
        mov     axes                  ; segment en mode réel
        shl     eax4
        movzx   ebxdi                 ; déplacement
        add     eaxebx                ; 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     ebxeax                ; l'adresse réelle (physique) de la fonction 5
        mov     [fs:VBE_adrFct5], dword ebx
        movzx   ebxword [es:di + 2]
        add     ebxeax
        mov     [fs:VBE_adrFct7], dword ebx
        movzx   ebxword [es:di + 4]
        add     ebxeax
        mov     [fs:VBE_adrFct9], dword ebx
        movzx   ebxword [es:di + 6]
        cmp     ebx0
        je      @F
        add     ebxeax
@@:     mov     [fs:VBE_adrTableES], dword ebx

        mov     esimess_10
        mov     ax0x4f03              ; trouver le mode actuel
        int     0x10
        cmp     ax0x004f
        jne     .erreur
        movzx   eaxbx                 ; conserver le mode actuel
        push    bx

        mov     bx0x4115              ; 0x112 640*480*32b - 0x115 800*600*32b -  0x118 1024*768*32b  - 0x11b 1280*1024*32   + b14 = LINEAIRE
                                        ; voir b15  pour effacer ?
        mov     ax0x4f02              ; changer le mode
        int     0x10
        cmp     ax0x004f
        jne     .erreur

        mov     ax0x4f03              ; vérifier le mode
        int     0x10
        cmp     ax0x004f
        jne     .erreur

        mov     esimess_12
        bt      bx14
        jnc     .erreur
        mov     esimess_11
        cmp     bx0x4115
        jne     .erreur

        pop     bx

;>>>>>>>>>>> Passage en mode protégé 32 bits <<<<<<<<<<<<<<<<<<
modeP:
        sidt    [fs:SYS_anciennesIT]

        cli                     ; inhiber toutes les IT
        cld
        mov     al255         ; masquer toutes les IT
        out     0xa1,al         ; 8259A controleur d'interuptions
        out     0x21,al


Post 15 Jan 2008, 22:54
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
Location: Slovakia
looks allright... i am afraid it's really VESA bug

btw: shouldn't you check VESA version too, to make code generic?
Post 15 Jan 2008, 23:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1818
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
Post 16 Jan 2008, 01:34
View user's profile Send private message Reply with quote
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)
Post 16 Jan 2008, 09:47
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1818

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 Shocked

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 16 Jan 2008, 11:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
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.
Post 16 Jan 2008, 18:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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     al255         ; masquer toutes les IT
        out     0xa1,al         ; 8259A controleur d'interuptions
        out     0x21,al

 @@:    in      al0x64
        test    al2
        jnz     @B
        mov     al0xd1
        out     0x64al        ; 8042 clavier : activer 'ligne A20'
 @@:    in      al0x64
        test    al2
        jnz     @B
        mov     al0xdf
        out     0x60al
 @@:    in      al0x64
        test    al2
        jnz     @B
        mov     al0xff
        out     0x64al

        lgdt     [cs:tmp_gdt]
        mov     eaxcr0
        or      eax1                  ; mode protégé
        and     eax0x1fffffff        ; efface b30 = cache en marche b29 ? efface b31 = pas de pagination
        mov     cr0eax
        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     ax0x10         ; 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     espADR_PILE_INIT

        mov     eaxcr0
;        bt      eax, 0
;        jnc     erreurNoire
        and     eax1
        cmp     eax0
        je      erreurNoire

;>>>>>>>>>>>>>>>>>>> mode graphique <<<<<<<<<<<<<<<<<<<<<<<<<<<

        mov     esi0xc0000
        mov     ediADR_BASE_BIOS
        mov     ecx0x8000/4   ; 32Ko.
        rep     movsd           ; recopie du BIOS

        mov     ediADR_BASE_BIOS
        mov     ecx0x2000
        mov     eax'PMID'
;        mov     eax, 'DIMP'
        cld
        repne   scasd
        jcxz    erreurP
        jmp     @F
erreurP:
        jmp     erreurBleue
@@:
        sub     edi4
; verifier checksum
;        jne     @B
; ici la structure est trouvée
        mov     [ADR_VAR_SYS+VBE_adrPMID], edi
        movzx   eaxword[edi + 4]
        add     eaxADR_BASE_BIOS
        mov     [ADR_VAR_SYS+VBE_adrAppel], eax
        movzx   eaxword[edi + 6]
        add     eaxADR_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     ediADR_VAR_BIOS
        xor     eaxeax
        mov     ecx0x600/4
        rep     stosd                   ; mettre à 0 la zone des variables du BIOS

        mov     espeax
        add     eax100                ; ATTENTION documentation VBE étrange = en haut de la pile
        mov     ax0x28                ; la pile 16 bits de VBE
        mov     ssax
        movsx   eaxword [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
Post 18 Jan 2008, 14:17
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7110
Location: Slovakia
Stabia: edit your post and use [code] tags
Post 18 Jan 2008, 14:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >

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.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2013, Tomasz Grysztar.