Professional Documents
Culture Documents
Department of CSE
Course Title: Microprocessor & Assembly language lab
Course Code: CSE 232
SUBMITTED TO :
Tapasy Rabeya
Department of CSE
SUBMITTED BY :
Nashed Shah Roni
ID: 181-15-11170
Section: P ; Batch : 49
.model small
.stack 100h
.data
cr equ 0dh
lf equ 0ah
msg1 db 'Enter a lower case letter:$'
msg2 db 0dh,0ah,'in upper case letter:'
char db ?,'$'
.code
main proc
mov ax,@data
mov ds,ax
lea dx,msg1
mov ah,9
int 21h
mov ah,1
int 21h
sub al,20h
mov char,al
lea dx,msg2
mov ah,9
int 21h
mov ah,4ch
int 21h
main endp
main proc
mov ax,@data
mov ds,ax
top:
mov ax,[si]
add ax,20h
mov dx,ax
mov ah,2h
int 21h
dec si
loop top
exit:
mov ah,2
mov cx,5
mov bx,5
Top:
mov dl,'*'
mov ah,2
int 21h
dec bx
cmp bx,0
je Top2
jmp Top
Top2:
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21h
mov bx,5
loop Top
Exit:
(d)write an assembly code for printing a triangle by star.
.model small
.stack 100h
.data
.code
main proc
mov ah,2
mov bx,5
mov cx,5
loop1:
mov ah,2
mov dl,'*'
int 21h
dec bx
cmp bx,0
je loop2
jmp loop1
loop2:
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov bx,cx
dec bx
loop loop1
exit:
.model small
.stack 100h
.data
nl db 10,13,'$'
.code
main proc
mov ax,@data
mov ds,ax
mov cx,5
mov bx,1
f1:
push cx
mov dl,20h
mov ah,2
f2:
int 21h
loop f2
mov cx,bx
mov dl,'*'
mov ah,2
f3:
int 21h
loop f3
lea dx,nl
mov ah,9
int 21h
inc bx
inc bx
pop cx
loop f1
mov ah,4ch
int 21h
main endp
end main
.MODEL SMALL
.STACK 100H
.DATA
PROMPT DB 'Enter the character : $'
MSG_1 DB 'The input letter is : $'
MSG_2 DB 'The input character is not an Upper Case Letter.$'
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV AH, 1
INT 21H
MOV BL, AL
MOV AH, 2
MOV DL, 0DH
INT 21H
JB @DISPLAY
JA @DISPLAY
LEA DX,MSG_1
MOV AH, 9
INT 21H
MOV AH, 2
MOV DL, BL
INT 21H
JMP @EXIT
@DISPLAY:
LEA DX,MSG_2
MOV AH, 9
INT 21H
@EXIT:
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
.model small
.stack 100h
.data
.code
main proc
input:
mov ah,1
int 21h
exit:
main proc
mov bl,0
mov ah,1
int 21h
L1:
cmp al,0dh
je end
inc bl
int 21h
jmp L1
end:
mov ah,2
mov dl,10
int 21h
mov dl,13
int 21h
mov ah,2
add bl,48
mov dl,bl
int 21h
exit:
mov ah,4ch
int 21h
endp main
MOV AH,1
INT 21H
MOV BL,AL
SUB bl,30H
MOV CX,bx
MOV AH,2
MOV DL,'*'
TOP:
INT 21H
dec cx
jnz TOP
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
.model small
.stack 100h
.data
a db 0dh,0ah,'Enter the number $'
b db 0dh,0ah,'The number is even $'
c db 0dh,0ah,'The number is odd $'
.code
main proc
mov ax,@data
mov ds,ax
lea dx,a
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,'2'
je l
cmp al,'4'
je l
cmp al,'6'
je l
cmp al,'8'
je l
lea dx,c
mov ah,9
int 21h
jmp exit
l:
lea dx,b
mov ah,9
int 21h
exit:
mov ah,4ch
int 21h
main endp
end main