# Author: Susam Pal # # To assemble and link this code, execute the following commands:- # as -o char.o char.s # ld --oformat binary -o char char.o # # To write this code into the boot sector of a device, say /dev/sdb:- # dd if=char of=/dev/sdb # echo -ne "\x55\xaa" | dd seek=510 bs=1 of=/dev/sdb .code16 .globl _start .org 0x00 .section .text _start: movw $0x0C70, %ax movw %ax, %ds movw %ax,%es movw $0x8000,%ax movw %ax,%ss movw $0xf000,%ax movw %ax,%sp movw $message,%si call print print: push %ax push %bx .debut: lodsb cmpw %ax,0 jz .end movb $0x0E,%ah movw $0x07,%bx int $0x10 jmp .debut .end: pop %bx pop %ax ret idle: jmp idle .section .data message: .asciz "Hello the world"