Answer to Question #318649 in Assembler for xtian

Question #318649

Month.asm: Construct an assembly language program that accepts month in number form then displays it in worded form. (Use A for 10, B for 11, and C for 12)

Example:

-                      Enter Month in number form: 6

                       Number 6 month form is June



1
Expert's answer
2022-03-26T12:40:54-0400
; DosBox
DATA SEGMENT
msgEnter    db "Enter month (1-C): $"
msgWrong    db 10,"The wrong input$"
msgNewLine  db 0ah, 0dh,"$"
msgNumber    db "Number $"
msgMonth    db  " month form is $"
m01            db "January        $"
m02            db "February       $"
m03            db "March          $"
m04            db "April          $"
m05            db "May            $"
m06            db "June           $"
m07            db "July           $"
m08            db "August         $"
m09            db "September      $"
m10            db "October        $"
m11            db "November       $"
m12            db "December       $"

DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
    MOV AX,DATA
    MOV DS,AX

   MOV AX,DATA
    MOV DS,AX    
    MOV ES,AX

    mov dx, offset msgEnter
    mov ah, 9
    int 21h    
    
; wait for any key press:
    mov ah, 0
    int 16h    
    
    xor cx,cx
    mov bl, al        ; save char
    mov cl, al        ;
    cmp cl,'A'
    jl month
    nop
    sub cl,7
month:    
    sub cl,30h        ; number
    mov  ah, 0eh
    int  10h

    mov dx, offset msgNewLine
    mov ah, 9
    int 21h
    
    mov dx, offset msgNumber
    mov ah, 9
    int 21h

    mov  al,bl
    mov  ah, 0eh
    int  10h

    mov dx, offset msgMonth
    mov ah, 9
    int 21h
    
 
    mov dx, offset m01
    mov al,16
    dec cl
    mul cl
    add dx,ax
    
    mov ah, 9
    int 21h  
    
 _quit:    
   MOV AH,1            ; Waiting for a key press
    INT 16H    

EXIT_PROG:            ; Program is terminated
     MOV AH,4CH
     INT 21H

CODE ENDS
END START




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS