32bit-print.asm 598 B

1234567891011121314151617181920212223242526
  1. [bits 32] ; using 32-bit protected mode
  2. ; this is how constants are defined
  3. VIDEO_MEMORY equ 0xb8000
  4. WHITE_OB_BLACK equ 0x0f ; the color byte for each character
  5. print_string_pm:
  6. pusha
  7. mov edx, VIDEO_MEMORY
  8. print_string_pm_loop:
  9. mov al, [ebx] ; [ebx] is the address of our character
  10. mov ah, WHITE_OB_BLACK
  11. cmp al, 0 ; check if end of string
  12. je print_string_pm_done
  13. mov [edx], ax ; store character + attribute in video memory
  14. add ebx, 1 ; next char
  15. add edx, 2 ; next video memory position
  16. jmp print_string_pm_loop
  17. print_string_pm_done:
  18. popa
  19. ret