I'm not a C/ASM developer and I would like to get current date and time from RTC with a Windows program.
Here, I found a C code to do this.
I changed that code in the following way, and I compiled it with Visual Studio 2017 cl.exe compiler without errors and warnings:
#include <stdio.h>
int main()
{
unsigned char tvalue, index;
printf("STARTING...\n");
for(index = 0; index < 128; index++)
{
__asm
{
cli /* Disable interrupts */
mov al, index /* Move index address */
/* since the 0x80 bit of al is not set, */
/* NMI is active */
out 0x70, al /* Copy address to CMOS register */
/* some kind of real delay here is probably best */
in al, 0x71 /* Fetch 1 byte to al */
sti /* Enable interrupts */
mov tvalue, al
}
printf("%u\n", (unsigned int)tvalue);
}
printf("FINISHED!\n");
return 0;
}
When I try to execute the exe from the command prompt, I don't see anything, only the row "STARTING...".
What am I doing wrong?
Thanks a lot.