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
; 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
Comments
Leave a comment