# Author: Susam Pal # # To assemble and link this code, execute:- # as -o string2.o string2.s # ld --oformat binary -o string2 string2.o # # To write this code into the boot sector of a device, say /dev/sdb:- # dd if=string2 of=/dev/sdb # echo -ne "\x55\xaa" | dd seek=510 bs=1 of=/dev/sdb .code16 .section .text .globl _start _start: nop xor %di, %di mov $0xb800, %ax mov %ax, %ds call pctoax add $0x1a, %ax mov %ax, %si display: mov %cs:(%si), %dl cmp $0, %dl idle: jz idle mov %dl, (%di) inc %di movb $0x1e, (%di) inc %di inc %si jmp display pctoax: pop %ax push %ax ret message: .asciz "hello, world"