Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

PROGRAM TO READ TODAY'S DATE THROUGH KEYBOARD AND THEN DISPLAY THE CORRESPONDING DAY AND MONTH

Posted By: Adelinda Fischer     Category: Assembly Language     Views: 8986

PROGRAM TO READ TODAY'S DATE THROUGH KEYBOARD AND THEN DISPLAY THE CORRESPONDING DAY AND MONTH.

Code for PROGRAM TO READ TODAY'S DATE THROUGH KEYBOARD AND THEN DISPLAY THE CORRESPONDING DAY AND MONTH in Assembly Language

.MODEL SMALL
    
    .STACK 64

    .DATA
     EN_DATE  DB      'ENTER DATE (dd-mm-yyyy): $'
            MSGDAY   DB      'DAY : $'
           MSGMONTH DB     'MONTH : $'
            NL       DB      0DH,0AH,'$'
    DAY      DB      '  ','$'
     MONTH    DB      ' ','$'
    .CODE

    MAIN PROC
            MOV AX,@DATA
            MOV DS,AX

            LEA DX,EN_DATE
            MOV AH,09H
            INT 21H
            LEA SI,DAY
    READ_DAY:
            MOV AH,01H
            INT 21H
            CMP AL,2DH
                  JE F_READ_DAY

            MOV [SI],AL

            INC SI
            JMP READ_DAY
    
    F_READ_DAY:
                   INC SI
            MOV AL,'$'
            MOV [SI],AL

            LEA SI,MONTH

    READ_MONTH:
            MOV AH,01H
            INT 21H
    
            CMP AL,2DH
            JE F_READ_MONTH

            MOV [SI],AL

            INC SI
                   JMP READ_MONTH
    F_READ_MONTH:
        INC SI
            MOV AL,'$'
            MOV [SI],AL
            MOV CL,04H
    READ_YEAR:
        MOV AH,01H
            INT 21H
            LOOP READ_YEAR
    DISP:
            LEA DX,NL
                    MOV AH,09H
            INT 21H

            LEA DX,MSGDAY
            INT 21H

            LEA DX,NL
            INT 21H

            LEA DX,DAY
            INT 21H

            LEA DX,NL
            INT 21H

            LEA DX,MSGMONTH
            INT 21H

            LEA DX,NL
            INT 21H

            LEA DX,MONTH
                    INT 21H

            MOV AH,4CH
                    INT 21H

    MAIN ENDP
    END MAIN


OUTPUT
************
C:\tasm>ex04
ENTER DATE (dd-mm-yyyy): 17-12-2005
DAY :
17
MONTH :
12
  
Share: 



Adelinda Fischer
Adelinda Fischer author of PROGRAM TO READ TODAY'S DATE THROUGH KEYBOARD AND THEN DISPLAY THE CORRESPONDING DAY AND MONTH is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Mai Lin from Philippines Comment on: Mar 10
Nice Program.. I think it will be better if it can post even the year..

Dont mind me.. I'm a beginner in Assembly..
XD

View All Comments