setting time calling BIOS

Posted on 2005-04-20
Last Modified: 2011-04-14
Hi, I'm using a very small computer called ADAM4500 from advantech and I need to update the system time. The OS is called rom dos and is similar to ms-dos.
 The solution from advantech is calling bios function 1Ah sub function 3 but I don't know how to set paramaters and call BIOS.
The c compiler I'm using is an old compiler from ms ver 6
Can anyone help me to set time ?
Question by:pboix
    LVL 16

    Expert Comment

    Try here:

    I'll post some actual code in a minute.

    LVL 16

    Accepted Solution

    This is certainly available in C8. I'll check up about C6.

          union REGS regs;

          // Set time
          regs.h.ah = 0x03;
          // ch,cl,dh = hhmmss (BCD)
; // Set tiime to 12:34:56
          // dl is DST
          int86( 0x1a, &regs, &regs );

    Try that. Let me know if it doesnt work and I'll have another look.

    LVL 16

    Expert Comment

    >>I'll check up about C6.
    Found it! It is in both <dos.h> and <bios.h>

    LVL 4

    Assisted Solution


    void main()
    REGS regs;

     regs.h.ah = 0x03;;;;
         int86( 0x1a, &regs, &regs );

    // to see time
     regs.h.ah = 0x02;
     int86( 0x1a, &regs, &regs );

    printf ("\n hours = %d",;
    printf("\n minutes = %d",;
    printf("\n  seconds = %d",regs.h.dh);


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
    This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now