bios_scroll.S 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. BIOS has a scroll function!
  3. Very convenient, otherwise that would be hard to implement.
  4. How it works:
  5. Before scroll:
  6. a
  7. b
  8. c
  9. d
  10. We then choose to act on the rectangle with corners
  11. (1, 1) and (2, 2)} given by cx and dx:
  12. a
  13. XX
  14. XX
  15. d
  16. and scroll that rectangle down by one line (al).
  17. The final outcome is:
  18. a
  19. c
  20. NN
  21. d
  22. where `N` are new squares generated by the scroll,
  23. which gets filled with the background color in bh.
  24. */
  25. #include "common.h"
  26. BEGIN
  27. CLEAR
  28. PRINT_STRING $stair
  29. /* Function ID. */
  30. mov $0x06, %ah
  31. /* nr. of lines to scroll */
  32. mov $0x01, %al
  33. /*
  34. BIOS color attributes.
  35. Background is the clear color.
  36. Foreground is set as the new foreground color.
  37. */
  38. mov $0xA4, %bh
  39. /*
  40. CH,CL: row,column upper left corner (00:00)
  41. TODO what does that mean?
  42. */
  43. mov $0x0101, %cx
  44. /*
  45. DH,DL: row,column lower right corner (24:79).
  46. TODO what does it mean?
  47. */
  48. mov $0x0202, %dx
  49. int $0x10
  50. hlt
  51. stair:
  52. .asciz "a\nb\nc\nd"