diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-08-07 03:01:23 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-08-07 03:01:23 +0200 |
| commit | c8a976eced96f3af4a17d756c34cdd566ffa8a9e (patch) | |
| tree | 7057c4216d81e0e98a50078acec84f9de702b370 /boot/common.asm | |
| parent | 8fd3b2abfc04be1deb3b737e8525caec66808fb4 (diff) | |
optimized MBR and added memmap identification
Diffstat (limited to 'boot/common.asm')
| -rw-r--r-- | boot/common.asm | 167 |
1 files changed, 84 insertions, 83 deletions
diff --git a/boot/common.asm b/boot/common.asm index c241f55..323b54f 100644 --- a/boot/common.asm +++ b/boot/common.asm @@ -12,89 +12,90 @@ [bits 16] - -;global data -STR_HEX_OUT: - db "0x0000",0 - -;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 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;print_hex routine (dx) -;will print the value of the bx register as hex to the screen -print_hex: - - pusha - - ;begin with last hex val (hex_out[5]) - mov bx,STR_HEX_OUT+5 - - ;lets loop throuth all 4 'digits' - print_hex_loop: - - ;get least significan hex digit to cx - mov cx,dx - and cx,0x000F - - ;check range (0-9 vs a-f) - cmp cx,10 - jl print_hex_setnum - - ;set hex a-f - mov al,'A'-10 - add al,cl - jmp print_hex_al - - ;set hex 0-9 - print_hex_setnum: - mov al,'0' - add al,cl - - ; set hex_out[bx] to al - print_hex_al: - mov [bx],al - - ;proceed with the next significant hex 'digit' - dec bx - shr dx,4 - - ;check if finished (otherwise loop) - cmp bx,STR_HEX_OUT+1 - jne print_hex_loop - - ;output complete hex string and return to caller - mov bx,STR_HEX_OUT - call print_string - popa - ret - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;/* +;;global data +;STR_HEX_OUT: +; db "0x0000",0 +; +;;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 +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;;print_hex routine (dx) +;;will print the value of the bx register as hex to the screen +;print_hex: +; +; pusha +; +; ;begin with last hex val (hex_out[5]) +; mov bx,STR_HEX_OUT+5 +; +; ;lets loop throuth all 4 'digits' +; print_hex_loop: +; +; ;get least significan hex digit to cx +; mov cx,dx +; and cx,0x000F +; +; ;check range (0-9 vs a-f) +; cmp cx,10 +; jl print_hex_setnum +; +; ;set hex a-f +; mov al,'A'-10 +; add al,cl +; jmp print_hex_al +; +; ;set hex 0-9 +; print_hex_setnum: +; mov al,'0' +; add al,cl +; +; ; set hex_out[bx] to al +; print_hex_al: +; mov [bx],al +; +; ;proceed with the next significant hex 'digit' +; dec bx +; shr dx,4 +; +; ;check if finished (otherwise loop) +; cmp bx,STR_HEX_OUT+1 +; jne print_hex_loop +; +; ;output complete hex string and return to caller +; mov bx,STR_HEX_OUT +; call print_string +; popa +; ret +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;*/ ;disk_load routune (load dh sectors from drive dl to es:bx) disk_load: |
