So I started 2 days ago on my own OS not knowing a bit of assembly and I have to say I'm surprised at how straight forward it is. However... I have a problem. When I call int $0x10 my OS dies... Everything I've read said this should work just fine.
Code: Select all
.global loader # making entry point visible to linker
# setting up the Multiboot header - see GRUB docs for details
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum required
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
# reserve initial kernel stack space
.set STACKSIZE, 0x4000 # that is, 16k.
.comm stack, STACKSIZE, 32 # reserve 16k stack on a quadword boundary
loader:
mov $(stack + STACKSIZE), %esp
push $15
call txt_clear # Clears screen
mov $2, %AH
mov $0, %BH
mov $0, %DH
mov $0, %DL
int $0x10 # Moves cursor
#push %eax
#push %ebx
#call kmain # call kernel proper
cli
hang:
hlt # halt machine should kernel return
jmp hang