Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .686 ;32 bit code
- .Model flat, StdCall ;32 bit memory model
- Option CaseMap:none ;case sensitive
- ; setting up the Multiboot header - see GRUB docs for details
- .Const
- MODULEALIGN Equ 1 Shl 0 ; align loaded modules on page boundaries
- MEMINFO Equ 1 Shl 1 ; provide memory map
- Align 4
- .Data
- MAGIC DD 1BADB002h
- FLAGS DD (MODULEALIGN or MEMINFO)
- CHECKSUM DD (-(1BADB002h + (MODULEALIGN or MEMINFO)))
- Align 4
- .Data?
- Stack Byte 4000h Dup(?)
- .Code
- Start:
- Mov Ecx, Offset Stack
- Add Ecx, 4000h
- Mov Esp, Ecx; set up the stack
- push eax ; pass Multiboot magic number
- push ebx ; pass Multiboot info structure
- call kmain ; call kernel proper
- cli
- hang:
- hlt ; halt machine should kernel return
- jmp hang
- kmain:
- Pop Eax
- Pop Ebx
- Mov Ah, 65
- Mov Ecx, 0B80000h
- Mov Byte Ptr[Ecx], Ah
- Mov Ah, 07h
- Inc Ecx
- Mov Byte Ptr[Ecx], Ah
- End Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement