Page 2 of 3
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 03, 2004 1:37 am
by distantvoices
well, I suggest you provide yerself with a set of the va_args macros, and then - set off and implement a worker function for your kprintf, which loops throu a character string, outputs each 'normal character' and recognizes/parses special character combinations like '%d'
HTH
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 03, 2004 7:46 am
by dh
va_args ? how do they work? oh oh! they support that "..." thing, right. sorry I don't get this as (like I already said) a real noobie!!
I do have a simple _Print command that supports \n and \b.
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 03, 2004 8:35 am
by distantvoices
Dragon? DRAAAGON???!! Stop that hiding behind being new to c, OK? I've been new to that stuff too - a long time ago. *gg*
Roughly said, yes, the va_arg macros are for variable-length argument lists, which are "popped" off the stack one after the other via va_arg(sizeof (datatype)).
Why don't you try it out, hm? have a look at Solars pdclib: there is an implementation of those macros.
... gonna rant on this when I'm at home, don't worry. You'll get a nice explanation.
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 03, 2004 11:30 am
by dh
woow...don't rant over this. I barely know anything about C. I've been doing it less then a month!!!
Thanks for the advice...and I'll stop saying that if it helps. (I would assume that people want to know /why/ I don't understand...)
Long live BASIC!
Re:screen.c help (previously "weird text...")
Posted: Thu Dec 09, 2004 10:57 am
by dh
what I ment by "long live basic" is i have a color, locate and _print command. ease of use forever.
does anybody know where to get a chart explaining the color byte? i lost mine
.
xxx_xxxx
| |
| FG
BG
Is this right ??? ???
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 10, 2004 4:32 am
by Pype.Clicker
http://www.osdev.org/osfaq2/index.php/HardWareVga should be *da* place 2 check ...
iirc,
Code: Select all
enum {
FG_BLUE = 1,
FG_GREEN = 2,
FG_RED=4,
FG_BRIGHT=8,
BG_BLUE=0x10,
BG_GREEN=0x20,
BG_RED=0x40,
BLINK_OR_BG_BRIGHT_DEPENDING_ON_VGA_SETUP=0x80,
};
Yellow on dark blue is, for instance
FG_GREEN|FG_RED|FG_BRIGHT|BG_BLUE
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 10, 2004 10:39 am
by dh
OHHH THANKYOU!!!! I was trying to do it all by trial and error and you wouldn't believe how many possibilties there is!!
oh ya:
http://osdev.neopages.net/FreeVGA/vga/colorreg.htm is broken :'P *cry*. In fact, a LOT of links are broken :'P.
Do the colors in qbasic work? They go from 0 to 15. I know that only the first 7(?) can be used for backgrounds. Input apreacheated!
Re:screen.c help (previously "weird text...")
Posted: Fri Dec 10, 2004 3:37 pm
by Pype.Clicker
they work the same way as shown (e.g. color 9 is BLUE|BRIGHT, color 0 is black, etc.)
BLUE|GREEN == CYAN, BLUE|RED==MAGENTA, etc.
Only 8 colors (0..7) are avl. for background because in QBASIC, the highest bit is for blinking or something alike ...
You can theorically enable 16 colors for background
Re:screen.c help (previously "weird text...")
Posted: Sat Dec 11, 2004 3:59 am
by bubach
Pype.Clicker wrote:Only 8 colors (0..7) are avl. for background because in QBASIC, the highest bit is for blinking or something alike ...
not only in qbasic, in textmode.
You can theorically enable 16 colors for background
if you are willing to give up blinking. there?s some vga reg you can change to do this.
Re:screen.c help (previously "weird text...")
Posted: Sat Dec 11, 2004 8:25 am
by HOS
bubach wrote:
You can theorically enable 16 colors for background
if you are willing to give up blinking. there?s some vga reg you can change to do this.
cool. would you mind telling how or pointing to how?
Re:screen.c help (previously "weird text...")
Posted: Sat Dec 11, 2004 4:41 pm
by dh
ya, I could easily do without blinking. i got something like this
Code: Select all
typedef enum ColorCodes
{
BLACK=0
BLUE=1
...
BG_BLACK=0x01
BG_BLUE=0x02
} ColorCodes;
With this I would assumme you would have this to combine them:
Code: Select all
void ChangeColor(ColorCodes fg, ColorCodes bg)
{
_COLOR = fg || bg /* assuming || is or....can't remember :P */
}
Re:screen.c help (previously "weird text...")
Posted: Sat Dec 11, 2004 10:24 pm
by AR
/* assuming || is or....can't remember :P */
|| is a logical or (ie. if(true || true);), | is the bitwise or
Re:screen.c help (previously "weird text...")
Posted: Sun Dec 12, 2004 8:01 am
by bubach
sorry, i can?t remember where i read that. you?ll have to search for some vga-reg docs on google..
Re:screen.c help (previously "weird text...")
Posted: Sun Dec 12, 2004 9:56 am
by dh
no problemo. i'll post some links for everybody else too ;P
Re:screen.c help (previously "weird text...")
Posted: Sun Dec 12, 2004 10:16 am
by Candy
if you want to binary-or them together, you should use a single | character.
Also, you should use 0x10-folds for the background colors, IE, 0x10, 0x20 etc.