Posts

Showing posts from February, 2022

Assembly language program to display sum of all odd numbers between 1 to 100

Image
 Code org 100h .stack 100h .data string db "sum of all odd number is: $"  sum dw 0 .code  main proc     mov ax,@data     mov ds,ax          mov ax,0     mov cx,1          l1:     add ax,cx     add cl,2     cmp cl,100     jl l1          mov dx,0     mov bx,10     mov cx,0          l2:     div bx     push dx     mov dx,0          mov ah,0     inc cx     cmp ax,0     jne l2          mov dx,offset string     mov ah,09     int 21h          mov ah,02h     l3:     pop dx     add dx,48     int 21h     loop l3          mov ah,4ch     int 21h    ...

Assembly language program to input an integer from user and display whether the number is even or odd

Image
 Code org 100h .stack 100h .data even db "The number is Even$" odd db "The number is Odd$" .code main proc     mov ax,@data     mov ds,ax          mov ah,01     int 21h     mov dx,0         mov bx,2     div bx     mov cx,dx          cmp cx,0     je eve          call line  ;caling line procedure     mov dx,offset odd     mov ah,09     int 21h          mov ah,4ch     int 21h     eve:      call line  ;caling line procedure     mov dx,offset even     mov ah,09     int 21h          mov ah,4ch     int 21h     main endp line proc          ;this is another procedure for new line     mov dx,10     mov ah,02 ...

Assembly language program to input 5 numbers of array from user and display largerst number

Image
 Code org 100h .stack 100h .data              string db "The largest number is: $" array db 5 dup ? .code main proc     mov ax,@data     mov ds,ax          mov si,offset array          mov cx,5     get:     mov ah,01     int 21h     mov [si],al     inc si     loop get               mov bl,0     mov si,offset array     mov cx,5     l1:     mov al,[si]     cmp al,bl     jl skp     mov bl,al          skp:               inc si          loop l1                 mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h ...

Assembly language program to input 5 numbers of array from user and display smallest number

Image
Code org 100h .stack 100h .data    string db "The smallest number is: $" array db 5 dup ? .code main proc     mov ax,@data     mov ds,ax          mov si,offset array          mov cx,5     get:     mov ah,01     int 21h     mov [si],al     inc si     loop get              ; mov bl,0     mov si,offset array     mov cx,5      mov bl,[si]     inc si      dec cx          l1:     mov al,[si]     cmp al,bl                 jg skp     mov bl,al          skp:               inc si          loop l1          mov dx,10     mov ah,02   ...

Assembly language program to input string from user and display its length

Image
Code org 100h .stack 100h .data string db 100 dup ('$') length db "The total length is: $" .code main proc     mov ax,@data     mov ds,ax     mov bx,0     mov si,offset string          l1:        ;lable     mov ah,01     int 21h                 cmp al,13       ;13 is enter key in ASCI     je dis               mov [si],al     inc bx     inc si     jmp l1          dis:        ;dis is a lable     mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h          mov dx,offset length     mov ah,09     int 21h          mov ax,bx     mov bx,10...

Assembly language program to input string from user and display it

Image
Code org 100h .stack 100h .data string db 100 dup ('$') .code main proc     mov ax,@data     mov ds,ax          mov si,offset string          l1:        ;lable     mov ah,01     int 21h          cmp al,13       ;13 is enter key in ASCI     je dis     mov [si],al     inc si     jmp l1          dis:        ;dis is a lable     mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h          mov dx,offset string     mov ah,09     int 21h          mov ah,4ch     int 21h     main endp end main Output

Assembly language program to input small latter from user and convert it into capital latter

Image
 Code org 100h .stack 100h .data input db "Please enter a small latter: $" output db "Capital later of $" output1 db " is : $" .code main proc     mov ax,@data     mov ds,ax     mov dx,offset input     mov ah,09     int 21h      mov ah,01      int 21h      mov cx,ax            ;for new line      mov dx,10      mov ah,02      int 21h      mov dx,13      mov ah,02      int 21h            mov dx,offset output      mov ah,09      int 21h      mov dx,cx      mov ah,02      int 21h            mov dx,offset output1      mov ah,09      int 21h      sub cx,32      mov dx,cx     ...