answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is the function of 02h of int 21h in 8051 processor?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you display the menu using the assembly language programming?

start: jmp main option1 db 0ah, 0dh, "1. OPTION 1 $" option2 db 0ah, 0dh, "2. OPTION 2 $" exit db 0ah, 0dh, "3. EXIT $" str1 db 0ah, 0dh, "Press Key: $" x db 0ah, 0dh, "You Pressed option 1 $" y db 0ah, 0dh, "You Pressed option 2 $" z db 0ah, 0dh, "End $" nvl db 0ah, 0dh, "Invalid Option $" one db "1" two db "2" tre db "3" main proc mov ah,09h lea dx,option1 int 21h lea dx,option2 int 21h lea dx,exit int 21h again: mov ah,09h lea dx,str1 int 21h mov ah,01 int 21h mov bl,al cmp bl,"1" je disp1 cmp bl,"2" je disp2 cmp bl,"3" je dispexit cmp al,one jne n cmp al,two jne n cmp al,tre jne n n: mov ah,09h lea dx,nvl int 21h jmp again disp1: mov ah,09h lea dx,x int 21h jmp again disp2: mov ah,09h lea dx,y int 21h jmp again dispexit: mov ah,09h lea dx,z int 21h int 20h main endp end start


What is dos interrupt and bios interrupt?

There are more than one of them, the most important DOS interrupt is 21H. Consult the related link.


How do you add 2 numbers with register machine assembly language?

.model small .stack .data .code main proc mov al,10 mov bl,15 add al, bl start: mov cx,8 mov bl,'1' test bl,10000000b mov ah,09h int 21h next: shl bl,1 mov dl,1 mov ah,09h int 21h mov ah,4ch int 21h main endp end start end


Show you with detailed of assembly codes of emu8086 assemblers?

; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret ; ; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret ;


Implement an assembly code that counts the number of vowels in a given string?

.MODEL SMALL .STACK 100H .DATA PROMPT_1 DB 'Enter a string : $' PROMPT_2 DB 0DH,0AH,'No. of Vowels = $' PROMPT_3 DB 0DH,0AH,'No. of Consonants = $' STRING DB 50 DUP (?) C_VOWELS DB 'AEIOU' S_VOWELS DB 'aeiou' C_CONSONANTS DB 'BCDFGHJKLMNPQRSTVWXYZ' S_CONSONANTS DB 'bcdfghjklmnpqrstvwxyz' .CODE MAIN PROC MOV AX, @DATA ; initialize DS and ES MOV DS, AX MOV ES, AX LEA DX, PROMPT_1 ; load and display the string PROMPT_1 MOV AH, 9 INT 21H LEA DI, STRING ; set DI=offset address of variable STRING CALL READ_STR ; call the procedure READ_STR XOR DX, DX ; clear DX LEA SI, STRING ; set SI=offset address of variable STRING OR BX, BX ; check BX for 0 JE @EXIT ; jump to label @EXIT if BX=0 @COUNT: ; jump label LODSB ; set AL=DS:SI LEA DI, C_VOWELS ; set DI=offset address of variable C_VOWELS MOV CX, 5 ; set CX=5 REPNE SCASB ; check AL is capital vowel or not JE @INCREMENT_VOWELS ; jump to label @INCREMENT_VOWELS if AL is ; capital vowel LEA DI, S_VOWELS ; set DI=offset address of variable S_VOWELS MOV CX, 5 ; set CX=5 REPNE SCASB ; check AL is small vowel or not JE @INCREMENT_VOWELS ; jump to label @INCREMENT_VOWELS if AL is ; small vowel LEA DI, C_CONSONANTS ; set DI=offset address of variable ; C_CONSONANTS MOV CX, 21 ; set CX=21 REPNE SCASB ; check AL is capital consonant or not JE @INCREMENT_CONSONANTS ; jump to label @INCREMENT_CONSONANTS if AL ; is capital consonant LEA DI, S_CONSONANTS ; set DI=offset address of variable ; S_CONSONANTS MOV CX, 21 ; set CX=21 REPNE SCASB ; check AL is small consonant or not JE @INCREMENT_CONSONANTS ; jump to label @INCREMENT_CONSONANTS if AL ; is small consonants JMP @NEXT ; otherwise, jump to label @NEXT @INCREMENT_VOWELS: ; jump label INC DL ; increment DL JMP @NEXT ; jump to label @NEXT @INCREMENT_CONSONANTS: ; jump label INC DH ; increment DH @NEXT: ; jump label DEC BX ; decrement BX JNE @COUNT ; jump to label @COUNT while BX!=0 @EXIT: ; jump label MOV CX, DX ; set CX=DX LEA DX, PROMPT_2 ; load and display the string PROMPT_2 MOV AH, 9 INT 21H XOR AX, AX ; clear AX MOV AL, CL ; set AL=CL CALL OUTDEC ; call the procedure OUTDEC LEA DX, PROMPT_3 ; load and display the string PROMPT_3 MOV AH, 9 INT 21H XOR AX, AX ; clear AX MOV AL, CH ; set AL=CH CALL OUTDEC ; call the procedure OUTDEC MOV AH, 4CH ; return control to DOS INT 21H MAIN ENDP READ_STR PROC ; this procedure will read a string from user and store it ; input : DI=offset address of the string variabel ; output : BX=number of characters read ; : DI=offset address of the string variabel PUSH AX ; push AX onto the STACK PUSH DI ; push DI onto the STACK CLD ; clear direction flag XOR BX, BX ; clear BX @INPUT_LOOP: ; loop label MOV AH, 1 ; set input function INT 21H ; read a character CMP AL, 0DH ; compare AL with CR JE @END_INPUT ; jump to label @END_INPUT if AL=CR CMP AL, 08H ; compare AL with 08H JNE @NOT_BACKSPACE ; jump to label @NOT_BACKSPACE if AL!=08H CMP BX, 0 ; compare BX with 0 JE @INPUT_ERROR ; jump to label @INPUT_ERROR if BX=0 MOV AH, 2 ; set output function MOV DL, 20H ; set DL=20H INT 21H ; print a character MOV DL, 08H ; set DL=08H INT 21H ; print a character DEC BX ; set BX=BX-1 DEC DI ; set DI=DI-1 JMP @INPUT_LOOP ; jump to label @INPUT_LOOP @INPUT_ERROR: ; jump label MOV AH, 2 ; set output function MOV DL, 07H ; set DL=07H INT 21H ; print a character MOV DL, 20H ; set DL=20H INT 21H ; print a character JMP @INPUT_LOOP ; jump to label @INPUT_LOOP @NOT_BACKSPACE: ; jump label STOSB ; set ES:[DI]=AL INC BX ; set BX=BX+1 JMP @INPUT_LOOP ; jump to label @INPUT_LOOP @END_INPUT: ; jump label POP DI ; pop a value from STACK into DI POP AX ; pop a value from STACK into AX RET READ_STR ENDP OUTDEC PROC ; this procedure will display a decimal number ; input : AX ; output : none PUSH BX ; push BX onto the STACK PUSH CX ; push CX onto the STACK PUSH DX ; push DX onto the STACK CMP AX, 0 ; compare AX with 0 JGE @START ; jump to label @START if AX>=0 PUSH AX ; push AX onto the STACK MOV AH, 2 ; set output function MOV DL, "-" ; set DL='-' INT 21H ; print the character POP AX ; pop a value from STACK into AX NEG AX ; take 2's complement of AX @START: ; jump label XOR CX, CX ; clear CX MOV BX, 10 ; set BX=10 @OUTPUT: ; loop label XOR DX, DX ; clear DX DIV BX ; divide AX by BX PUSH DX ; push DX onto the STACK INC CX ; increment CX OR AX, AX ; take OR of Ax with AX JNE @OUTPUT ; jump to label @OUTPUT if ZF=0 MOV AH, 2 ; set output function @DISPLAY: ; loop label POP DX ; pop a value from STACK to DX OR DL, 30H ; convert decimal to ascii code INT 21H ; print a character LOOP @DISPLAY ; jump to label @DISPLAY if CX!=0 POP DX ; pop a value from STACK into DX POP CX ; pop a value from STACK into CX POP BX ; pop a value from STACK into BX RET ; return control to the calling procedure OUTDEC ENDP END MAIN

Related questions

Explain how int 21h can be used for input output in 8086 microprocessor?

The INT 21H instruction in the 8086 is a software interrupt to vector 21H. In order for it to be used for input/output, the programming that responds to INT 21H must be present. This is part of the Operating System.


What is the function of 01h of Int 21h?

Read the manual, please. If you don't know where the manual is, Ralph Brown's famous interrupt-list might help.


21H is a n_____of hydrogen?

Isotope. APEX


Find given numbers odd or even in 8085 microprocessor assembly language?

.model small .stack .data m db 'the no is odd $' m1 db 'the no is even $' a db 04h b db 02h .code mov ax,@data mov ds,ax mov ah,0 mov al,a mov bl,b div bl cmp ah,00h je l1 mov dx,offset m jmp l l1: mov dx,offset m1 jmp l l: mov ah,09 int 21h mov ah,4ch int 21h end


How long to fly to new York from Melbourne?

21h 35m


How run the microprocessor program?

.Model small .data num db 47h,58h,14h,b4h.89h .code .start: mov ax,@data mov ds,ax back: add bl,[si] inc si dec dh inz back mov ch,02h mov dh,4bh mov cl,04l up: rol dh,cl mov bl,dh and bl,0fh cmp bl,09h jbe next add bl,07h next: add bl,30h mov ah,02h mov dl,bl int 21h dec ch jnz up end start end


Write a program to subtract two 16 bit numbers in microprocessor 8086?

.code main proc mov ax,@data mov ds,ax lea dx,msg ;printing msg mov ah,09h int 21h mov ax,x ;ax=x mov bx,y ;bx=y cmp ax,0 ;jump to l3 if ax is negtive jb l3 cmp bx,0 ;jump to l6 if bx is negative jb l6 cmp ax,bx ;if ax<bx,then jump to l1 jl l1 sub ax,bx ;else normal sub mov diff,ax ;diff=result is stored jmp l2 l1: ;iff (+)ax<(+)bx neg bx ;bx=-bx clc add ax,bx neg ax ;-ans=ans mov diff,ax mov dx,2dh ;print '-' mov ah,02h int 21h jmp l2 l3: ;iff (-)ax neg ax ;-ax=ax cmp bx,0 ;jump to l4 if bx is negative jb l4 clc add ax,bx ;ax=(+)ax+(+)bx mov ax,diff mov dx,2dh ;print '-' mov ah,02h int 21h jmp l2 l4: ;if (-)ax & (-)bx neg bx ;-bx=bx cmp ax,bx ;if ax>bx then jump to l5 jg l5 sub ax,bx ;else ax-bx mov diff,ax mov dx,2dh ;print '-' mov ah,02h int 21h jmp l3 l5: ;if(-)ax>(-)bx xchg ax,bx ;exchange ax and bx sub ax,bx ;ax-bx mov diff,ax ;ans is positive jmp l2 l6: ;iff (-)bx neg bx ;-bx=bx add ax,bx ;ax-(-)bx mov diff,ax ;ans will be positive mov ah,4ch int 21h main endp


What are the coordinates and hours of capricornus?

21h 00m 00s, −20° 00′ 00″


What is Coding of 7 segment display using assembly language?

mov ax, @data ; Initialize data section mov ds, ax mov bx, offset lookup ; Load offset of lookup in bx mov al, key ; key no. in al xlat ; translate byte in al mov bh, al ; al = lookup(key) mov ch, 02h ; Count of digits to be displayed mov cl, 04h ; Count to roll by 4 bits l2: rol bh, cl ; roll bl so that msb comes to lsb mov dl, bh ; load dl with data to be displayed and dl, 0fH ; get only lsb cmp dl, 09 ; check if digit is 0-9 or letter A-F jbe l4 add dl, 07 ; if letter add 37H else only add 30H l4: add dl, 30H mov ah, 02 ; Function 2 under INT 21H (Display character) int 21H dec ch ; Decrement Count jnz l2 mov ah, 4cH ; Terminate Program int 21H end


S equals 21w plus 21h plus 2hw?

yes and tom rules


Program to subtract two 8 bit numbers using 8086 microprocessor?

I have a code for 16 bit subtraction.. just replace ax by al,bx by bl etc... .code main proc mov ax,@data mov ds,ax lea dx,msg ;printing msg mov ah,09h int 21h mov ax,x ;ax=x(any number) mov bx,y ;bx=y( " ") cmp ax,0 ;jump to l3 if ax is negtive jb l3 cmp bx,0 ;jump to l6 if bx is negative jb l6 cmp ax,bx ;if ax<bx,then jump to l1 jl l1 sub ax,bx ;else normal sub mov diff,ax ;diff=result is stored jmp l2 l1: ;iff (+)ax<(+)bx neg bx ;bx=-bx clc add ax,bx neg ax ;-ans=ans mov diff,ax mov dx,2dh ;print '-' mov ah,02h int 21h jmp l2 l3: ;iff (-)ax neg ax ;-ax=ax cmp bx,0 ;jump to l4 if bx is negative jb l4 clc add ax,bx ;ax=(+)ax+(+)bx mov ax,diff mov dx,2dh ;print '-' mov ah,02h int 21h jmp l2 l4: ;if (-)ax & (-)bx neg bx ;-bx=bx cmp ax,bx ;if ax>bx then jump to l5 jg l5 sub ax,bx ;else ax-bx mov diff,ax mov dx,2dh ;print '-' mov ah,02h int 21h jmp l3 l5: ;if(-)ax>(-)bx xchg ax,bx ;exchange ax and bx sub ax,bx ;ax-bx mov diff,ax ;ans is positive jmp l2 l6: ;iff (-)bx neg bx ;-bx=bx add ax,bx ;ax-(-)bx mov diff,ax ;ans will be positive mov ah,4ch int 21h main endp


What int 21a?

1. syntax error2. int 21h -- assembly statement in x86 to access a MS-DOS service