summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2015-07-18 11:16:14 +0400
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2015-07-18 11:16:14 +0400
commitb4c413da4b691dfd04beb5c747dd922e097dffc1 (patch)
tree744079ee9ccb1027a770944ff0a9bf99a6d5a38b
parent22a23d6784e8104366f81a3b4902c4a1c3c3726a (diff)
Add print routine
-rw-r--r--bootloader/bootloader.asm9
-rw-r--r--bootloader/printIntBios.asm27
2 files changed, 35 insertions, 1 deletions
diff --git a/bootloader/bootloader.asm b/bootloader/bootloader.asm
index ee11e2c..f1bb48a 100644
--- a/bootloader/bootloader.asm
+++ b/bootloader/bootloader.asm
@@ -7,10 +7,11 @@ start:
;Include bios routines and jump to skip including code
jmp skipInc
%include "clearScreenIntBios.asm"
+%include "printIntBios.asm"
skipInc:
;Init CPU registers
-mov ax, 0x0C70 ;Put bootloader adress in ax register
+mov ax, 0x07C0 ;Put bootloader adress in ax register
mov ds, ax ;Init data segment
;Init stack from 0x80000 to 0x8f000
@@ -22,10 +23,16 @@ mov sp, ax ;Set stack offset
;Clear the screen
call clearScreenIntBios
+;Print msg
+mov si, helloBootloader ;load msg in si register
+call printIntBios ;print the msg
+
;Pause here !
infiniteLoop:
jmp infiniteLoop
+;Define data
+helloBootloader db "PiegOS bootloader successfully running !", 0
;Complete the MBR with nothing
times 510 - ($ - start) db 0x0
diff --git a/bootloader/printIntBios.asm b/bootloader/printIntBios.asm
new file mode 100644
index 0000000..2a6c735
--- /dev/null
+++ b/bootloader/printIntBios.asm
@@ -0,0 +1,27 @@
+printIntBios:
+
+ ;Save registers
+ push ax
+ push bx
+
+ ;Print loop
+ .loop:
+
+ mov ah, 0x0E ;Use 0xE bios service for teletype print
+ lodsb ;Load char in al and inc SI register
+ cmp al, 0x0 ;Check if we print all the chain
+ je .end ;If yes go to end
+
+ mov bl, 0x0F ;Else set color register
+
+ int 0x10 ;And print the character
+
+ jmp .loop ;Go to the next character
+ .end:
+
+ ;Restore registers
+ pop bx
+ pop ax
+
+ ;Back to previous task
+ ret