TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: EDDY THILLEMAN
from: BRIAN MCCLOUD
date: 1998-01-07 14:25:00
subject: RTC/DOS clock

ET>I had begun a program in assembler, but I never got around the necessary
ET>conversion from hex to dec. I wonder if someone could help?
I think you mean from BCD to decimal, but I think I can help.
ET>  startupcode
ET>        mov     ah, 02h         ;function 02h - read CMOS clock time
ET>        int     1Ah             ;call AT BIOS Time of Day Services
ET>                                ;  return: CH = hours
ET>                                ;          CL = minutes
ET>                                ;          DH = seconds
here is what I suggest you do in here:
        mov     al, ch
        daa
        mov     ch, al
        mov     al, cl
        daa
        mov     cl, al
        mov     al, dh
        daa
        mov     dh, al
        xor     dl, dl          ; 1/100 seconds
ET>        mov     ah, 2Dh         ;function 2Dh - set DOS system time
ET>        int     21h             ;call DOS services
ET>        ; needs conversion from hex value to dec,
ET>        ; for example from 1997 hex to 1997 dec
ET>        ; I never got around this problem.
ET>        mov     ah, 04h         ;function 04h - read CMOS clock date
ET>        int     1Ah             ;call AT BIOS Time of Day Services
ET>                                ; return:  CH = Century
ET>                                ;          CL = Year
ET>                                ;          DH = Month
ET>                                ;          DL = Day
try this here:
        mov     al, dh
        daa
        mov     dh, al
        mov     al, dl
        daa
        mov     dl, al
        mov     al, cl
        daa
        mov     cl, al
        mov     al, ch
        daa
        mov     ch, al
        mov     bl, 100
        mul     bl              ; ax = xx00 (decimal)
        add     ax, cl
        mov     cx, ax
ET>        mov     ah, 2Bh         ;function 2Bh - set DOS system date
ET>        int     21h             ;call DOS services
ET>@exit: exitcode                 ; terminate the program
((Cloud))
MauveCloud@juno.com
 * OLX 2.2 * Mental Floss prevents Moral Decay.
--- PCBoard (R) v15.3/M 10
---------------
* Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205)

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™.