Posts

Showing posts from January, 2022

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

Image
Code org 100h .stack 100h .data  .code main proc      mov ah,01     int 21h     mov cx,ax              call space               mov dx,cx      add dx,32     mov ah,02     int 21h               mov ah,4ch     int 21h          main endp space proc       mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h       ret     space endp end main      Output

Assembly language program to print two different string in two different lines

Image
Code org 100h .stack 100h .data string1 db "This is String 1$" string2 db "This is String 2$" .code main proc     mov ax,@data     mov ds,ax     mov dx,offset string1     mov ah,09     int 21h          ;for new line     mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h          mov dx,offset string2     mov ah,09     int 21h          mov ah,4ch     int 21h       main endp end main Output

Assembly language program to reverse an array using push and pop

Image
Code org 100h .stack 100h .data string1 db "Enter Numbers: $" string2 db "After Swapping: $" .code main proc     mov ax,@data     mov ds,ax          mov cx,5      mov dx,offset string1     mov ah,09     int 21h               l1:      mov ah,01     int 21h     push ax           loop l1              ;code for space      mov dx,10      mov ah,02      int 21h      mov dx,13      mov ah,02      int 21h            mov dx,offset string2      mov ah,09      int 21h                        mov cx,5     l2:       pop dx       mov ah,02 ...

Assembly language Program to swap 2 numbers using stack

Image
Code org 100h .stack 100h .data string1 db "Enter Number: $" string2 db "Numbers after swapping  $" .code main proc     mov ax,@data     mov ds,ax          mov cx,2     l1:     mov dx,offset string1     mov ah,09     int 21h          mov ah,01     int 21h     push ax          mov dx,10     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h          loop l1          mov dx,offset string2     mov ah,09     int 21h          mov cx,2     l2:       pop dx       mov ah,02       int 21h              mov dx,10       mov ah,02       int 21h       mov dx...

Assembly language program to declare an array and save 5 numbers in it

Image
Code org 100h .stack 100h .data array db 1,2,3,4,5 .code main proc     mov ax,@data     mov ds,ax          mov cx,5     mov si,offset array          lable:     mov dx,[si]     add dx,48     mov ah,02     int 21h          inc si     loop lable          mov ah,4ch     int 21h     main endp     end main Output

Assembly language program to print small alphabet a to z using loop

Image
Code org 100h .stack 100h .data .code main proc            mov cx,26     mov dx,97                lable:             mov ah,02     int 21h          inc dx     loop lable     main endp end main Output

Assembly language program to print capital alphabet A to Z using loop

Image
Code org 100h .stack 100h .data .code main proc            mov cx,26     mov dx,65                lable:             mov ah,02     int 21h          inc dx     loop lable     main endp end main  Output

Assembly language program to print 0 to 9 numbers using loop

Image
Code org 100h .stack 100h .data .code main proc            mov cx,10     mov dx,48                lable:             mov ah,02     int 21h          inc dx     loop lable     main endp end main Output

Assembly language program to print name using a String

Image
Code org 100h .stack 100h .data string db 'My name is MR.NOBODY $'  ;initialize string in '.data' section and '&' represent end of string   .code main proc     mov ax,@data   ;giving address of data to ax     mov ds,ax       ;intitialize memory in heap          mov dx,offset string    ;offset is used to giving string to dx          mov ah,09        ;09 is used to disply a string     int 21h          mov ah,4ch     int 21h     main endp end main Output

Assembly language program to print name without string

Image
Code org 100h .stack 100h  .data .code main proc     mov dl,'M'     mov ah,02     int 21h          mov dl,'R'     mov ah,02     int 21h          mov dl,'.'     mov ah,02     int 21h          mov dl,'N'     mov ah,02     int 21h          mov dl,'O'     mov ah,02     int 21h          mov dl,'B'     mov ah,02     int 21h          mov dl,'O'     mov ah,02     int 21h           mov dl,'D'     mov ah,02     int 21h          mov dl,'Y'     mov ah,02     int 21h           mov ah,4ch     int 21h     main endp end main Output

Assembly language program to divide two number Static inputs

Image
Code org 100h .stack 100                          .data .code main proc     mov ax,25  ;ax registrer is Dividend     mov bx,5   ;bx register is Divisor          div bx    ;Quotient will save in ax and remainder save in dx register     mov cx,dx          mov dx,ax     add dx,48     mov ah,02     int 21h                           mov dx,10    ;new line     mov ah,02     int 21h     mov dx,13     mov ah,02     int 21h          mov dx,cx     add dx,48     mov ah,02     int 21h         main endp end main Output There is 5 is Quotient and 0 is Reminder

Assembly language program to Multiply two numbers inputs from user

Image
Code org 100h .stack 100h .data .code main proc           mov ah,01           int 21h           mov bl,al           sub bl,48           mov ah,01           int 21h           sub al,48           mul bl           AAM      ;used for divide result of ax in ah and al respectly (first,second digit)             mov ch,ah           mov cl,al           ;code for space           mov dx,10           mov ah,02           int 21h           mov dx,13           mov ah,02  ...

Assembly language program to multiply 2 numbers static inputs

Image
Code org 100h .stack 100h .data .code main proc         mov al,2    ;first value         mov bl,4    ;second value         mul bl        ;multiply two number and result will save is ax         AAM           ;we use this to solve the problem of numbers that is grater then 9         mov ch,ah    ; now move all values in cx register         mov cl,al                                        ;space         mov dx,10         mov ah,02         int 21h         mov dx,13    ...

Assembly language program to Subtract two numbers by Static inputs

Image
Code  org 100h .stack .data .code main proc           mov ax,6        ;this is the first value           mov bx,3        ;this is the second value           sub ax,bx        ;the result will save in first register (ax)                     mov dx,ax        ;move ax to dx register for display           add dx,48             ;in assembly language ASSCI values are added so convert ASSCI value we add 48                      mov ah,02        ;give 02 to ah register (used for display)           int 21h             ;now gen...

Assembly language program to Add two numbers by Static inputs

Image
Code org 100h .stack .data .code main proc           mov ax,4      ;this is the first value           mov bx,3      ;this is the second value           add ax,bx      ;the result will save in first register (ax)                     mov dx,ax      ;move ax to dx register for display           add dx,48           ;in assembly language ASSCI values are added so convert ASSCI value we add 48                      mov ah,02      ;give 02 to ah register (used for display)           int 21h           ;now generate dos interrupt           m...

8085 Program for two digits subtraction input from user

Image
Code: org 100h .stack 100h .data .code main proc      mov ah,01      ;taking input that save in ax(al)      int 21h      ;now move value of ax into bx to get another value        mov bx,ax      ;now again gat a number      mov ah,01      int 21h      ;subtract 2nd number from first number result is save in bx      sub bx,ax      ;code for print newline      mov dx,10      mov ah,02      int 21h      mov dx,13      mov ah,02      int 21h      ;now display the result       mov dx,bx      ;now there is an assci value in bx      ;so get a real number we add 48 into result that is 0      add dx,48      mov ...

Assembly language program to Add two numbers input from user

Image
Code: org 100h .stack 100h .data .code main proc          mov ah,01      int 21h      mov bx,ax      mov ax,0      mov ah,01      int 21h      add ax,bx      mov cx,ax             ;for space 6 line      mov dx,10      mov ah,02      int 21h        mov dx,13      mov ah,02      int 21h            mov dx,cx      sub dx,48        mov ah,02      int 21h             mov ah,4ch      int 21h     main endp end main OUTPUT: