BITS 16 org $0000 stage2_start: mov ax, 0 mov ss, ax ; Set stack segment and pointer mov sp, $0000 mov ax, $1000 ; Set segments to where we're loaded mov ds, ax mov si, str_stage2loaded ; Put string position into SI call print_string ; Call string printing routine jmp $ ; Jump here - infinite loop! ;======================================================================================== ; Outputs the string in SI to the VGA adapter in text mode using INT10h. ;======================================================================================== print_string: mov ah, $0E ; int 10h 'print char' function .repeat: lodsb ; Get character from string cmp al, 0 je .done ; If char is zero, end of string cmp al, $0A ; Process newline je .newline int $10 ; Otherwise, print it (jump into BIOS) jmp .repeat .done: ret .newline: mov ah, $0E mov al, $0D int $10 mov al, $0A int $10 mov ah, $0E ; int 10h 'print char' function jmp .repeat ;======================================================================================== ; DATA SECTION ;======================================================================================== str_stage2loaded: db 'Stage 2 loaded!', 0