dhilst

Boot hello world

; Tell the compiler that this is the 0 address
[ORG 0]
jmp 07C0h:start ; Jump to start

msg db "Hello boot world ", 2, 0 ; My string
; the 2 byte should provide some fun

start:

; Setting up the segment registers

mov ax, cs
mov ds, ax
mov es, ax


; Writing the string

mov si, msg
print: lodsb
cmp al, 0
je hang
mov ah, 0Eh
mov bx, 7
int 010h ; BIOS video service interrupt

jmp print


hang:
jmp hang


times 510-($-$$) db 0
dw 0AA55h

.

I saw this here, so is not my merit..

to run:
copy this to a .asm file, e.g. b.asm, then assemble it with
$ nasm -o b.bin b.asm
and finaly write it to some pendrive with
dd if=b.bin of=/dev/YOURPENDRIVE
e.g $ dd if=b.bin of=/dev/sdc
Boot the pendrive and you should get a funny message on screen =)
if you have qemu installed you can boot directly the binary
$ qemu -hda b.bin