Printing to screen kernel basics

69 Views Asked by At

This code works with -O flag but don't works without -O flag and also don't works with -O2 and -O3 flag:

void putc(char c)
{

  static char *video = 0xb8000;

  *video = c;
  //video+=2;

}

void puts(char * s)
{

  for(;*s;) putc(*s++);

}

void start_kernel(void)
{

  putc('a');

  for(;;);

}

also this code displays nothing without flags, with -O flag and -O2 flag although it differs by one line after writing the character into the buffer:

void putc(char c)
{

  static char *video = 0xb8000;

  *video = c;
  video+=2;

}

void puts(char * s)
{

  for(;*s;) putc(*s++);

}

void start_kernel(void)
{

  putc('a');

  for(;;);

}

I'm using GRUB to load my "kernel" so I'm pretty sure that A20 line is unlocked and ...

I don't know what's going on...

0

There are 0 best solutions below