home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / ATTIBM.ZIP / ATTCLK.ASM next >
Encoding:
Assembly Source File  |  1986-05-20  |  6.1 KB  |  211 lines

  1. name    ATTCLK
  2. page    55,132
  3. title   'ATTCLK - set PC-DOS system date and time from ATT clock'
  4. ; ---------------------------------------------------------------------
  5. ; The problem: the AT&T PC6300 is sufficiently compatible that many
  6. ; users run under PC-DOS instead of MS-DOS; however, since the IBM
  7. ; PC does not contain an on-board battery operated clock chip, PC-DOS
  8. ; does not provide a means to set the system date and time from the
  9. ; AT&T clock chip.
  10. ;
  11. ; This program is based upon AT.ASM, a program written by Mike Zimmerman
  12. ; (ZeeMac Inc), dated 07/1/85, uploaded to Compuserve, and placed into
  13. ; Public Domain.  It sets the PC-DOS system date and time from the AT&T
  14. ; clock chip.
  15. ;
  16. ; ATTCLK.ASM adds the ability to run from hard disk, and displays the
  17. ; resulting date and time.  It follows the lead of AT.ASM by also
  18. ; being placed into public domain.
  19. ;
  20. ; It is my hope that someone will take the lead from here, and perhaps
  21. ; add the ability to set the AT&T clock.  The ultimate solution would be
  22. ; a driver that could be invoked through CONFIG.SYS, which would set
  23. ; the system clock from the AT&T clock whenever DOS is booted, and which
  24. ; would set the AT&T clock whenever the system date and time was reset
  25. ; through the DOS DATE and TIME commands.
  26. ; ----------------------------------------------------------------------
  27. cr      equ     13
  28. lf      equ     10
  29. tenths  equ     10
  30. cseg    segment byte
  31.         assume  cs:cseg,ds:cseg,es:cseg
  32.         org     100h
  33. begin:  PUSH    DS                      ;save for linkage
  34.         XOR     AX,AX                   ;clear for return
  35.         PUSH    AX                      ;put in stack
  36.         PUSH    DS                      ;Modify diskette parameters
  37.         mov     dx,71h
  38.         in      al,dx
  39.         and     al,0fh
  40.         mov     dx,77h
  41.         in      al,dx
  42.         and     al,0fh
  43.         mov     dx,77h
  44.         in      al,dx
  45.         and     al,0fh
  46.         push    bx
  47.         mov     bl,10
  48.         mul     bl   ;* 10 get hours
  49.         pop     bx
  50.         mov     ch,al
  51.         dec     dx
  52.         in      al,dx
  53.         and     al,0fh
  54.         add     ch,al   ;add tens of hour to ch
  55.         dec     dx
  56.         in      al,dx
  57.         and     al,0fh
  58.         push    bx
  59.         mov     bl,10
  60.         mul     bl   ;mul get ten of minutes
  61.         pop     bx
  62.         mov     cl,al
  63.         dec     dx
  64.         in      al,dx
  65.         and     al,0fh
  66.         add    cl,al
  67.         dec     dx      ;now we start with seconds
  68.         in      al,dx
  69.         and     al,0fh
  70.         push    bx
  71.         mov     bl,10
  72.         mul     bl      ;lt * 10 get tens of sec
  73.         pop     bx
  74.         mov     bh,al
  75.         dec     dx
  76.         in      al,dx
  77.         and     al,0fh
  78.         add     bh,al   ;add tens of hour to ch
  79.         mov     bl,0    ;zero tenths
  80.         mov     dx,bx
  81.         MOV     AH,2dh
  82.         INT     21H                 ;now do year
  83.         mov     dx,71h
  84. loop2:
  85.         in      al,dx
  86.         and     al,0fh
  87.         cmp     al,0fh
  88.         je      loop2
  89.         mov     dx,7fh
  90.         in      al,dx
  91.         and     al,0fh
  92.         mov     cx,1976
  93.         mov     ah,0
  94.         add     cx,ax
  95.         mov     dx,71h
  96. loop3:
  97.         in      al,dx
  98.         and     al,0fh
  99.         cmp     al,0fh
  100.         je      loop3
  101.         mov     dx,7ch
  102.         in      al,dx
  103.         and     al,0fh
  104.         mov     bl,10
  105.         mul     bl
  106.         mov     bh,al
  107.         dec     dx
  108.         in      al,dx
  109.         and     al,0fh
  110.         add     bh,al   ;set month
  111.         mov     dx,71h
  112. loop4:
  113.         in      al,dx
  114.         and     al,0fh
  115.         cmp     al,0fh
  116.         je      loop4
  117.         mov     dx,79h
  118.         in      al,dx
  119.         and     al,0fh
  120.         mov     bl,10
  121.         mul     bl
  122.         mov     bl,al
  123.         dec     dx
  124.         in      al,dx
  125.         and     al,0fh
  126.         add     bl,al
  127.         mov     dx,bx   ;put date in place
  128.         mov     ah,2bh
  129.         int     21h
  130.         mov     ah,2ah                   ;get date
  131.         int     21h
  132.         and     ah,00h
  133.         mov     al,dl
  134.         aam
  135.         or      ah,30h
  136.         or      al,30h
  137.         mov     byte ptr dspdy,ah
  138.         mov     byte ptr dspdy + 1, al
  139.         dec     dh
  140.         and     ah,00h
  141.         mov     al,dh
  142.         mov     bl,3
  143.         mul     bl
  144.         mov     si,offset motbl
  145.         add     si,ax
  146.         mov     di,offset dspmo
  147.         movsb
  148.         movsb
  149.         movsb
  150.         mov     ax,cx
  151.         mov     bl,100
  152.         div     bl
  153.         mov     bh,ah
  154.         and     ah,00h
  155.         aam
  156.         or      ah,30h
  157.         or      al,30h
  158.         mov     byte ptr dspyr,ah
  159.         mov     byte ptr dspyr + 1,al
  160.         mov     al,bh
  161.         and     ah,00h
  162.         aam
  163.         or      ah,30h
  164.         or      al,30h
  165.         mov     byte ptr dspyr + 2,ah
  166.         mov     byte ptr dspyr + 3,al
  167.         mov     ah,2ch                 ;get time
  168.         int     21h
  169.         mov     al,ch
  170.         and     ah,00h
  171.         aam
  172.         or      ah,30h
  173.         or      al,30h
  174.         mov     byte ptr dsphr,ah
  175.         mov     byte ptr dsphr + 1,al
  176.         mov     al,cl
  177.         and     ah,00h
  178.         aam
  179.         or      ah,30h
  180.         or      al,30h
  181.         mov     byte ptr dspmin,ah
  182.         mov     byte ptr dspmin + 1,al
  183.         mov     al,dh
  184.         and     ah,00h
  185.         aam
  186.         or      ah,30h
  187.         or      al,30h
  188.         mov     byte ptr dspsec,ah
  189.         mov     byte ptr dspsec + 1,al
  190.         mov     ah,9h
  191.         mov     dx,offset dsply1
  192.         int     21h
  193.         mov     dx,offset dsply2
  194.         int     21h
  195.         mov     dx,offset dsply3
  196.         int     21h
  197.         POP     DS
  198.         INT     20H
  199. dsply1  db      'System date and time set from AT&T clock',cr,lf,'$'
  200. dsply2  db      'Date: '
  201. dspdy   db      2 dup (?),'-'
  202. dspmo   db      3 dup (?),'-'
  203. dspyr   db      4 dup (?),'         $'
  204. motbl   db      'JanFebMarAprMayJunJulAugSepOctNovDec'
  205. dsply3  db      'Time: '
  206. dsphr   db      2 dup (?),':'
  207. dspmin  db      2 dup (?),':'
  208. dspsec  db      2 dup (?),'$'
  209. cseg    ends
  210. end     begin
  211.