home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / clock / settime.asm < prev    next >
Assembly Source File  |  1994-03-04  |  2KB  |  63 lines

  1. --------------------------- SETTIME.DOC (cut here) ----------------------------
  2. SETTIME.COM is a program to set the BIOS timer to the correct time of
  3. day.  It is useful mostly for programs like REMIND.COM, which require
  4. the BIOS timer to accurately reflect the time, even though DOS may be
  5. getting the time directly from a clock card, via the clock.sys device
  6. driver.  The syntax is: SETTIME.  SETTIME gets the time from DOS, and
  7. writes it to the BIOS timer.
  8.  
  9. Written by Robert Lenoil; August 1985.
  10. ----------------------- end of SETTIME.DOC (cut here) -------------------------
  11.  
  12. --------------------------- SETTIME.ASM (cut here) ----------------------------
  13. ;Program to set BIOS timer to correct time of day.  If using the Microsoft
  14. ;system card with the clock.sys device driver, this is not done automatically,
  15. ;as DOS gets and sets the time directly from/to the card.  REMIND.COM needs
  16. ;the BIOS timer to be accurate.
  17. ;Robert Lenoil - August, 1985
  18.  
  19. ;Placed in the public domain, June 1986.
  20. ;Author's electronic mail address:
  21. ;USENET: lenoil@mit-eddie.uucp            ARPA: lenoil@eddie.mit.edu
  22.  
  23. BIOSDAT    SEGMENT    AT 40H
  24. ORG    6CH
  25. TIMER_LOW    DW    ?    ;low word of timer count
  26. TIMER_HIGH    DW    ?    ;high word of timer count
  27. TIMER_OFL    DB    ?    ;timer has rolled over since last read
  28. BIOSDAT    ENDS
  29. ASSUME ES:BIOSDAT
  30.  
  31. RESDNT    SEGMENT            ;handle timer interrupt
  32. ASSUME    CS:RESDNT,DS:RESDNT
  33. ORG    100h
  34. ENTRY:    MOV    AX,BIOSDAT    ;get segment of timer in ES
  35.     MOV    ES,AX
  36.     MOV    AH,2CH        ;get time from clock card (via DOS)
  37.     INT    21H
  38.     MOV    AL,CH        ;convert hours to timer ticks
  39.     SUB    AH,AH
  40.     MOV    DX,65520
  41.     MUL    DX
  42.     MOV    TIMER_HIGH,DX
  43.     MOV    TIMER_LOW,AX
  44.     MOV    AL,CL        ;convert minutes to timer ticks
  45.     SUB    AH,AH
  46.     MOV    DX,1092
  47.     MUL    DX
  48.     ADD    TIMER_LOW,AX    ;and add to hours
  49.     ADC    TIMER_HIGH,DX
  50.     MOV    AH,9        ;print msg so user knows something happened
  51.     MOV    DX,OFFSET MSG
  52.     INT    21H
  53.     MOV    AX,4C00H
  54.     MOV    TIMER_OFL,AL    ;null timer_ofl
  55.     INT    21H        ;exit
  56.  
  57. MSG    DB    "BIOS timer set.",13,10,"$"
  58.  
  59. RESDNT    ENDS
  60.  
  61. END    ENTRY
  62. ----------------------- end of SETTIME.ASM (cut here) -------------------------
  63.