flat assembler
Message board for the users of flat assembler.

Index > Main > VBE study

Goto page Previous  1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 25 Jun 2010, 05:54
Teehee,

If you're going to stay in RM, you'd have to use something like les.
Post 25 Jun 2010, 05:54
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Jun 2010, 13:46
bitshifter wrote:
Step 1:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; VESA SuperVGA BIOS (VBE) - Get SuperVGA information
; AX = 4f00h
; ES:DI -> buffer for SuperVGA information (see #00077)
; Return:AL = 4fh if function supported
; AH = status
; 00h successful
; ES:DI buffer filled
; 01h failed
; ---VBE v2.0---
; 02h function not supported by current hardware configuration
; 03h function invalid in current video mode
;
; Desc: Determine whether VESA BIOS extensions are present and the
;       capabilities supported by the display adapter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

        ; Assume cs=ds=es

        mov     di,VbeInfoBlock
        mov     ax,4f00h        ; Get SuperVGA information
        int     10h
        cmp     al,4fh          ; Is function supported?
        jne     vbe_not_supported
        cmp     ah,00h          ; Is status successful?
        jne     vbe_not_supported

        ; ...

  vbe_not_supported:

         ; ...
    

Of course you can combine the AH,AL tests...


I did that check, and that funcion is supported (returns 004Fh). But i still can't get any value Sad

_________________
Sorry if bad english.
Post 26 Jun 2010, 13:46
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Jun 2010, 14:36
oh.. hehe, i read the manual Embarassed

VideoModePtr is a vbeFarPtr, and in RM it is a segment:offset value... so:
Code:
                mov   eax, [VbeInfoBlock.VideoModePtr]
                movzx ecx, ax ; store offset
                ror   eax, 16 ; get segment
                mov    es, ax ; set it
                mov    ax, word[es:ecx] ; get first mode!
                movzx eax, ax
                mov   ebx, 16
                mov   esi, buf+4
                call  String.eax2str     

works Very Happy

[edit]
i was thinking mov ax, [es:ecx] was equal to mov ax,[ecx] bc it would assume 'es' automaticaly (i mean, the segment).. but it doesn't o.o'

[edit2]
however, there is some undocumented mode numbers, like 17Ah.. why? (see img)


Description:
Filesize: 4.23 KB
Viewed: 11952 Time(s)

imagem.png



_________________
Sorry if bad english.
Post 26 Jun 2010, 14:36
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 27 Jun 2010, 19:28
I'm doing some tests with VGA mode 13h... and i made a proc to draw a rectangle.. but my function seems too dumb... i mean, there is should exist a smart/better way to draw a rectangle. See my code below.

Code:
org 100h

        mov     ax,13h
        int     10h

        mov     ax,0xA000
        mov     es,ax

        ; background

        mov     al,79
        call    clearscr

        mov     cl,105
        mov     ax,10
        mov     bx,15
        mov     bp,310
        mov     dx,190
        call    rect

        mov     ah,01h
        int     21h
        int     20h


clearscr:
        ; + AL -> color
        xor     di,di
        mov     cx,320*200
        rep     stosb
        ret

putpixel:
        ; + AX -> y
        ; + BX -> x
        ; + CL -> color
        push    ax dx
        ; (width*y+x)
        mov     dx,320
        mul     dx
        add     ax,bx
        mov     di,ax
        mov     byte[es:di],cl
        pop     dx ax
        ret

rect:   ; + AX -> y
        ; + BX -> x
        ; + BP -> width absolute
        ; + DX -> height absolute
        ; + CL -> color
        push    bx
    @@: call    putpixel
        inc     bx
        cmp     bx,bp
        jg      .nextrow
        jmp     @b
.nextrow:
        pop     bx
        inc     ax
        cmp     ax,dx
        jg      @f
        push    bx
        jmp     @b
    @@: ret    

I was wondering, if video memory is linear and my monitor doens't, so how it know that in a position it should back in next line and draw a pixel there, and so on? So i was wondering if there is a way of to do a 'window' rectangle and only pass the first and the last address and draw a exactly rectangle, like we make in a clear screen function (see 'clearscr' above) (i hope you understood Surprised)

_________________
Sorry if bad english.
Post 27 Jun 2010, 19:28
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 28 Jun 2010, 01:28
Post 28 Jun 2010, 01:28
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 618
cod3b453 28 Jun 2010, 09:07
Teehee wrote:
...
[edit2]
however, there is some undocumented mode numbers, like 17Ah.. why? (see img)
Earlier versions of VESA defined mode numbers but the later revisions moved to the mode listing approach - this allows any new device to define their own modes according to capability. For compatibility the pre-defined modes are kept.
Post 28 Jun 2010, 09:07
View user's profile Send private message Reply with quote
janequorzar



Joined: 11 Sep 2010
Posts: 60
janequorzar 22 Sep 2010, 02:46
I posted the difference between PRE-VGA ( VESA ) and VGA ( VESA ) modes when it comes to printing text. It goes for all pixels you look at on a screen in VESA modes.

http://board.flatassembler.net/topic.php?p=119489#119489

You see the issue is not that you cannot print it to the screen, its the matter of WHAT mode your in and what your video card supports. So you must GET the info of what your VESA starting point is. IF VESA is even supported at all.
Post 22 Sep 2010, 02:46
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 25 Feb 2011, 23:00
help me with Linear Frame Buffer:

i got the modeinfo and set the mode:
Code:
; -- VBE

        mov ax, ModeInfoBlock
        mov es, ax
        mov di, ModeInfoBlock
        mov ax, 0x4F01
        mov cx, 0x011B
        int 10h


        mov ax, 0x4F02
        mov bx, 0x011B
        or  bx, 0100'0000'0000'0000b ; set LFB
        int 10h    

Next i load the GDT and change to PM. Then:
Code:
mov edi, [ModeInfoBlock.PhysBasePtr]
mov dword[edi+1280*50+50],0xFFFFFFFF             

but cant see any pixel Sad

_________________
Sorry if bad english.
Post 25 Feb 2011, 23:00
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Feb 2011, 00:41
nvm.. i did! Very Happy

edit:
hm.. why the buffer its not 32 bits? i have 3 bytes color. i cant to do dword loop Sad
How do i get 32bit colors? Sad
Post 26 Feb 2011, 00:41
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 26 Feb 2011, 16:52
I've discovered that QEMU doesn't support more than 24bpp, but VirtualBox and Bochs do. Most modern videocards can handle 32bpp. Maybe that is the problem.
Post 26 Feb 2011, 16:52
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Feb 2011, 17:00
im using Bochs. Razz
Post 26 Feb 2011, 17:00
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 26 Feb 2011, 18:50
You will need to enable A20 line
Post 26 Feb 2011, 18:50
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Feb 2011, 19:47
Dex4u wrote:
You will need to enable A20 line

i did Very Happy

_________________
Sorry if bad english.
Post 26 Feb 2011, 19:47
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 26 Feb 2011, 20:16
If it does not work when you set A20 line, it could you need to try different A20 code.
To test if it is A20 line, try putting pixels at the very start of address.
Also make sure A20 has a delay after it.
Post 26 Feb 2011, 20:16
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 26 Feb 2011, 20:48
My A20 is ok. i dunno what it has to do with 32bit video buffer.

Code:
cmp byte[ModeInfoBlock.BitsPerPixel],32
je $ ; never equal Sad: its 24.    
Post 26 Feb 2011, 20:48
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 26 Feb 2011, 21:21
Teehee wrote:
My A20 is ok. i dunno what it has to do with 32bit video buffer.

Code:
cmp byte[ModeInfoBlock.BitsPerPixel],32
je $ ; never equal Sad: its 24.    


For the mode you want you can have 32bpp or 24bpp, you need to test which the card users.
As when you write buffer to screen you need to do 00RRGGBB00RRGGBB for 32bits or RRGGBBRRGGBB.. for 24bits

And try
Code:
cmp byte[ModeInfoBlock.BitsPerPixel],32
jne $ ; never equal Sad: its 24.    
Post 26 Feb 2011, 21:21
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 27 Feb 2011, 12:42
i didnt understand you, Dex. Sad
Post 27 Feb 2011, 12:42
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 28 Feb 2011, 00:19
please help me implement a 32bit video buffer, i'm a little bit lost, help Sad
Post 28 Feb 2011, 00:19
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Feb 2011, 20:19
Code:
;Simple 32-bit video buffer for 800x600 screen:
32bpp_buffer rd 800*600
    

Now putpixel(x,y):
Code:
;putpixel(0,0) WHITE
mov edi,32bpp_buffer
mov [edi],0FFFFFFh
;putpixel(799,599) BLUE
mov [edi+599*800*4+799*4],0FFh
    

When you want to copy that buffer to screen
Code:
mov esi,[LFB] ; your *real* screen i.e. @ A0000h
mov edi,32bpp_buffer
mov ecx,800*600*4 / 4 ; 800*600 DWORDs
rep movsd ;move 4 bytes at a time
    
Post 28 Feb 2011, 20:19
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 01 Mar 2011, 00:39
this is what i got:


Description:
Filesize: 36.96 KB
Viewed: 11503 Time(s)

imagem.PNG



_________________
Sorry if bad english.
Post 01 Mar 2011, 00:39
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4  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 can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.