Category : Assembly Language Source Code
Archive   : SETATTIM.ZIP
Filename : SETATTIM.ASM

 
Output of file : SETATTIM.ASM contained in archive : SETATTIM.ZIP

;*****************************************************************************|
; |
; SETATTIME.ASM |
; |
; This program sets DOS time from the AT's CMOS clock. It uses one BIOS |
; interrupt and one DOS interrupt to acocmplish this task |
; |
; KDG, 4-Sep-87 |
; |
;*****************************************************************************|

.286c

CodeSeg segment 'CODE'
assume CS:CodeSeg, DS:NOTHING, ES:NOTHING, SS:NOTHING

Start proc FAR
mov AH, 02 ; Read the CMOS clock
int 1Ah
mov AL, CH ; Convert time to something that
call BCD2Bin ; DOS can understand
mov CH, AL
mov AL, CL
call BCD2Bin
mov CL, AL
mov AL, DH
call BCD2Bin
mov DH, AL
xor DL, DL ; 100ths are immaterial
mov AH, 2Dh ; Give time to DOS
int 21h
mov AH, 4Ch ; Then exit (note, if time was
int 21h ; incorrect, error code will be 255)
Start endp


BCD2Bin proc NEAR
mov BX, AX ; Keep the BCD value in BL
mov BH, 10 ; Multiplier goes here
and AL, 0F0h ; High digit gets multpplied by 10
shr AL, 4
mul BH
and BL, 0Fh ; Then the low digit gets added
add AL, BL
ret
BCD2Bin endp

CodeSeg ends
end Start