These are the variables that I use and I show what they are so you guys can get a better understanding of it.:
Code: Select all
CODE_DESC = 0x08
DATA_DESC = 0x10
IMAGE_RMODE_BASE = 0x3000
IMAGE_PMODE_BASE = 0x100000
Code: Select all
void ClrScr();
int main(void)
{
ClrScr();
for (;;);
}
void ClrScr()
{
char *vidmem = (char*)0xB8000;
unsigned int i;
for (i = 0; i < (80*25); i++) {
*vidmem++ = 0;
*vidmem++ = 0xF;
}
}
Setup.asm:
Code: Select all
Loader:
mov ax, DATA_DESC
mov ds, ax
mov ss, ax
mov es, ax
mov esp, 0x90000
Copy_Image:
mov eax, DWORD [ImageSize]
movzx ebx, WORD [bpbBytesPerSector]
mul ebx
mov ebx, 4
div ebx
cld
mov esi, IMAGE_RMODE_BASE
mov edi, IMAGE_PMODE_BASE
mov ecx, eax
rep movsd
jmp CODE_DESC:IMAGE_PMODE_BASE
cli
hlt
GCC Code:
Code: Select all
gcc -ffreestanding -c Kernel.c -o KRNL32.BIN