Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Write a program to PRINT THE HEXA VALUE
- ; Sample execution:
- ; Enter letter between (A-F) : A
- ; IN HEXA DIGIT IT IS: 10
- .MODEL SMALL ; IN THIS COURSE ALL MODEL ARE SMALL
- .STACK 100H ; WE ALWAYS USE STACK 100H
- .DATA ; DATA SEGMENT
- A DB ?
- MSG1 DB 'Enter letter between (A-F) : $' ; to print the line we store it on MSG1
- MSG2 DB 0AH,0DH,"IN HEXA DIGIT IT IS: $" ; we give new line and store it on MSG2
- .CODE
- MAIN PROC ; main code start here
- ;PROGRAMME SEGMENT PREFIX
- MOV AX,@DATA
- MOV DS,AX ; INITILATION OF DS
- MOV AH,9 ; the function will use to print string
- LEA DX,MSG1 ; this print the str value
- INT 21H ; make this computer to do
- MOV AH,1 ; this will use to take input
- INT 21H ; make this work to get input
- MOV A,AL ; WE SHIFT THE INPUT INTO A
- MOV AH,9 ; the function will use to print string
- LEA DX,MSG2 ; this print the str value
- INT 21H ; make this computer to do
- MOV AH,2 ; the function will use to print
- MOV DL,31H ; WE PRINT 1 AS THE FIRST DIGIT OF EVERY ASCII VALUE FROM A-F... A=10,B=11,C=12,D=13,E=14,F=15
- INT 21H ; make computer to do this
- MOV AH,2 ; the function will use to print
- SUB A,11H ; THIS WILL SUBTRACT 11H FROM A TO PRINT 0,1,2,3,4,5 AFTER 1
- MOV DL,A ; NOW MOVE THE FINAL VALUE INTO DL
- INT 21H ; THIS WILL COMPLETE THIS WORK
- MOV AH,4CH ; TERMINATED THE CODE AND EXI
- INT 21H
- MAIN ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement