von

Hello, World! Kernel in NASM Assambler

; nasm -f elf -o test.o kernel.asm
; ld -melf_i386 -Ttext=0x100000 -e start test.o

section .data
message		db	"hello, world!"
msglength	equ	$ - message

section .text
global start
 
; MB_MAGIC 0x1badb002 (Version 0.6.96)
; MB_MAGIC 0xe85250d6 (Version 1.6.)
; MB_FLAGS 0x0
; MB_CHECKSUM -(MB_MAGIC + MB_FLAGS)
 
; Multiboot Header
align 4
		dd	0x1badb002
		dd	0x0
		dd	-(0x1badb002 - 0x0)
start:
	mov ebx, 0

print:	
	mov eax, [message + ebx]
	mov [0xb8000 + ebx * 2], eax
	mov [0xb8000 + ebx * 2 + 1], dword 0x07
	add ebx, 1
	cmp ebx, msglength
	jnz print
	
stop:
	cli
	hlt
	jmp stop