Initial port to Linux (using Allegro).
64-bit fixes. Some changes to aid portability. A few other tweaks.
This commit is contained in:
parent
4b3f77c926
commit
56b455844e
70 changed files with 12702 additions and 282 deletions
43
src/win-time.c
Normal file
43
src/win-time.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <windows.h>
|
||||
#include "ibm.h"
|
||||
#include "nvr.h"
|
||||
|
||||
void time_get(char *nvrram)
|
||||
{
|
||||
SYSTEMTIME systemtime;
|
||||
int c, d;
|
||||
uint8_t baknvr[10];
|
||||
|
||||
memcpy(baknvr,nvrram,10);
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
d = systemtime.wSecond % 10;
|
||||
c = systemtime.wSecond / 10;
|
||||
nvrram[0] = d | (c << 4);
|
||||
d = systemtime.wMinute % 10;
|
||||
c = systemtime.wMinute / 10;
|
||||
nvrram[2] = d | (c << 4);
|
||||
d = systemtime.wHour % 10;
|
||||
c = systemtime.wHour / 10;
|
||||
nvrram[4] = d | (c << 4);
|
||||
d = systemtime.wDayOfWeek % 10;
|
||||
c = systemtime.wDayOfWeek / 10;
|
||||
nvrram[6] = d | (c << 4);
|
||||
d = systemtime.wDay % 10;
|
||||
c = systemtime.wDay / 10;
|
||||
nvrram[7] = d | (c << 4);
|
||||
d = systemtime.wMonth % 10;
|
||||
c = systemtime.wMonth / 10;
|
||||
nvrram[8] = d | (c << 4);
|
||||
d = systemtime.wYear % 10;
|
||||
c = (systemtime.wYear / 10) % 10;
|
||||
nvrram[9] = d | (c << 4);
|
||||
if (baknvr[0] != nvrram[0] ||
|
||||
baknvr[2] != nvrram[2] ||
|
||||
baknvr[4] != nvrram[4] ||
|
||||
baknvr[6] != nvrram[6] ||
|
||||
baknvr[7] != nvrram[7] ||
|
||||
baknvr[8] != nvrram[8] ||
|
||||
baknvr[9] != nvrram[9])
|
||||
nvrram[0xA]|=0x80;
|
||||
}
|
||||
Loading…
Reference in a new issue