Re: I/O functions
Posted: Sat Mar 23, 2013 12:31 am
I have a only one question... Bare Bones switch CPU to pmode or real mode?
GRUB switches to protected mode and then starts the Bare Bones code, and the Bare Bones code stays in protected mode.p0s1x wrote:I have a only one question... Bare Bones switch CPU to pmode or real mode?
Thanks, but i have a problem, ld linking my kernel into PE file, how to make ELF file?Brendan wrote:Hi,
GRUB switches to protected mode and then starts the Bare Bones code, and the Bare Bones code stays in protected mode.p0s1x wrote:I have a only one question... Bare Bones switch CPU to pmode or real mode?
Cheers,
Brendan
Where in the relevant part of the multi-boot specification does it say you need to use ELF?p0s1x wrote:Thanks, but i have a problem, ld linking my kernel into PE file, how to make ELF file?Brendan wrote:GRUB switches to protected mode and then starts the Bare Bones code, and the Bare Bones code stays in protected mode.
If you're not using GRUB or multi-boot, then just use "flat binary" (it's easier).p0s1x wrote:Upd: I don't use GRUB
I can't create bootable image, my bat:Brendan wrote:Hi,
Where in the relevant part of the multi-boot specification does it say you need to use ELF?p0s1x wrote:Thanks, but i have a problem, ld linking my kernel into PE file, how to make ELF file?Brendan wrote:GRUB switches to protected mode and then starts the Bare Bones code, and the Bare Bones code stays in protected mode.
If you're not using GRUB or multi-boot, then just use "flat binary" (it's easier).p0s1x wrote:Upd: I don't use GRUB
Cheers,
Brendan
Code: Select all
@echo off
path = C:\MinGW\bin
gcc -o bin\kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs
ld -T bin\linker.ld -o bin\kernel.bin bin\loader.o bin\kernel.o
objcopy -O elf32-i386 bin\kernel.bin
dd if=bin\kernel.bin of=bin\image.img bs=1440k
PAUSE
Also when you should copy & paste tutorials make sure they work _before_ adding your own code.bluemoon wrote:before copy & paste the tutorials.
p0s1x wrote:Bare Bones switch CPU to Real or Protected mode?
p0s1x wrote:I have a only one question... Bare Bones switch CPU to pmode or real mode?
Anyway I would highly recommend using Linux as your development platform because it makes away with lots of your problems such as PE files.p0s1x wrote:Thanks, but i have a problem, ld linking my kernel into PE file, how to make ELF file?
Upd: I don't use GRUB :)
You need a Multiboot loader to load the Bare Bone tutorial. Please read the Bare Bone tutorial. And every time it says you need something, such as GRUB, please don't consider it optional but rather mandatory!p0s1x wrote: I can't create bootable image, my bat:Bootable image (output) don't boot in Bochs. If I boot it with VMware Player, I get black screen.Code: Select all
@echo off path = C:\MinGW\bin gcc -o bin\kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs ld -T bin\linker.ld -o bin\kernel.bin bin\loader.o bin\kernel.o objcopy -O elf32-i386 bin\kernel.bin dd if=bin\kernel.bin of=bin\image.img bs=1440k PAUSE
Thanks.
Sources, please?m12 wrote:Qemu is difficult to set up on windows
Why don't we put that link in the wiki under Qemu?Nessphoro wrote:Sources, please?m12 wrote:Qemu is difficult to set up on windows
This site has pre-compiled windows binaries. I do not see how easier can it get.
http://lassauge.free.fr/qemu/
l2google
It's on the first link from the official qemu wiki / Links / "Unofficial QEMU binaries" section, it should be easy to find it.m12 wrote:Why don't we put that link in the wiki under Qemu?
Code: Select all
unsigned int k_printf(char *message, unsigned int line) {
char *vidmem = (char *) 0xb8000;
unsigned int i=0;
i=(line*80*2);
while(*message!=0) {
if(*message=='\n') {
line++;
i=(line*80*2);
*message++;
} else {
vidmem[i]=*message;
*message++;
i++;
vidmem[i]=WHITE_TXT;
i++;
};
};
return(1);
};
Code: Select all
char getch() {
asm ("mov $1, %ah");
asm ("int $0x16");
}