cfenollosa_os-tutorial/14-checkpoint/boot/32bit_print.asm
CJ 830d0dc9cb
Update 32bit_print.asm
Typo, "WHITE_OB_BLACK" should be 'WHITE_ON_BLACK'
2022-04-13 17:18:04 -04:00

27 lines
598 B
NASM

[bits 32] ; using 32-bit protected mode
; this is how constants are defined
VIDEO_MEMORY equ 0xb8000
WHITE_OB_BLACK equ 0x0f ; the color byte for each character
print_string_pm:
pusha
mov edx, VIDEO_MEMORY
print_string_pm_loop:
mov al, [ebx] ; [ebx] is the address of our character
mov ah, WHITE_ON_BLACK
cmp al, 0 ; check if end of string
je print_string_pm_done
mov [edx], ax ; store character + attribute in video memory
add ebx, 1 ; next char
add edx, 2 ; next video memory position
jmp print_string_pm_loop
print_string_pm_done:
popa
ret