flat assembler
Message board for the users of flat assembler.

Index > OS Construction > pmode VGA

Author
Thread Post new topic Reply to topic
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 23 Jul 2009, 03:09
Hi,

my problem is with char attribute,
its size is 8 bits ,3bits for Foreground color,1bit for Foreground Intensity,
3bits for Background color, and the last bit for Blinking or background intensity.

so, if I want to put Magenta which is 5 as a Foreground, and white which is
15 as a background the attribute will be (binary) 1111 0101,but in this
way I enabled background blinking,so how to put Magenta on white without enabling background blinking?

Thanx.
Post 23 Jul 2009, 03:09
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 23 Jul 2009, 03:40
My mistake, but you're post had some very contradicting statements in it. Very hard to understand.

but in this way I enabled background blinking,so how to put Magenta on white without enabling background blinking?
He could've just asked "How do I set intensity in PMode?", would've been much easier to understand what he was asking.

Original Post below:


You enabled background blinking? If you need intensity and still want blinking, then you will have to modify the palette. You just modify it like you modify the palette in mode 13h. In case you don't know,

mov dx,03C8h
mov al,0 ;Put the color you wish to modify in place of 0
out dx,al
inc dx
;Now you out dx,al three times...first for red,green, then blue
mov ax,[redvalue]
out dx,al
mov ax,[greenvalue]
out dx,al
mov ax,[bluevalue]
out dx,al


You just need to figure out what color on the palette relates to the text mode colors. Although if you look at the vga palette it would seem to be mapped to colors 0-F, it is not. I know just 2 of the colors right now through experimentation. 0 is black, 39h is bright blue.


Last edited by windwakr on 23 Jul 2009, 14:25; edited 4 times in total
Post 23 Jul 2009, 03:40
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 23 Jul 2009, 03:43
Code:
  mov ax,1003h
  sub bx,bx ;0=background intensity, 1=blink
  int 10h
    
Post 23 Jul 2009, 03:43
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 23 Jul 2009, 03:44
My mistake, see my first post in this thread.

Original post below:

sinsi, he wants to keep background blinking enabled.


This file has a program in it called palman.com, it shows what I mean by editing the colors. If running it under windows press alt+enter to make it fullscreen, or else it won't work right.


Last edited by windwakr on 23 Jul 2009, 14:18; edited 2 times in total
Post 23 Jul 2009, 03:44
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 794
Location: Adelaide
sinsi 23 Jul 2009, 04:19
>how to put Magenta on white without enabling background blinking?
Post 23 Jul 2009, 04:19
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 23 Jul 2009, 04:22
My mistake, see my first post in this thread.

Original post below:



but in this
way I enabled background blinking
,so how to put Magenta on white without enabling background blinking?

He wants bright white without disabling background blinking. He's not dumb, he knows about the intensity bit. I just explained it to him about a week ago.


Last edited by windwakr on 23 Jul 2009, 14:18; edited 2 times in total
Post 23 Jul 2009, 04:22
View user's profile Send private message Reply with quote
abuashraf



Joined: 11 Nov 2006
Posts: 88
abuashraf 23 Jul 2009, 05:04
Hi,

first, here I'm talking about doing this in protected mode,so
I can't use BIOS ints.

second point,I want intensity enabled ,and blinking disabled.
with Magenta on white,but the problem is ,the same bit is used for
enabling intensity and blinking which is the last bit,also if I want to chose
white ,it needs four bits which means setting the last bit.

Anyway,I figured it out,so here's the code for anybody else
this code disables blinking.
Code:
mov  dx,003DAH       
in  al,dx           

mov     dx,003c0h
mov        al,10h+20h

out   dx,al
inc    dx
in        al,dx
dec    dx
and       al,not 008h     ; clear blink bit
out        dx,al    


Thank you guys very much for your help.
Post 23 Jul 2009, 05:04
View user's profile Send private message Reply with quote
Anony



Joined: 05 Sep 2009
Posts: 1
Anony 05 Sep 2009, 04:00
how to use the video card RAM??
Post 05 Sep 2009, 04:00
View user's profile Send private message Send e-mail MSN Messenger Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Sep 2009, 09:43
Very cautiously!!!!!!!!!


PS. Sorry, I couldn't resist. Usually the first post of a person starts with an introduction. I don't know where to begin Razz Board rules for example...
Post 05 Sep 2009, 09:43
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 05 Sep 2009, 09:50
Anony wrote:
how to use the video card RAM??
link 1
an older reference
and its companion
reasonable starting point

@Madis: hahaha!!!!
Post 05 Sep 2009, 09:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 05 Sep 2009, 10:00
Anony wrote:
how to use the video card RAM??
What do you want to use it for? Code, data, or maybe even text/graphics? All three are possible and allowable, just set a pointer/segment-register to the video RAM and start 'using' it.
Post 05 Sep 2009, 10:00
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 05 Sep 2009, 12:59
You can do it by setting the Palette, eg: if you want you could have 10 shades of green.
Here is a function to set Palette from pmode.
Code:
 ;----------------------------------------------------;
 ; PALETTE                                            ;
 ;----------------------------------------------------;
; al = color number
; bl = red
; bh = green
; cl = blue

Palette:
       pushad
      mov   dx,3c8h                                    
   out   dx,al
 inc   dx                                        
    mov   al,bl                                      
   out   dx,al
 mov   al,bh                                      
   out   dx,al
 mov   al,cl                                      
   out   dx,al
 popad
       ret

    


All you have to do is modify so called DAC palette registers which contain RGB values for a palette entries 0-15. You cnnot have more than 16 colors, of course, because of the mode 3 restrictions, but you can modify the basic colors. Say, instead of light gray (#7) you can have pink, if you specify the correct RGB values (You can find it by running simple PAINT program in Windows and see the values when choosing a color).

Out the colour number to 3c8h, then the red value (0 to 63) to 3c9h, then green (0 to 63) to 3c9h, then blue (0 to 64) to 3c9h.
Post 05 Sep 2009, 12:59
View user's profile Send private message Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias 06 Sep 2009, 10:47
Thanks Dex, very helpful post!

It is always better to give genuine code, rather than simple links to articles.

I think there may be, going back to Madis' query, a bit of confusion, at least on my part, as to the goal of this newcomer.

I assumed, (always a bad idea, as f0dder has tried, in vain, to explain to me!) that his/her goal was to access the video card registers, for the purpose of writing code that would permit svga graphics display (e.g. 1024 x 768) from protected mode, with 16.7 million colors to choose from.

Dex's excellent, well explained code, however, works in text mode, i.e. 80 x 25, with maximum 16 colors: black, blue, green, cyan, brown, magenta, white, grey, light blue, light green, light cyan, yellow, light magenta, and light white.) I am a tad color blind, so, for me, 16 colors is just fine!

Text mode (80x25) is also good, because as our vision deteriorates, it becomes imperative to use big text characters.

Smile
Post 06 Sep 2009, 10:47
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.