.code16 .globl start .org 0x0, 0x0 start: movl $0x7c0, %eax movw %ax, %ds xorl %ebx, %ebx movw %bx, %ss movl $0x7c00, %esp # set up the stack movb %dl, %bl movl $(boot_message+0xf), %edi shrb $0x4, %bl movb hexchars(%ebx), %al movb %al, (%edi) incl %edi movb %dl, %bl andb $0xf, %bl movb hexchars(%ebx), %al movb %al, (%edi) movl $message, %esi call putstr movl $crlf, %esi call putstr movl $boot_message, %esi call putstr end: jmp end nop nop putstr: lodsb testb %al,%al # stop at null jnz putc ret # return when null is hit putc: movl $0x7,%ebx movb $0xe,%ah # BIOS: put_char int $0x10 # call BIOS, print char in %al jmp putstr # keep looping message: .ascii "Testing, 1... 2... 3..." crlf: .byte 13, 10, 0 hexchars: .ascii "0123456789abcdef" boot_message: .asciz "boot device: 0xXX"