Weird printing problem
Posted: Wed Aug 25, 2010 7:27 am
Hello,
as I finally tried to enter operating system development I've encountered a weird problem using the following code:
with ConsoleCell defined as
and videomem defined as
This code obviously is intended to fill the screen with numbers from zero to ten, but it doesn't, at least not completely:

Additionally, when I try to set a random character using the following code after filling the screen, nothing happens.
In fact, the screenshot above is generated after having called the last code snippet for c='B', x=20 and y=2.
I'm compiling my code on an x86_64 using the following tools:
g++ -m32 -march=i386 -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -Wall -Wextra
nasm -f elf32
ld -melf_i386
Qemu is used for running the resulting floppy image.
as I finally tried to enter operating system development I've encountered a weird problem using the following code:
Code: Select all
struct ConsoleCell cell;
for (i = 0; i < (80 * 25); i++)
{
cell.character = '0' + (i % 10);
cell.attributes = 0x07;
videomem[i] = cell;
}
Code: Select all
struct ConsoleCell
{
char character;
unsigned char attributes;
} __attribute__((packed));
Code: Select all
videomem = (ConsoleCell*) 0xb8000;

Additionally, when I try to set a random character using the following code after filling the screen, nothing happens.
Code: Select all
struct ConsoleCell cell;
cell.character = c;
cell.attributes = 0x35;
videomem[y * 80 + x] = cell;
I'm compiling my code on an x86_64 using the following tools:
g++ -m32 -march=i386 -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -Wall -Wextra
nasm -f elf32
ld -melf_i386
Qemu is used for running the resulting floppy image.