Archive / / / / start.asm
2002-07-29 13:35:55 UTC
previous next
bits 32 section .reserve alloc noexec write nobits align=1 resb 1024*1024*4 ; Reserve 4 MB section .start alloc exec write progbits align=16 mov ecx, 0x7FFFFF ; Set up stack to top of multiboot's mov esp, ecx ; reserved bss area, we can use the stack ; freely without worry of overwriting ; the multiboot structure cmp eax, 0x2BADB002 ; Check magic signature in eax je good_magic mov esi, bad_magic_string jmp print_string bad_magic_string db 'The boot loader is incompatible with this OS (Bad signature)', 0 good_magic: push ebx ; Save pointer to multiboot info ; FIXME: Parse multiboot and save in heap in format recognized by kmalloc ; FIXME: Set up paging mov esi, testing_string jmp print_string testing_string db 'This is a test', 0 ; FIXME: Pass parameters to main() extern main call main jmp halt ; We shouldn't return here.. but if we do, halt print_string: mov edi, 0xb8000 ; Clear the screen mov eax, 0 mov ecx, 1000 rep stosd mov edi, 0xb8000 ; Finished clearing, move back to top print_string_loop: lodsb ; Load byte at esi into al cmp al, 0 ; See if done string je halt ; Halt if done stosb ; Save al into byte at edi mov al, 0x07 ; Save 0x07 into next byte at edi stosb jmp print_string_loop ; Next character halt: jmp halt ; Infinate loop