Page 1 of 1

Beginner Help - Print to screen

Posted: Tue Nov 14, 2006 3:05 pm
by handyandy
I have just started to write my own os tonight and I having trouble...

Im using GRUB to boot with. I borrowed basic code to get text onto the screen.

I am using the code off osdever.net called bkerndev.zip.

when I try to compile with gcc with these command line arguments:
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c -o main.o main.c

gcc returns the error:
invalid operands to binary |

the code it is having problems with is
*where = txt | att;

att is the colour.

This works fine in the example I am using.

I have included the main.c file as an attachment.

Thanks in advance.

Posted: Tue Nov 14, 2006 3:09 pm
by Lprogster
Sry I cant help... but Im interested in that tutorial, could you post the URL plz?

Posted: Tue Nov 14, 2006 3:45 pm
by Combuster
I get two errors: both are about comparing a pointer to an integer.
What is wrong is that the definition of putch requires a char * instead of a char. (As well as the fact that you are supplying strings instead of characters)

Here, the correct definition (IIRC in the C99 standard its char c) should be:

Code: Select all

void putch(char txt)
Since that error also came by recently, i think the tutorial has some issues. However I dont know where it comes from...
the wiki page is hopefully just as educating and bugfree.

Posted: Wed Nov 15, 2006 1:55 am
by handyandy
Thanks lprogster and combuster. Here is the url of that tutorial:

http://www.osdever.net/bkerndev/index.php?the_id=90

if you go right to the end then you cna download the completed working version.