From 6034fe25733e8c48c8b0b03424f7d72b2a8bd75a Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Fri, 23 Jan 2015 20:40:44 -0800 Subject: [PATCH] Bootloader prints a welcome string --- bootloader.S | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/bootloader.S b/bootloader.S index 33672e3..9e610bf 100644 --- a/bootloader.S +++ b/bootloader.S @@ -1,7 +1,28 @@ -[BITS 16] ; 16 bit real mode code -[ORG 0x7C00] ; Origin at 0x7C00 (upper end of memory) +[bits 16] ; 16 bit real mode code +[org 0x7C00] ; Origin at 0x7C00 (upper end of memory) -JMP $ ; hang forever +mov si, _str_hello ; si = source index +call printString +jmp $ ; hang forever -TIMES 510 - ($ - $$) db 0 ; fill up to 510 bytes with 0 -DW 0xAA55 ; magic bootloader signature \ No newline at end of file +printCharacter: ; print a single character to the display +mov ah, 0x0e ; int 0x10 is the entire display control, + ; 0x0e means teletype output +mov bh, 0x00 ; Print on the zero (primary) page +mov bl, 0x07 ; Color. 0x07 is grey on black. +int 0x10 +ret + +printString: ; print the entire string pointed to by si +mov al, [si] ; [x] == *x, dereferencing source index +call printCharacter +inc si +cmp al, 0x0 ; found the trailing NULL? +jne printString +ret + + +_str_hello db 'Piquant v0.1 Bootloader', 0 ; String + trailing NULL + +times 510 - ($ - $$) db 0 ; fill up to 510 bytes with 0 +dw 0xAA55 ; magic bootloader signature \ No newline at end of file