Assembly Language 5

Lecture 5

print ascii characters

.model small
.stack 100h
.data
.code
main proc

mov ax,@data
mov ds,ax

mov ah,2
mov dl,0
mov cx,255

ll:
int 21h
inc dl
dec cx
jnz ll

mov ah,4ch
int 21h
         
main endp
end main

 ---------------------------------------------------

 display pass or fail ..


.model small
.stack 100h
.data 
msg1 db 'pass$'
msg2 db 'fail$'

.code

main proc
mov ax,@data
mov ds,ax
mov ax,90
cmp ax,60

jge addr1

mov ah,9
lea dx,msg2
int 21h

jmp ended

addr1:

mov ah,9
lea dx,msg1
int 21h

ended:

mov ah,4ch
int 21h

main endp
end main
 -------------------------------------------------------------
# Excersice :

Read a character and if it is "y" or "Y" display it , other wise terminate the program ..

.model small
.stack 100h
.data
.code
main proc

mov ax,@data
mov ds,ax

mov ah,1
int 21h

cmp al, 'y'
je a10

cmp al, 'Y'
jne  endeed

a10: mov ah,2
mov dl,al
int 21h

endeed :
mov ah,4ch
int 21h
         
main endp
end main



 
 ------------------------------------------------------------
# write a program :
1- read two numbers 
2-display the biggest one in the next line 

-----------------------------------------------------------------
# write a program :
1-display a message "insert two numbers:"
2-read two numbers
3-display a message :
-"enter (1)to add numbers 
-"enter (2)to subtract numbers
4-read the selection number and display the answer .


____________ good luck ____________