News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Time bug ?

Started by Magnum, February 18, 2013, 06:49:16 AM

Previous topic - Next topic

Magnum

Last night this program displayed 00:41 at 12:41 a.m.

In the morning it showed 8:12, so what is going on ?

I thought it used to display 12:41 a.m. ?? Early onset Alzheimers. ?


; when.asm        AK
;                Com file
;
;                OUTPUT: Wednesday, 02-26-03  16:48:36     
;                Redirectable to a file or printer.           
.model  tiny
.code
.386

ORG     100h

start:
       jmp begin

mark         db           'SiegeWorks 2/16/13'

days         LABEL        WORD

dw offset su, offset mo, offset tu, offset we, offset th, offset fr, offset sa
su db 'Sunday $'                                                                                                                                               
mo db 'Monday $'
tu db 'Tuesday $'
we db 'Wednesday $'
th db 'Thursday $'
fr db 'Friday $'                                                                           
sa db 'Saturday $'

BEGIN:
       mov     ax, cs
       mov     ds, ax
       mov     ah,2ah        ; date, month in dh, day in dl,
       int     21h           ; year in cx
       movzx   bx,al
       add     bx,bx
       mov     dx,cs:[days+bx] ; print day of the week
       mov     ah,9
       int     21h

       MOV     AH,2Ah
       INT     21h           ; Get Date
       MOV     AL,DH         ; DH contains month
       MOV     BL,'-'
       CALL    SHOWIT        ; call month
       MOV     AL,DL         ; DL has day
       CALL    SHOWIT
       MOV     AX,CX         ; CX contains year
       MOV     BL,64h        ; 64h = 100
       DIV     BL            ; Split year
       MOV     AL,AH         ; move year to al
       MOV     BL, 00        ; Used by 'JL Last_L'
       CALL    SHOWIT        ; call year
       MOV     DL,' '        ; 0D = CR
       INT     21h           ; Display 2 spaces
       INT     21h           ;

       MOV     AH,2Ch
       INT     21h           ; Get Time
       MOV     BL,3Ah        ; 3Ah = ':'
       MOV     AL,CH         ; CH contains hour

       CALL    SHOWIT
       MOV     AL,CL         ; CL contains minutes
       CALL    SHOWIT
       MOV     BL,20h
       MOV     AL,DH         ; DH contains seconds
       CALL    SHOWIT
       MOV     DL,' '         
       INT     21h             
       mov     dl,0ah         ; carriage return
       int     21h
       MOV     AX,4C00h
       INT     21h             
SHOWIT:
       PUSH    DX            ; Save DX, holds date or time
       MOV     DL,0Ah        ; move 10 into DL
       XOR     AH,AH         ; Zero AH
       DIV     DL            ; Div by 10
       OR      AX,3030h      ; Convert to ASCII
       MOV     DX,AX
       MOV     AH,02h
       INT     21h           ; Display_character from DL, First charter
       MOV     DL,DH
       INT     21h           ; Display_character from DL, Second charter
       cmp     bl, 21h       ; Is it '/','-',or':'?
       JL      LAST_D        ; If not, quit
       MOV     DL,BL
       INT     21h           ; Display_character from DL, '/' or ':'

LAST_D:
       POP     DX            ; Restore DX
       RET                   ; End branch

END  START




Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

FORTRANS

Hi,

   The DOS time function returns the hour as 0 to 23.  So,
unless you do some processing, you won't get AM / PM style
values.

Regards,

Steve N.

Magnum

Thanks.

I must have done some processing in some other code that got lost.

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

the meteor that exploded over Russia cause a space-time dimensional shift   :biggrin:

Rockphorr


dedndave

that thing was really hauling ass - lol
it would have been cool just to see something moving that fast
something like 40,000 miles per hour   :icon_eek: