FASMMMMMMM
This commit is contained in:
parent
946c9e468d
commit
e2572d50af
15 changed files with 175 additions and 715 deletions
100
src/start32.asm
100
src/start32.asm
|
|
@ -1,47 +1,91 @@
|
|||
format binary
|
||||
use32
|
||||
org 0x100000
|
||||
|
||||
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
|
||||
MULTIBOOT_PAGE_ALIGN equ 1 << 0
|
||||
MULTIBOOT_MEMORY_INFO equ 1 << 1
|
||||
MULTIBOOT_VIDEO_REQUEST equ 0 << 2
|
||||
MULTIBOOT_AOUT_KLUDGE equ 0 << 16
|
||||
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_REQUEST
|
||||
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_REQUEST | MULTIBOOT_AOUT_KLUDGE
|
||||
MULTIBOOT_PAGE_ALIGN equ (1 shl 0)
|
||||
MULTIBOOT_MEMORY_INFO equ (1 shl 1)
|
||||
MULTIBOOT_VIDEO_REQUEST equ (0 shl 2)
|
||||
MULTIBOOT_AOUT_KLUDGE equ (1 shl 16)
|
||||
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO or MULTIBOOT_VIDEO_REQUEST
|
||||
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO or MULTIBOOT_VIDEO_REQUEST or MULTIBOOT_AOUT_KLUDGE
|
||||
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
|
||||
|
||||
section .multiboot
|
||||
align 4
|
||||
multiboot:
|
||||
dd MULTIBOOT_HEADER_MAGIC
|
||||
dd MULTIBOOT_HEADER_FLAGS
|
||||
dd MULTIBOOT_CHECKSUM
|
||||
dd 0 ; header address
|
||||
dd 0 ; load address
|
||||
dd 0 ; load end address
|
||||
dd 0 ; bss end address
|
||||
dd 0 ; entry address
|
||||
dd multiboot ; header address
|
||||
dd 0x100000 ; load address
|
||||
dd stack_bottom ; load end address
|
||||
dd stack_top ; bss end address
|
||||
dd start ; entry address
|
||||
dd 0 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
|
||||
dd 1024 ; video width
|
||||
dd 768 ; video height
|
||||
dd 32 ; video depth
|
||||
|
||||
section .bss
|
||||
align 16
|
||||
stack_bottom:
|
||||
resb 16384
|
||||
stack_top:
|
||||
|
||||
section .text
|
||||
global _start
|
||||
extern kmain
|
||||
|
||||
_start:
|
||||
start:
|
||||
; Setup stack
|
||||
mov ebp, stack_bottom
|
||||
mov esp, stack_top
|
||||
|
||||
; Call the main kernel function.
|
||||
push ebx
|
||||
push eax
|
||||
call kmain
|
||||
|
||||
.hang:
|
||||
cmp eax, 0x2badb002
|
||||
jne multibootnomagic
|
||||
|
||||
mov byte [0xb8000], '!'
|
||||
|
||||
mov esi, stuff.bootmsg
|
||||
call serialinit
|
||||
call printbootmsg
|
||||
call serialwrite
|
||||
|
||||
jmp hang
|
||||
|
||||
hang:
|
||||
cli
|
||||
hlt
|
||||
jmp .hang
|
||||
jmp hang
|
||||
|
||||
multibootnomagic:
|
||||
mov esi, .msg
|
||||
mov edi, 0xb8000
|
||||
mov ah, 64
|
||||
cld
|
||||
.loop:
|
||||
lodsb
|
||||
or al, al
|
||||
jz .done
|
||||
stosw
|
||||
jmp .loop
|
||||
.done:
|
||||
jmp hang
|
||||
.msg db "No multiboot magic", 0
|
||||
|
||||
printbootmsg:
|
||||
pushad
|
||||
mov edi, 0xb8000
|
||||
cld
|
||||
.loop:
|
||||
lodsb
|
||||
or al, al
|
||||
jz .done
|
||||
stosb
|
||||
inc edi
|
||||
jmp .loop
|
||||
.done:
|
||||
popad
|
||||
ret
|
||||
|
||||
include "src/serial.asm"
|
||||
|
||||
stuff:
|
||||
.bootmsg db "=== KoalemOS ===", 0
|
||||
|
||||
|
||||
stack_bottom:
|
||||
rb 16384
|
||||
stack_top:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue