ReactOS  0.4.15-dev-976-g0f66c66
pc98rtc.c File Reference
#include <freeldr.h>
Include dependency graph for pc98rtc.c:

Go to the source code of this file.

Macros

#define BCD_INT(bcd)   (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
 

Functions

TIMEINFOPc98GetTime (VOID)
 

Macro Definition Documentation

◆ BCD_INT

#define BCD_INT (   bcd)    (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))

Definition at line 10 of file pc98rtc.c.

Function Documentation

◆ Pc98GetTime()

TIMEINFO* Pc98GetTime ( VOID  )

Definition at line 13 of file pc98rtc.c.

14 {
15  static TIMEINFO TimeInfo;
16  REGS Regs;
17  UCHAR SysTime[6];
18 
19  /* Int 1Ch AH=00h
20  * TIMER BIOS - Read system time
21  *
22  * Call with:
23  * ES:BX -> data buffer
24  */
25  Regs.b.ah = 0x00;
26  Regs.w.es = ((ULONG_PTR)SysTime) >> 4;
27  Regs.w.bx = ((ULONG_PTR)SysTime) & 0x0F;
28  Int386(0x1C, &Regs, &Regs);
29 
30  TimeInfo.Year = BCD_INT(SysTime[0]);
31  TimeInfo.Month = BCD_INT(SysTime[1] >> 4);
32  TimeInfo.Day = BCD_INT(SysTime[2]);
33  TimeInfo.Hour = BCD_INT(SysTime[3]);
34  TimeInfo.Minute = BCD_INT(SysTime[4]);
35  TimeInfo.Second = BCD_INT(SysTime[5]);
36  if (TimeInfo.Year >= 80)
37  TimeInfo.Year += 1900;
38  else
39  TimeInfo.Year += 2000;
40 
41  return &TimeInfo;
42 }
unsigned short es
Definition: pcbios.h:115
unsigned char ah
Definition: pcbios.h:126
USHORT Second
Definition: fw.h:16
USHORT Month
Definition: fw.h:12
int __cdecl Int386(int ivec, REGS *in, REGS *out)
USHORT Minute
Definition: fw.h:15
Definition: fw.h:9
#define BCD_INT(bcd)
Definition: pc98rtc.c:10
USHORT Year
Definition: fw.h:11
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTEREGS b
Definition: pcbios.h:157
USHORT Hour
Definition: fw.h:14
unsigned short bx
Definition: pcbios.h:106
Definition: pcbios.h:152
#define ULONG_PTR
Definition: config.h:101
USHORT Day
Definition: fw.h:13
WORDREGS w
Definition: pcbios.h:156

Referenced by MachInit().