rtc.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* TODO what do those numbers mean? Where is this all documented? */
  2. .equ RTCaddress, 0x70
  3. .equ RTCdata, 0x71
  4. #include "common.h"
  5. BEGIN
  6. update_in_progress:
  7. mov $10, %al
  8. out %al, $RTCaddress
  9. in $RTCdata, %al
  10. testb $0x80, %al
  11. jne update_in_progress
  12. /* Second. */
  13. mov $0, %al
  14. out %al, $RTCaddress
  15. in $RTCdata, %al
  16. /* Only print if second changed. */
  17. cmp %al, %cl
  18. je update_in_progress
  19. mov %al, %cl
  20. PRINT_HEX <%al>
  21. PUTC
  22. /* Minute. */
  23. mov $0x02, %al
  24. out %al, $RTCaddress
  25. in $RTCdata, %al
  26. PRINT_HEX <%al>
  27. PUTC
  28. /* Hour. */
  29. mov $0x04, %al
  30. out %al, $RTCaddress
  31. in $RTCdata, %al
  32. PRINT_HEX <%al>
  33. PUTC
  34. /* Day. */
  35. mov $0x07, %al
  36. out %al, $RTCaddress
  37. in $RTCdata, %al
  38. PRINT_HEX <%al>
  39. PUTC
  40. /* Month. */
  41. mov $0x08, %al
  42. out %al, $RTCaddress
  43. in $RTCdata, %al
  44. PRINT_HEX <%al>
  45. PUTC
  46. /* Year. */
  47. mov $0x09, %al
  48. out %al, $RTCaddress
  49. in $RTCdata, %al
  50. PRINT_HEX <%al>
  51. PRINT_NEWLINE
  52. jmp update_in_progress