flat assembler
Message board for the users of flat assembler.

Index > OS Construction > vesa [pm] [rm] ref....

Author
Thread Post new topic Reply to topic
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
Great vga/vesa rm/pm .pdf-
just thought I would share this!!
has a lot of good info vga/vesa bios and pm modes

http://www.buissoft.com/vga.zip
Post 10 Sep 2007, 22:17
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Thanks dosin
Post 11 Sep 2007, 20:46
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
I ran across this code of yours Dex4U:
I had a couple of questions about creating a pixel function...
Code:
mov  edi,[ModeInfo_PhysBasePtr]   ; This is = to mov   edi,0xA0000 in vga
add  edi, 640*6    ; This is = to x = 0, y = 6
mov  al,0x09   ; Color of pixel
stosb   ; Put whats in al at es:edi    


**************************

Code:
example:
mov [x],10
mov [y],13
mov [color],0xFF

plot_pixel:

ck_24:
        cmp   [BitsPerPixel],24
        jne   try32
        call  go_pixel_24
        jmp   ck_24
try32:
        cmp   [BitsPerPixel],32
        jne   cont_
        call  go_pixel_32 
cont_:

ret
**************************

go_pixel_24:
mov  edi,[BasePtr]   
add  edi,x+640*y   
mov  al,color  

cli
stosb
sti 

ret

***************************
go_pixel_32 :

mov  edi,[BasePtr]   
add  edi,x+640*y   
mov  al,color  

cli
stosb
sti 


ret
****************************

    


Basically you said in the example I would need to check for 24/32bit color
and then plot the pixel... Well needless to say the code above needs some work, but when I write more than one pixel it writes only the last one...

Thanks for any help!
Post 12 Sep 2007, 01:29
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Right you only need to test for 24 or 32 if the mode is for 32bits per pixel.
Now let say you are using that mode, the color need to be RRGGBB for 24bit or 00RRGGBB for 32bit.
Now heres a unoptimised put pixel, note this is direct to screen, you should really write to a buffer, than write it to screen
Code:
VesaPutPixel:   push  eax     push  ebx        mov   edi,[ModeInfo_PhysBasePtr]  ; vesa start address     xor   ebx,ebx       mov   ebx,[VesaX] ;pixel X    shl   ebx,2        cmp   [ModeInfo_BitsPerPixel],24        jne   @F        sub   ebx,[VesaX]@@:   add   edi, ebx        mov   ebx,[VesaY] ;pixel Y    mov   eax,[ModeInfo_XResolution]  ;vesa X size        shl   eax,2        cmp   [ModeInfo_BitsPerPixel],24        jne   @f        sub   eax,[ModeInfo_XResolution]@@:    mul   ebx     add   edi,eax mov   eax,dword[color] ;put you color eg 0x00bcbcbc   stosd         pop   ebx     pop   eax             ret    

Also if you write to a buffer first, you will get no flicker and you can write to the buffer as if it a 32bpp and than test when writing buffer to screen, for 32 or 24 BPP.

Can you post what mode your setting vesa to.
Post 12 Sep 2007, 02:13
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
mode:4112h = 32/24bit
Post 12 Sep 2007, 03:58
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
dosin wrote:
mode:4112h = 32/24bit


So you will need to check for that mode, as its 640*480 32/24bits
Post 12 Sep 2007, 04:23
View user's profile Send private message Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
Ya! I did... Thanks....
Post 12 Sep 2007, 05:03
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Quote:
Great vga/vesa rm/pm .pdf-
just thought I would share this!!


Thanks Smile
Post 14 Sep 2007, 21:34
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.