From 62c211ade1606d82f9b262b68ef074ae07e26184 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Wed, 27 Aug 2014 14:43:16 +0200 Subject: boot directory cleanup continued --- boot/disk_load_16.asm | 26 ++++++++++++++++++++++++++ boot/print_string_16.asm | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 boot/disk_load_16.asm create mode 100644 boot/print_string_16.asm (limited to 'boot') diff --git a/boot/disk_load_16.asm b/boot/disk_load_16.asm new file mode 100644 index 0000000..3d0951d --- /dev/null +++ b/boot/disk_load_16.asm @@ -0,0 +1,26 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;disk_load +; + +[bits 16] + + +;disk_load routune (load dh sectors from drive dl to es:bx) +disk_load: + + pusha + + mov ah,0x02 ;BIOS read sector func + mov al,dh ;read dh sectors (amount) + mov ch,0x00 ;cyl 0 + mov dh,0x00 ;head 0 + mov cl,0x02 ;start at sector 2 + + int 0x13 ;bios interrupt + + popa + ret + diff --git a/boot/print_string_16.asm b/boot/print_string_16.asm new file mode 100644 index 0000000..5d8ad5c --- /dev/null +++ b/boot/print_string_16.asm @@ -0,0 +1,28 @@ +[bits 16] + +;print_string routine ([bx]) +;this routine will print a null terminated string at [bx] to the screen. +print_string: + + pusha ;push all registers + mov ah,0x0e + + print_string_loop: + + ;check if value at [bx] is "\0" (end of string) + mov cl,[bx] + cmp cl,0 + je print_string_finish + + ;otherwise instruct BIOS to print the current char + mov al,cl + int 0x10 + + ;proceed with next char + inc bx + jmp print_string_loop + + print_string_finish: + + popa ;pop all registers + ret ;return to caller -- cgit v1.2.3