diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-14 10:44:00 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-14 10:44:00 +0200 |
| commit | dc7bf2f47d6f97407e3b50ae0b8ab59fd51079e5 (patch) | |
| tree | 1ed444c804d9ff55e23a7a007275c3d5c649a455 /xxx/boot2/common_pm.asm | |
| parent | 7df4060ae807dd27f3ae0a11f243897f36053ba1 (diff) | |
moving unused files folder
Diffstat (limited to 'xxx/boot2/common_pm.asm')
| -rw-r--r-- | xxx/boot2/common_pm.asm | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/xxx/boot2/common_pm.asm b/xxx/boot2/common_pm.asm new file mode 100644 index 0000000..c96e1a8 --- /dev/null +++ b/xxx/boot2/common_pm.asm @@ -0,0 +1,86 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;print_string_pm +;print_hex_pm +; +; +; + +[bits 32] + +VIDEO_MEM equ 0xb8000 +WHITE_ON_BLACK equ 0x0f + +;global data +STR_HEX_OUT_PM: + db "0x0000",0 + +; print [ebx] at ecx +print_string_pm: + pusha + mov edx, VIDEO_MEM + add edx,ecx + print_string_pm_loop: + mov al,[ebx] + mov ah, WHITE_ON_BLACK + cmp al,0 + je print_string_pm_done + mov [edx],ax + add ebx,1 + add edx,2 + jmp print_string_pm_loop + +print_string_pm_done: + popa + ret + +;print_hex_pm routine (dx) at ecx +;will print the value of the bx register as hex to the screen +print_hex_pm: + + pusha + + + ;begin with last hex val (hex_out[5]) + mov bx,STR_HEX_OUT_PM+5 + + ;lets loop throuth all 4 'digits' + print_hex_pm_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_pm_setnum + + ;set hex a-f + mov al,'A'-10 + add al,cl + jmp print_hex_pm_al + + ;set hex 0-9 + print_hex_pm_setnum: + mov al,'0' + add al,cl + + ; set hex_out[bx] to al + print_hex_pm_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_PM+1 + jne print_hex_pm_loop + + ;output complete hex string and return to caller + popa + mov bx,STR_HEX_OUT_PM + call print_string_pm + ret |
