ORG 0x0 BITS 16 _start: jmp short start nop ; Setup dummy BIOS Parameter block so a dumb BIOS does not corrupt us ; if it starts messing up with the parameter block times 33 db 0 start: ; Set CS to 0x07c0 with label step2 as its beginning offset jmp 0x07c0:step2 step2: ; Setup segments cli ; Disable interrupts mov ax, 0x07c0 mov ds, ax mov es, ax mov ax, 0x00 mov ss, ax mov sp, 0x7c00 ; Stack segment starts right before ds ; and grows down to 0x0. This works because ; Intel implements a full descending stack sti ; Enable interrupts jmp $ ; Message Print routines print: mov bx, 0 .loop lodsb cmp al, 0 je .done call print_char jmp .loop .done: ret print_char: mov ah, 0x0e int 0x10 ret ; Fill in to the end and add bootloader signature times 510 - ($ - $$) db 0 dw 0xAA55