Sunday, 14 June 2015

How to add hexadecimal number (A~F) with A hexadecimal number in assembly language Solution.

// How to add hexadecimal number (A~F) with A (hexadecimal number) Which is less then 19 in assembly language.
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/

Solution:

.model small
.stack 100h
.data
 
    str db 0ah,0dh,'SUM OF A AND '
    val1 db ?
    str2 db ' IS 1'
    ans db ?
    finish db '$'
 
.code

main proc
 
 
    mov ax,@data
    mov ds,ax
 
    mov ah,1
    int 21h
    mov val1,al
 
    mov bl,41h
    add bl,al
    sub bl,4eh
 
    mov ans,bl
 
    mov ah,9
    lea dx,str
    int 21h
 
    mov ah,4ch
    int 21h

    main endp
end main

No comments:

Post a Comment