Logo 
Search:

Assembly Language Articles

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

Program to convert an integer number from base 8 to base 10 and store it in an array

Posted By: Adelfrid Fischer     Category: Assembly Language     Views: 2068

Write an assembly program to convert an integer number from base 8 to base 10 and store it in an array.

Code for Program to convert an integer number from base 8 to base 10 and store it in an array in Assembly Language

.model small

.data
        tmp    db 5 dup(0)
        ten db 10
        eght db 8
        cntr db 0
        ans dw ?
        tmp1 db 5 dup(?)

.code
        mov ax,@data
        mov ds,ax
        
        mov al,71
        mov BX,0000
        LEA SI,tmp

        L1:
                mov ah,00
                div ten
                mov tmp[BX],ah
                add cntr,1
                add BX,1
                cmp al,00
                jne L1

        mov BX,0000
        sub cntr,1
        
        mov ah,00
        mov al,tmp[BX]
        mov ans,ax

        L2:
                inc BX
                mov ax,1
                mov cx,bx
                pow:
                        mul eght
                        Loop pow
                mul tmp[BX]
                add ans,ax
                sub cntr,1
                cmp cntr,0
                jg L2



        mov ax,ans
        mov BX,0000
        mov cntr,0
        L3:
                div ten
                mov tmp[BX],ah
                add cntr,1
                add BX,1
                mov ah,00
                cmp al,00
                jne L3

        mov ch,00
        mov Cl,cntr
        mov dh,00
        mov bl,cntr
        mov bh,00
        L4:
                sub bl,1
                add tmp[BX],30h
                mov ah , 02h
                mov dl,tmp[BX]
                int 21h
                Loop L4

        

        

        mov ax,4C00h
        int 21h
end
  
Share: 



Adelfrid Fischer
Adelfrid Fischer author of Program to convert an integer number from base 8 to base 10 and store it in an array is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
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!