Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to input a hex character and then display it as many times as that of the hex character(e.g. inp=2 print=22, inp=A print=AAAAAAAAAA)

Posted By: Bluma Fischer     Category: Assembly Language     Views: 7899

A Program to input a hex character and then display it as many times as that of the hex character(e.g. inp=2 print=22, inp=A print=AAAAAAAAAA).

Code for Program to input a hex character and then display it as many times as that of the hex character(e.g. inp=2 print=22, inp=A print=AAAAAAAAAA) in Assembly Language

.MODEL SMALL
.STACK 64
.DATA
        NL DB 0DH,0AH,'$'

.CODE

MAIN PROC
        MOV AX,@DATA
        MOV DS,AX

        MOV AH,01H
        INT 21H
        MOV BL,AL

        MOV AH,09H
        LEA DX,NL
        INT 21H

        MOV DL,BL

        CMP BL,41H
        JE ALPHA

        CMP BL,42H
        JE ALPHA

        CMP BL,43H
        JE ALPHA

        CMP BL,44H
        JE ALPHA

        CMP BL,45H
        JE ALPHA

        CMP BL,46H
        JE ALPHA

        JMP OTHERS

ALPHA:
        SUB BL,37H
        MOV CL,BL

        JMP DISP
 
OTHERS:
        SUB BL,30H
        MOV CL,BL

DISP:
        MOV AH,02H
        INT 21H

        DEC CL
        JNZ DISP

        MOV AH,4CH
        INT 21H

MAIN ENDP
END MAIN


OUTPUT
***********

C:\tasm>ex3
2
22
C:\tasm>ex3
A
AAAAAAAAAA
 
  
Share: 



Bluma Fischer
Bluma Fischer author of Program to input a hex character and then display it as many times as that of the hex character(e.g. inp=2 print=22, inp=A print=AAAAAAAAAA) is from Frankfurt, Germany.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!