screen.c help (previously "weird text...")
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:screen.c help (previously "weird text...")
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
HTH
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:screen.c help (previously "weird text...")
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.
I do have a simple _Print command that supports \n and \b.
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:screen.c help (previously "weird text...")
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.
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.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:screen.c help (previously "weird text...")
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!
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...")
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 ??? ???
does anybody know where to get a chart explaining the color byte? i lost mine .
xxx_xxxx
| |
| FG
BG
Is this right ??? ???
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:screen.c help (previously "weird text...")
http://www.osdev.org/osfaq2/index.php/HardWareVga should be *da* place 2 check ...
iirc,
Yellow on dark blue is, for instance
FG_GREEN|FG_RED|FG_BRIGHT|BG_BLUE
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,
};
FG_GREEN|FG_RED|FG_BRIGHT|BG_BLUE
Re:screen.c help (previously "weird text...")
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!
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!
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:screen.c help (previously "weird text...")
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
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...")
not only in qbasic, in textmode.Pype.Clicker wrote:Only 8 colors (0..7) are avl. for background because in QBASIC, the highest bit is for blinking or something alike ...
if you are willing to give up blinking. there?s some vga reg you can change to do this.You can theorically enable 16 colors for background
Re:screen.c help (previously "weird text...")
cool. would you mind telling how or pointing to how?bubach wrote:if you are willing to give up blinking. there?s some vga reg you can change to do this.You can theorically enable 16 colors for background
Re:screen.c help (previously "weird text...")
ya, I could easily do without blinking. i got something like this
With this I would assumme you would have this to combine them:
Code: Select all
typedef enum ColorCodes
{
BLACK=0
BLUE=1
...
BG_BLACK=0x01
BG_BLUE=0x02
} ColorCodes;
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...")
|| is a logical or (ie. if(true || true);), | is the bitwise or/* assuming || is or....can't remember :P */
Re:screen.c help (previously "weird text...")
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...")
no problemo. i'll post some links for everybody else too ;P
Re:screen.c help (previously "weird text...")
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.
Also, you should use 0x10-folds for the background colors, IE, 0x10, 0x20 etc.