summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2015-07-18 10:23:36 +0400
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2015-07-18 10:23:36 +0400
commit9d2b511fd521fc61ed2eb6f0fc5ed23252ac3190 (patch)
tree2b74dd0c8bd575f009c1e255bc133ca84e0be674
parent707d7e38b6c3da23e99e9cbf9ad3c0cd27459c90 (diff)
Add some bios routines
-rw-r--r--bootloader/Makefile2
-rw-r--r--bootloader/bootloader.asm9
-rw-r--r--bootloader/clearScreenIntBios.asm30
-rw-r--r--bootloader/resetCursorPosIntBios.asm21
4 files changed, 61 insertions, 1 deletions
diff --git a/bootloader/Makefile b/bootloader/Makefile
index 9cb2ec5..5f252ed 100644
--- a/bootloader/Makefile
+++ b/bootloader/Makefile
@@ -2,7 +2,7 @@
bootloader.bin: bootloader.asm
- nasm -f bin -o $@ $^
+ nasm -f bin -o $@ $<
clean:
rm bootloader.bin
diff --git a/bootloader/bootloader.asm b/bootloader/bootloader.asm
index 8baeca7..db80946 100644
--- a/bootloader/bootloader.asm
+++ b/bootloader/bootloader.asm
@@ -4,14 +4,23 @@
;Save the first adress with a label to complete the MBR at the end.
start:
+
;Init CPU registers
mov ax, 0x0C70 ;Put bootloader adress in ax register
mov ds, ax ;Init data segment
+mov ax, 0x8000
+mov ss, ax
+mov ax, 0xf000
+mov sp, ax
+
+call clearScreenIntBios
;Pause here !
infiniteLoop:
jmp infiniteLoop
+%include "clearScreenIntBios.asm"
+
;Complete the MBR with nothing
times 510 - ($ - start) db 0x0
diff --git a/bootloader/clearScreenIntBios.asm b/bootloader/clearScreenIntBios.asm
new file mode 100644
index 0000000..4739430
--- /dev/null
+++ b/bootloader/clearScreenIntBios.asm
@@ -0,0 +1,30 @@
+clearScreenIntBios:
+
+ ;Save registers
+ push ax
+ push bx
+ push cx
+ push dx
+
+ mov ax, 0x0600 ;Clear
+ mov bx, 0x0F00 ;Color black behind white foreground
+
+ mov cx, 0x0000 ;Top left corner
+ mov dx, 0x5050 ;Bottom right corner 80x80
+
+ int 0x10 ;Clear the screen
+
+ ;Restore registers
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+
+ ;Reset Cursor Position
+ call resetCursorPosIntBios
+
+ ;Back to previous task
+ ret
+
+;Include resetCursorPosIntBios
+%include "resetCursorPosIntBios.asm"
diff --git a/bootloader/resetCursorPosIntBios.asm b/bootloader/resetCursorPosIntBios.asm
new file mode 100644
index 0000000..18cb0d2
--- /dev/null
+++ b/bootloader/resetCursorPosIntBios.asm
@@ -0,0 +1,21 @@
+resetCursorPosIntBios:
+
+ ;Save registers
+ push ax
+ push bx
+ push dx
+
+ mov ax, 0x0200 ;Move cursor interrupt
+ mov bx, 0x0000 ; X position
+ mov dx, 0x0000 ; Y Position
+
+ ;Call 0x10 interrupt service
+ int 0x10
+
+ ;Restore registers
+ pop dx
+ pop bx
+ pop ax
+
+ ;Back to previous task
+ ret