bios_sleep.S 429 B

1234567891011121314151617181920212223
  1. /* https://github.com/cirosantilli/x86-bare-metal-examples#bios-sleep */
  2. #include "common.h"
  3. BEGIN
  4. /* Must enable interrupts, since BIOS uses
  5. * them to increment the timer.
  6. */
  7. sti
  8. mov $0, %dx
  9. infinite:
  10. mov $18, %cx
  11. mov 0x046C, %bx
  12. one_sec:
  13. mov 0x046C, %ax
  14. cmp %ax, %bx
  15. je one_sec
  16. mov %ax, %bx
  17. loop one_sec
  18. PRINT_WORD_HEX <%dx>
  19. PRINT_NEWLINE
  20. inc %dx
  21. jmp infinite