home *** CD-ROM | disk | FTP | other *** search
- name ATTCLK
- page 55,132
- title 'ATTCLK - set PC-DOS system date and time from ATT clock'
- ; ---------------------------------------------------------------------
- ; The problem: the AT&T PC6300 is sufficiently compatible that many
- ; users run under PC-DOS instead of MS-DOS; however, since the IBM
- ; PC does not contain an on-board battery operated clock chip, PC-DOS
- ; does not provide a means to set the system date and time from the
- ; AT&T clock chip.
- ;
- ; This program is based upon AT.ASM, a program written by Mike Zimmerman
- ; (ZeeMac Inc), dated 07/1/85, uploaded to Compuserve, and placed into
- ; Public Domain. It sets the PC-DOS system date and time from the AT&T
- ; clock chip.
- ;
- ; ATTCLK.ASM adds the ability to run from hard disk, and displays the
- ; resulting date and time. It follows the lead of AT.ASM by also
- ; being placed into public domain.
- ;
- ; It is my hope that someone will take the lead from here, and perhaps
- ; add the ability to set the AT&T clock. The ultimate solution would be
- ; a driver that could be invoked through CONFIG.SYS, which would set
- ; the system clock from the AT&T clock whenever DOS is booted, and which
- ; would set the AT&T clock whenever the system date and time was reset
- ; through the DOS DATE and TIME commands.
- ; ----------------------------------------------------------------------
- cr equ 13
- lf equ 10
- tenths equ 10
- cseg segment byte
- assume cs:cseg,ds:cseg,es:cseg
- org 100h
- begin: PUSH DS ;save for linkage
- XOR AX,AX ;clear for return
- PUSH AX ;put in stack
- PUSH DS ;Modify diskette parameters
- mov dx,71h
- in al,dx
- and al,0fh
- mov dx,77h
- in al,dx
- and al,0fh
- mov dx,77h
- in al,dx
- and al,0fh
- push bx
- mov bl,10
- mul bl ;* 10 get hours
- pop bx
- mov ch,al
- dec dx
- in al,dx
- and al,0fh
- add ch,al ;add tens of hour to ch
- dec dx
- in al,dx
- and al,0fh
- push bx
- mov bl,10
- mul bl ;mul get ten of minutes
- pop bx
- mov cl,al
- dec dx
- in al,dx
- and al,0fh
- add cl,al
- dec dx ;now we start with seconds
- in al,dx
- and al,0fh
- push bx
- mov bl,10
- mul bl ;lt * 10 get tens of sec
- pop bx
- mov bh,al
- dec dx
- in al,dx
- and al,0fh
- add bh,al ;add tens of hour to ch
- mov bl,0 ;zero tenths
- mov dx,bx
- MOV AH,2dh
- INT 21H ;now do year
- mov dx,71h
- loop2:
- in al,dx
- and al,0fh
- cmp al,0fh
- je loop2
- mov dx,7fh
- in al,dx
- and al,0fh
- mov cx,1976
- mov ah,0
- add cx,ax
- mov dx,71h
- loop3:
- in al,dx
- and al,0fh
- cmp al,0fh
- je loop3
- mov dx,7ch
- in al,dx
- and al,0fh
- mov bl,10
- mul bl
- mov bh,al
- dec dx
- in al,dx
- and al,0fh
- add bh,al ;set month
- mov dx,71h
- loop4:
- in al,dx
- and al,0fh
- cmp al,0fh
- je loop4
- mov dx,79h
- in al,dx
- and al,0fh
- mov bl,10
- mul bl
- mov bl,al
- dec dx
- in al,dx
- and al,0fh
- add bl,al
- mov dx,bx ;put date in place
- mov ah,2bh
- int 21h
- mov ah,2ah ;get date
- int 21h
- and ah,00h
- mov al,dl
- aam
- or ah,30h
- or al,30h
- mov byte ptr dspdy,ah
- mov byte ptr dspdy + 1, al
- dec dh
- and ah,00h
- mov al,dh
- mov bl,3
- mul bl
- mov si,offset motbl
- add si,ax
- mov di,offset dspmo
- movsb
- movsb
- movsb
- mov ax,cx
- mov bl,100
- div bl
- mov bh,ah
- and ah,00h
- aam
- or ah,30h
- or al,30h
- mov byte ptr dspyr,ah
- mov byte ptr dspyr + 1,al
- mov al,bh
- and ah,00h
- aam
- or ah,30h
- or al,30h
- mov byte ptr dspyr + 2,ah
- mov byte ptr dspyr + 3,al
- mov ah,2ch ;get time
- int 21h
- mov al,ch
- and ah,00h
- aam
- or ah,30h
- or al,30h
- mov byte ptr dsphr,ah
- mov byte ptr dsphr + 1,al
- mov al,cl
- and ah,00h
- aam
- or ah,30h
- or al,30h
- mov byte ptr dspmin,ah
- mov byte ptr dspmin + 1,al
- mov al,dh
- and ah,00h
- aam
- or ah,30h
- or al,30h
- mov byte ptr dspsec,ah
- mov byte ptr dspsec + 1,al
- mov ah,9h
- mov dx,offset dsply1
- int 21h
- mov dx,offset dsply2
- int 21h
- mov dx,offset dsply3
- int 21h
- POP DS
- INT 20H
- dsply1 db 'System date and time set from AT&T clock',cr,lf,'$'
- dsply2 db 'Date: '
- dspdy db 2 dup (?),'-'
- dspmo db 3 dup (?),'-'
- dspyr db 4 dup (?),' $'
- motbl db 'JanFebMarAprMayJunJulAugSepOctNovDec'
- dsply3 db 'Time: '
- dsphr db 2 dup (?),':'
- dspmin db 2 dup (?),':'
- dspsec db 2 dup (?),'$'
- cseg ends
- end begin