• Please review our updated Terms and Rules here

Leading Edge Model M RTC tool

hupshall

Member
Joined
Dec 31, 2018
Messages
29
Location
Redmond, WA
Before I dig into the technical documentation and attempt this myself, does anybody have a tool that can read/set the RTC in the Leading Edge Model M? I'm running DOS 5.0 on the machine now so I can have a larger hard disk with the XTIDE but have lost access to the clock. I know it still works because if I boot from the original 2.11 disk, the settings are there.

Does anybody have a tool that can read/write from this computer's MSM58321RS sitting on 2A2H?
 
Sure,
How about one of these programs. Three Programs in ZIP file.


Code:
TITLE   SETCLOCK.ASM      27-11-87
; Written by:
;               Garry Kraemer
;               520 El Portal
;               Merced, CA  95340
;
;
;This software may be freely ditributed and no charge shall
;be made by anyone for its use or distribution except for
;a copying charge.

;This program reads the system clock and
;sets the Leading Edge Model-M battery backed-up clock to
;the system DATE and TIME values.
;
;*****************************************************************
;
;After upgrading my Leading Edge Model "M" to EGA (NEW ROM),
;adding a 40 MEG hard drive (KONAN Disk Controller), and switching
;to MSDOS 3.1, I found that I could no longer set the BATTERY backed-up
;clock.  I needed a small program to allow me to set the date and time in
;the BATTERY backed-up clock.  This program is the result!
;Use it as you wish and at your own RISK!  No warranties are
;"EXPRESSED or IMPLIED"!  It works for me, but I'm easy to please!
;
;This short program uses an undocumented feature of the Leading Edge
;ROM Bios.  The Time-of Day interrupt (INT 1AH) has four additional
;functions beyond that of the IBMPC ROM Bios.  (See the IBM code for
;INT 1AH in the Technical Reference Manual.  Note that this function
;allows the current clock [DOS clock] to be set/read for AH=1/0 upon
;entry)  For the Leading Edge, Model M, this interrupt can also 
;set/read the date/time of the on-board battery backed-up clock. Entry
;and return of CX/DX registers is the same as for the DOS function
;calls with INT 21H for AH=2AH through 2DH except that CX sets/returns
;an offset from the year 1980 (07cbh).  The following AH reg entry
;values accomplish the described functions:
;
;        AH=2    Read the time from the battery backed-up clock.
;        AH=3    Set the time into the     "     "         "
;        AH=4    Read the date from the      "      "         "        
;        AH=5    Set the date into the     "      "         "
;
;*********************************************************************
;     To Assemble use the following commands:
;
;                       MASM SETCLOCK;
;                       LINK SETCLOCK;
;                       EXE2COM SETCLOCK SETCLOCK.COM or
;                       EXE2BIN SETCLOCK SETCLOCK.COM
;
;equates
;
;INT 21H Dos functions
;
    get_sys_date       equ     2a00h   ;gets system date
                       ;cx = year, dh = month
                       ;dl = day
    set_sys_date       equ     2b00h   ;sets system date
                       ;cx = year, dh = month
                       ;dl = day
    get_sys_time       equ     2c00h   ;gets system time
                       ;ch = hour, cl = minute
                       ;dh = seconds, dl = hund seconds
    set_sys_time       equ     2d00h   ;sets system time
                       ;ch = hour, cl = minute
                       ;dh = seconds, dl = hund seconds
;
;
;INT 1AH Rom Bios functions
;
    get_bat_time       equ     0200h   ;gets battery clock time
    set_bat_time       equ     0300h   ;sets battery clock time
    get_bat_date       equ     0400h   ;gets battery clock date
    set_bat_date       equ     0500h   ;sets battery clock date
;
;********************************************************************
;
setclock segment
;
    assume ds:setclock, ss:setclock ,cs:setclock ,es:setclock
;
    org    100h
;
begin:                             ;read the time
    mov     ax,get_sys_time    ;read system time, set registers
    int     21h                ;call int
                   ;now set the battery clock time
    mov     ax,set_bat_time    ;set time TO SYSTEM time
    int     1ah                ;call ROM BIOS to do it!
                   ;
    mov     ax,get_sys_date    ;read system date
    int     21h                ;returns date in registers
                   ;now set the date for the BATTERY clock
    sub     cx,07bch           ;sub 1980 from cx register to determine
                   ;offset. cx contains offset!
    mov     ax,set_bat_date    ;set date in BATTERY clock
    int     1ah                ;using the ROM BIOS CALL
                   ;
done:   int     20h                ;we are done, so return to DOS
    setclock ends
;
end begin

Code:
TITLE    LE_MCLK.ASM    3-27-86

;3-27-86 version corrects for bug in date function

;This software may be freely ditributed and no charge shall
;be made by anyone for its use or distribution except for
;a copying charge.

;This program reads the Leading Edge Model-M battery backed-up
;clock and sets the DOS clock to its values.  Put this in your
;AUTOEXEC.BAT file so that the DOS clock will show the date/time
;upon boot up when using DOS 3.x.

;                    -Done by Bob Plouffe 
;                    CompuServe: 70220,113
;                    Fido: Net 109, node 404
;                    PLOUFF at MIT-MC.ARPA
;                    GENIE: RPLOUFFE
;
;*****************************************************************

;This short program uses an undocumented feature of the Leading Edge
;ROM Bios.  The Time-of Day interrupt (INT 1AH) has four additional
;functions beyond that of the IBMPC ROM Bios.  (See the IBM code for
;INT 1AH in the Technical Reference Manual.  Note that this function
;allows the current clock [DOS clock] to be set/read for AH=1/0 upon
;entry)  For the Leading Edge, Model M, this interrupt can also 
;set/read the date/time of the on-board battery backed-up clock. Entry
;and return of CX/DX registers is the same as for the DOS function
;calls with INT 21H for AH=2AH through 2DH except that CX sets/returns
;an offset from the year 1980 (07cbh).  The following AH reg entry
;values accomplish the described functions:

;        AH=2    Read the time from the battery backed-up clock.
;        AH=3    Set the time into the     "     "         "
;        AH=4    Read the date from the      "      "         "        
;        AH=5    Set the date into the     "      "         "

;*********************************************************************

;makes a .COM program.  Use EXE2BIN after assembling and linking.
 
;equates
;INT 21H Dos functions 
    set_cdate    equ    2b00h    ;sets date in current clk
    set_ctime    equ    2d00h    ;sets time in current clock
;INT 1AH Rom Bios functions
    get_btime    equ    0200h    ;gets time from battery clk
    get_bdate    equ    0400h    ;gets date from battery clk

;********************************************************************
;
le_mclk    segment

    assume ds:le_mclk, ss:le_mclk ,cs:le_mclk ,es:le_mclk

    org    100h

begin:    ;read the time from the battery backed-up clock
rdtime:    mov    ax,get_btime    ;to read time (battery clock)
    int    1ah        ;returns time in CX and DX
    ;now set the current clock time
    mov    ax,set_ctime    ;set time in timer chip
    int    21h        ;
    ;
    ;read the date from the battery backed-up clock
rddate:    mov    ax,get_bdate    ;to read date (battery clock)
    int    1ah        ;returns date in CX and DX
    ;now set the date for the current clock
    mov    ch,0        ;clear CH
    add    cx,07bch    ;add 1980 to the year offset in CX
    mov    ax,set_cdate    ;set date in current clock
    int    21h        ;
    ;    
done:    int    20h        ;we are done, so return to DOS
    le_mclk    ends
;
end begin

Also have the ROM update to make it an EGA system.


Larry
 

Attachments

  • LE-M.zip
    6.4 KB · Views: 3
Thanks for that link Chuck, I gave it a shot. I don't understand what's going on at this point. When using the original MS-DOS 2.11 disk, setting the date and time works as I would expect - across power offs and reboots. These tools actually look like they work but the clock becomes nonsensical even after a soft reboot - even booting with the 2.11 disk showed an incorrect value which tells me data is being written to the chip, but perhaps not in the way it's expected to be.
 
Do you use vendor customized MS DOS 2.11?

If so, just copy clock.sys from it to whatever DOS you want to use instead, it will probably work as-is. And if it doesn't, you can always disassemble it to see how it works.

I disassembled clock.sys from Intel Above Board PS/PC using Ghidra. I used DosBox + MASM 5.1 to rebuild binary from source to confirm it's byte accurate.

 
I know clock.sys works with the leading edge model D that I have, and that's good with dos 5, but this M doesn't have that nor is that file present on the boot disk. I'm using the original MS-DOS 2.11 disk that came with the machine, and with that disk, the clock works fine. Nothing else seems to work.
 
The version of MS-DOS 2.11 that shipped with this computer is an OEM modified version which has support for the RTC built in, there are no external devices loaded. - I have found by playing around that if I call the setclk.com right after I read the clock with readclk, the value in the RTC is correct across reboots - I'm going to stick with that solution, it seems to be fine.

Thanks everybody.
 
Back
Top