bios_pixel.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. Set pixel at position (1, 1) to a clear red color (0Ch) in 13h video mode.
  3. You have to look a bit hard to see it.
  4. Mode 13h has: 320x200 Graphics, 256 colors, 1 page.
  5. https://en.wikipedia.org/wiki/Mode_13h describes it a bit.
  6. TODO Color encoding: is there any logic?
  7. Shown on wiki page: https://en.wikipedia.org/wiki/Mode_13h
  8. Does not seem to be R R R G G G B B mentioned at: https://en.wikipedia.org/wiki/8-bit_color
  9. Asked at: http://stackoverflow.com/questions/14233437/convert-normal-256-color-to-mode-13h-version-color
  10. Things get much more involved from protected mode:
  11. http://stackoverflow.com/questions/14419088/how-to-draw-a-pixel-on-the-screen-in-protected-mode-in-x86-assembly
  12. TODO do it!
  13. And for hardware accelaration, you need to make real drivers
  14. (to semi-documented complex GPU hardware :-) )
  15. http://wiki.osdev.org/How_do_I_set_a_graphics_mode
  16. */
  17. #include "common.h"
  18. BEGIN
  19. /* Enter video mode 13h: */
  20. mov $0x0013, %ax
  21. int $0x10
  22. start:
  23. /*
  24. Draw the pixel pixel.
  25. AH = 0Ch
  26. AL = Color
  27. BH = Page Number
  28. CX = x
  29. DX = y
  30. */
  31. mov $0x0C0C, %ax
  32. mov $0x01, %bh
  33. mov $0x0001, %cx
  34. mov $0x0001, %dx
  35. int $0x10
  36. inc %cx
  37. inc %dx
  38. cmp $201, %dx
  39. jz end
  40. jmp start
  41. end:
  42. hlt