TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: EDDY THILLEMAN
date: 1998-01-03 09:05:00
subject: RTC/DOS clock

Hi!
I wanted to make a assembler program to copy the date and time from the
real-time clock (RTC, the CMOS clock) to the DOS clock, because the DOS
version of Sokoban resets the DOS clock.
I had begun a program in assembler, but I never got around the necessary
conversion from hex to dec. I wonder if someone could help?
-------------8<----------------------------8<-----------------
;
; SETTIME.ASM - Sets The DOS System Clock The Same As The CMOS Clock.
; NOTE: This is for AT-class machines only.  Won't work with PC/XT.
;
P8086          ; select the processor
ideal
model tiny     ; always must be TINY model
codeseg        ; this marks the start of executable code
  startupcode
        mov     ah, 02h         ;function 02h - read CMOS clock time
        int     1Ah             ;call AT BIOS Time of Day Services
                                ;  return: CH = hours
                                ;          CL = minutes
                                ;          DH = seconds
        mov     ah, 2Dh         ;function 2Dh - set DOS system time
        int     21h             ;call DOS services
        ; needs conversion from hex value to dec,
        ; for example from 1997 hex to 1997 dec
        ; I never got around this problem.
        mov     ah, 04h         ;function 04h - read CMOS clock date
        int     1Ah             ;call AT BIOS Time of Day Services
                                ; return:  CH = Century
                                ;          CL = Year
                                ;          DH = Month
                                ;          DL = Day
        mov     ah, 2Bh         ;function 2Bh - set DOS system date
        int     21h             ;call DOS services
@exit: exitcode                 ; terminate the program
end
-------------8<----------------------------8<-----------------
Cheers, Eddy
...  * <- Tribble  ****************** <- Tribble Orgy
--- MBM v4.12
---------------
* Origin: Speedy Gonsalez (2:500/143.7)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.