Sunday, 14 June 2015

Read One Of The Hex Digits A-F, And Display It On The Next Line In Decimal In Assembly Language Solution.

Write a program to read one of the hex digits A-F, and display it on the next line in decimal in 
assembly language Solution.

Samole excution:
        ENTER A HEX DIGIT : C
        IN DECIMAL IT IS 12
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/

Solution:

.model small
.stack 100h
.data
    ask db 'ENTER A HEX DIGIT : '
    val1 db ?
    fin db '$'
    str db 0ah,0dh,'IN DECIMAL IT IS 1'
    ans db ?
    finish db '$'
.code

main proc
 
    mov ax,@data
    mov ds,ax
 
    mov ah,9
    lea dx,ask
    int 21h
 
    mov ah,1
    int 21h
    mov val1,al
 
    mov bl,val1
    sub bl,11h
    mov ans,bl
 
    mov ah,9
    lea dx,str
    int 21h
 
    mov ah,4ch
    int 21h
    main endp
end main

1 comment:

  1. vai 'mov ah,2 ' function naie bt output kivaba print hoitasa?

    ReplyDelete