Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
4.3 KiB

  1. ;/*
  2. ;++
  3. ;
  4. ; Copyright (c) 1989 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; ixcmos.inc
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This module contains common definitions used by the CMOS.
  13. ;
  14. ; Author:
  15. ;
  16. ; Landy Wang (corollary!landy) 04-Dec-1992
  17. ;
  18. ; (Moved from ixclock.asm)
  19. ;
  20. ;--
  21. ;
  22. ; _HalpAcquireCmosSpinLock and _HalpReleaseCmosSpinLock
  23. ; must be called before accessing the CMOS in both uniprocessor
  24. ; and multiprocessor systems.
  25. RTCIRQ EQU 8 ; IRQ number for RTC interrupt
  26. CMOS_CONTROL_PORT EQU 70h ; command port for cmos
  27. CMOS_DATA_PORT EQU 71h ; cmos data port
  28. REGISTER_B_ENABLE_PERIODIC_INTERRUPT EQU 01000010B
  29. ; RT/CMOS Register 'B' Init byte
  30. ; Values for byte shown are
  31. ; Bit 7 = Update inhibit
  32. ; Bit 6 = Periodic interrupt enable
  33. ; Bit 5 = Alarm interrupt disable
  34. ; Bit 4 = Update interrupt disable
  35. ; Bit 3 = Square wave disable
  36. ; Bit 2 = BCD data format
  37. ; Bit 1 = 24 hour time mode
  38. ; Bit 0 = Daylight Savings disable
  39. REGISTER_B_DISABLE_PERIODIC_INTERRUPT EQU 00000010B
  40. REGISTER_B_ENABLE_ALARM_INTERRUPT EQU 00100000B
  41. REGISTER_B_DISABLE_ALARM_INTERRUPT EQU 00000000B
  42. REGISTER_B_24HOUR_MODE EQU 00000010B
  43. ;
  44. ; CMOS_READ
  45. ;
  46. ; Description: This macro reads a byte from the CMOS register specified
  47. ; in (AL).
  48. ;
  49. ; Parameter: (AL) = address/register to read
  50. ; Returns: (AL) = data
  51. ;
  52. CMOS_READ MACRO
  53. OUT CMOS_CONTROL_PORT,AL ; ADDRESS LOCATION AND DISABLE NMI
  54. IODelay ; I/O DELAY
  55. IN AL,CMOS_DATA_PORT ; READ IN REQUESTED CMOS DATA
  56. IODelay ; I/O DELAY
  57. ENDM
  58. ;
  59. ; CMOS_WRITE
  60. ;
  61. ; Description: This macro reads a byte from the CMOS register specified
  62. ; in (AL).
  63. ;
  64. ; Parameter: (AL) = address/register to read
  65. ; (AH) = data to be written
  66. ;
  67. ; Return: None
  68. ;
  69. CMOS_WRITE MACRO
  70. OUT CMOS_CONTROL_PORT,AL ; ADDRESS LOCATION AND DISABLE NMI
  71. IODelay ; I/O DELAY
  72. MOV AL,AH ; (AL) = DATA
  73. OUT CMOS_DATA_PORT,AL ; PLACE IN REQUESTED CMOS LOCATION
  74. IODelay ; I/O DELAY
  75. ENDM
  76. CMOS_STATUS_BUSY EQU 80H ; Time update in progress
  77. RTC_OFFSET_SECOND EQU 0 ; second field of RTC memory
  78. RTC_OFFSET_SECOND_ALARM EQU 1 ; second alarm field of RTC memory
  79. RTC_OFFSET_MINUTE EQU 2 ; minute field of RTC memory
  80. RTC_OFFSET_MINUTE_ALARM EQU 3 ; minute alarm field of RTC memory
  81. RTC_OFFSET_HOUR EQU 4 ; hour field of RTC memory
  82. RTC_OFFSET_HOUR_ALARM EQU 5 ; hour alarm field of RTC memory
  83. RTC_OFFSET_DAY_OF_WEEK EQU 6 ; day-of-week field of RTC memory
  84. RTC_OFFSET_DATE_OF_MONTH EQU 7 ; date-of-month field of RTC memory
  85. RTC_OFFSET_MONTH EQU 8 ; month field of RTC memory
  86. RTC_OFFSET_YEAR EQU 9 ; year field of RTC memory
  87. RTC_OFFSET_CENTURY_MCA EQU 37h ; Century field of RTC memory for MCA
  88. RTC_OFFSET_CENTURY EQU 32h ; Century field of RTC memory
  89. RTC_OFFSET_CENTURY_DS EQU 148h ; Bank 1, 48. Century field for DS
  90. BANK1 EQU 100h
  91. ;
  92. ; BCD_TO_BIN
  93. ;
  94. ; Description: Convert BCD value to binary
  95. ;
  96. ; Parameter:
  97. ; Input: (AL) = 2 digit BCD number to convert
  98. ; Output: (AX) = Binary equivalent (all in AL)
  99. ;
  100. ; Return: None.
  101. ;
  102. BCD_TO_BIN macro
  103. xor ah,ah
  104. rol ax,4
  105. ror al,4
  106. aad
  107. endm
  108. ;
  109. ; BIN_TO_BCD
  110. ;
  111. ; Description: Convert binary value to BCD.
  112. ;
  113. ; Parameter:
  114. ; Input: (AL) = binary value to be converted.
  115. ; Output: (AX) = BCD (all in AL)
  116. ;
  117. ; Return: None.
  118. ;
  119. BIN_TO_BCD macro
  120. aam
  121. rol al, 4
  122. ror ax, 4
  123. endm