bios_clear_screen.S 813 B

123456789101112131415161718192021222324252627282930313233
  1. /* https://github.com/cirosantilli/x86-bare-metal-examples#bios-clear-screen */
  2. #include "common.h"
  3. BEGIN
  4. /* Print one 'a' char to ensure that something will be cleared.
  5. *
  6. * On some systems, BIOS messages get automatically cleared. Not the case for QEMU 2.0.0.
  7. * */
  8. PUTC $'a
  9. /* Scroll 0 is magic, and scrolls the entire selected rectangle. */
  10. mov $0x0600, %ax
  11. mov $0xA4, %bh
  12. /* Pick the entire screen.
  13. * Bottom right is at (24,79) == (0x18,0x4F),
  14. * since we are on the default mode.
  15. */
  16. mov $0x0000, %cx
  17. mov $0X184F, %dx
  18. int $0x10
  19. /* Print a 'b' char to see where we are now.
  20. *
  21. * TODO, on ThinkPad T400, the cursor gets put back to the initial position. But QEMU 2.0.0 leaves it in the middle ofthe screen. Thus we reset the position to make them work the same way.
  22. */
  23. CURSOR_POSITION
  24. PUTC $'b
  25. hlt