home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
msdos
/
sysutl
/
settime.asm
< prev
next >
Wrap
Assembly Source File
|
1986-06-13
|
2KB
|
63 lines
--------------------------- SETTIME.DOC (cut here) ----------------------------
SETTIME.COM is a program to set the BIOS timer to the correct time of
day. It is useful mostly for programs like REMIND.COM, which require
the BIOS timer to accurately reflect the time, even though DOS may be
getting the time directly from a clock card, via the clock.sys device
driver. The syntax is: SETTIME. SETTIME gets the time from DOS, and
writes it to the BIOS timer.
Written by Robert Lenoil; August 1985.
----------------------- end of SETTIME.DOC (cut here) -------------------------
--------------------------- SETTIME.ASM (cut here) ----------------------------
;Program to set BIOS timer to correct time of day. If using the Microsoft
;system card with the clock.sys device driver, this is not done automatically,
;as DOS gets and sets the time directly from/to the card. REMIND.COM needs
;the BIOS timer to be accurate.
;Robert Lenoil - August, 1985
;Placed in the public domain, June 1986.
;Author's electronic mail address:
;USENET: lenoil@mit-eddie.uucp ARPA: lenoil@eddie.mit.edu
BIOSDAT SEGMENT AT 40H
ORG 6CH
TIMER_LOW DW ? ;low word of timer count
TIMER_HIGH DW ? ;high word of timer count
TIMER_OFL DB ? ;timer has rolled over since last read
BIOSDAT ENDS
ASSUME ES:BIOSDAT
RESDNT SEGMENT ;handle timer interrupt
ASSUME CS:RESDNT,DS:RESDNT
ORG 100h
ENTRY: MOV AX,BIOSDAT ;get segment of timer in ES
MOV ES,AX
MOV AH,2CH ;get time from clock card (via DOS)
INT 21H
MOV AL,CH ;convert hours to timer ticks
SUB AH,AH
MOV DX,65520
MUL DX
MOV TIMER_HIGH,DX
MOV TIMER_LOW,AX
MOV AL,CL ;convert minutes to timer ticks
SUB AH,AH
MOV DX,1092
MUL DX
ADD TIMER_LOW,AX ;and add to hours
ADC TIMER_HIGH,DX
MOV AH,9 ;print msg so user knows something happened
MOV DX,OFFSET MSG
INT 21H
MOV AX,4C00H
MOV TIMER_OFL,AL ;null timer_ofl
INT 21H ;exit
MSG DB "BIOS timer set.",13,10,"$"
RESDNT ENDS
END ENTRY
----------------------- end of SETTIME.ASM (cut here) -------------------------