Ich habe ein Bootloader mit Assembler geschrieben.
boot.asm:
________________________
org 0x7C00
start:
   cli
   mov ax, 0x9000
   mov ss, ax
   mov sp, 0
   sti
   mov [bootdrv], dl
   call load
   mov ax, 0x1000
   mov es, ax
   mov ds, ax
   push ax
   mov ax, 0
   push ax
   retf
bootdrv db 0
loadmsg db "Lade Betriebssystem...",13,10,0
putstr:
   lodsb
   or al,al
   jz short putstrd
   mov ah,0x0E
   mov bx,0x0007
   int 0x10
   jmp putstr
putstrd:
   retn
load:
   push ds
   mov ax, 0
   mov dl, [bootdrv]
   int 13h
   pop ds
   jc load
load1:
   mov ax,0x1000
   mov es,ax
   mov bx, 0
   mov ah, 2
   mov al, 5
   mov cx, 2
   mov dx, 0
   int 13h
   jc load1
   mov si,loadmsg
   call putstr
   retn
times 512-($-$$)-2 db 0
dw 0AA55h
________________________
Für das starten der Kernel habe ich diese Datei angelegt.
ks.asm:
________________________
[Bits 32]
extern _main
global start
start:
   call _main
STOP:
   jmp STOP
________________________
Den Kernel selbst habe ich mit C erstellt.
kernel.c:
________________________
int main(void);
int main(void)
{
  char *str = "Hallo  Welt!", *ch;
  unsigned short *vidmem = (unsigned short*) 0xb8000;
  unsigned i;
  for (ch = str, i = 0; *ch; ch++, i++)
    vidmem
 = (unsigned char) *ch | 0x0700;
  for (;
    ;
}
________________________
Für den DJGPP Linker habe ich diese Datei erstellt.
link.ld:
________________________
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x00010000 : {
*(.text)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
________________________
Das alles habe ich so kompiliert.
________________________
nasm -f bin -o boot.bin boot.asm
nasm -f aout -o ks.o ks.asm
gcc -c -ffreestanding -nostdinc -I ./ -O3 -Wall -o kernel.o kernel.c
ld -T link.ld -o kernel.bin ks.o kernel.o
________________________
Dies hat auch alles geklappt. Dannach
habe ich alles per copy Befehl in
eine Datei zusammengefasst.
________________________
copy boot.bin + kernel.bin TestOS.raw
________________________
Diese Datei habe ich dann mit rawrite auf
eine Diskette geschrieben und neu gebootet.
Ich erhielt darauf die Meldung "Lade Betriebssystem...",
aber dannach ist nichts mehr passiert, obwohl
zu erwarten wäre, dass noch die Meldung
"Hallo Welt!" kommen würde. Ich habe mich
streng an verschiedene Tutorials gehalten,
aber das Ergebnis war immer das selbe. Was
habe ich falsch gemacht?