Add some bios routines
This commit is contained in:
parent
707d7e38b6
commit
9d2b511fd5
4 changed files with 61 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
bootloader.bin: bootloader.asm
|
||||
nasm -f bin -o $@ $^
|
||||
nasm -f bin -o $@ $<
|
||||
|
||||
clean:
|
||||
rm bootloader.bin
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
30
bootloader/clearScreenIntBios.asm
Normal file
30
bootloader/clearScreenIntBios.asm
Normal file
|
@ -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"
|
21
bootloader/resetCursorPosIntBios.asm
Normal file
21
bootloader/resetCursorPosIntBios.asm
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue