Date Time Stamper

From: Andrew Kennedy (andrewkennedy2_at_LOGev1.net)
Date: 02/16/04


Date: Mon, 16 Feb 2004 04:50:29 -0000


; now1.asm (c) Copyright Andrew Kennedy 1996 - 2004
;
; Email: andrewkennedy2@LOGev1.net (Remove LOG)
;
; Portions of code may be used if credit is given
;
; OUTPUT: Wednesday, 02-26-03 16:48:36:96 hrs.,mins.,secs and 1/100 secs
; Redirectable to a file or printer.

model tiny
code
386

ORG 100h

start:
       jmp begin

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, $'
prescence db '(c) Andrew Kennedy andrewkennedy2@ev1.net è---é '

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
       push dx
       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 ah,2
       mov dl,':'
       int 21h
       pop dx
       mov al,dl ; DL contains 1/100 secs
       call showit

       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