home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / comptbls / edgclk.arc / LE_MCLK.ASM next >
Encoding:
Assembly Source File  |  1986-06-15  |  2.9 KB  |  79 lines

  1. TITLE    LE_MCLK.ASM    3-27-86
  2.  
  3. ;3-27-86 version corrects for bug in date function
  4.  
  5. ;This software may be freely ditributed and no charge shall
  6. ;be made by anyone for its use or distribution except for
  7. ;a copying charge.
  8.  
  9. ;This program reads the Leading Edge Model-M battery backed-up
  10. ;clock and sets the DOS clock to its values.  Put this in your
  11. ;AUTOEXEC.BAT file so that the DOS clock will show the date/time
  12. ;upon boot up when using DOS 3.x.  Works for Sperry PC also.
  13.  
  14. ;                    -Done by Bob Plouffe 
  15. ;                    CompuServe: 70220,113
  16. ;                    Fido: Net 109, node 404
  17. ;                    PLOUFF at MIT-MC.ARPA
  18. ;                    GENIE: RPLOUFFE
  19. ;
  20. ;*****************************************************************
  21.  
  22. ;This short program uses an undocumented feature of the Leading Edge
  23. ;ROM Bios.  The Time-of Day interrupt (INT 1AH) has four additional
  24. ;functions beyond that of the IBMPC ROM Bios.  (See the IBM code for
  25. ;INT 1AH in the Technical Reference Manual.  Note that this function
  26. ;allows the current clock [DOS clock] to be set/read for AH=1/0 upon
  27. ;entry)  For the Leading Edge, Model M, this interrupt can also 
  28. ;set/read the date/time of the on-board battery backed-up clock. Entry
  29. ;and return of CX/DX registers is the same as for the DOS function
  30. ;calls with INT 21H for AH=2AH through 2DH except that CX sets/returns
  31. ;an offset from the year 1980 (07cbh).  The following AH reg entry
  32. ;values accomplish the described functions:
  33.  
  34. ;        AH=2    Read the time from the battery backed-up clock.
  35. ;        AH=3    Set the time into the     "     "         "
  36. ;        AH=4    Read the date from the      "      "         "        
  37. ;        AH=5    Set the date into the     "      "         "
  38.  
  39. ;*********************************************************************
  40.  
  41. ;makes a .COM program.  Use EXE2BIN after assembling and linking.
  42.  
  43. ;equates
  44. ;INT 21H Dos functions 
  45.     set_cdate    equ    2b00h    ;sets date in current clk
  46.     set_ctime    equ    2d00h    ;sets time in current clock
  47. ;INT 1AH Rom Bios functions
  48.     get_btime    equ    0200h    ;gets time from battery clk
  49.     get_bdate    equ    0400h    ;gets date from battery clk
  50.  
  51. ;********************************************************************
  52. ;
  53. le_mclk    segment
  54.  
  55.     assume ds:le_mclk, ss:le_mclk ,cs:le_mclk ,es:le_mclk
  56.  
  57.     org    100h
  58.  
  59. begin:    ;read the time from the battery backed-up clock
  60. rdtime:    mov    ax,get_btime    ;to read time (battery clock)
  61.     int    1ah        ;returns time in CX and DX
  62.     ;now set the current clock time
  63.     mov    ax,set_ctime    ;set time in timer chip
  64.     int    21h        ;
  65.     ;
  66.     ;read the date from the battery backed-up clock
  67. rddate:    mov    ax,get_bdate    ;to read date (battery clock)
  68.     int    1ah        ;returns date in CX and DX
  69.     ;now set the date for the current clock
  70.     mov    ch,0        ;clear CH
  71.     add    cx,07bch    ;add 1980 to the year offset in CX
  72.     mov    ax,set_cdate    ;set date in current clock
  73.     int    21h        ;
  74.     ;    
  75. done:    int    20h        ;we are done, so return to DOS
  76.     le_mclk    ends
  77. ;
  78. end begin
  79.