Could some one here tell me how to resolve the problem it says duplicate DecimalToString Dos that mean i cant use a macro twice in the same program if yes how to print more than one number Thanks in advance

;Author   :Alerwi Ali 
; function: Calculate the sum of 
;         both positive and negative elements of an array

;-----The macro to print a decimal---------;
DecimalToString macro numToBeprinted
     ; start of the macro
      push ax 
      push bx
      push cx     ;saving ax, bx, cx, dx to the stack
      push dx
          xor cx, cx  ; this basically do this: cx = 00000000
          mov ax,numToBeprinted  
          mov bx, 10d 
loop1: ; label we'll be using for a loop                      
          xor dx, dx 
          div bx     
           push dx   
           inc  cx    
           cmp ax, 0   
           jnz loop1 ; loop until ax = 0
           mov ah, 02 
loop2: ; another label which we'll use use to create another loop
             pop dx    
             add dl,48  
             int  21h 
             dec cx 
                  jnz loop2 
      pop dx 
      pop cx
      pop bx
      pop ax
        endm ;End of the macro
.model small
size equ 15

vett dw 1,-3,-2,5,-45,21,5,-4,7,9,-3,0,-43,-6,15
SumOfposn dw 0
SumOfnegn dw 0 
msg1 db 0DH,0AH,'The sum of pos nums  :$'
msg2 db 0DH,0AH,'The sum of Nega nums :$'

mov cx,size
xor si,si
xor bx,bx
xor dx,dx

      cmp vett[si],8000h
      js ck
      mov dx,vett[si]
      add SumOfnegn,dx
      add si,2
      loop cycle
      jmp finish
   mov bx,vett[si] 
   add SumOfposn,bx
   add si,2
   loop cycle

       lea dx,msg1
       mov ah,09h
       int 21h
        DecimalToString SumOfposn
       lea dx,msg2
       mov ah,09h
       int 21h
        DecimalToString SumOfnegn
6 Years
Discussion Span
Last Post by Alerwiali

Hey guys i geuss i discovered my mistake ..i will tell so that some one will benefit...Actually since i am using a macro which is different than procedure ,it is considered as an extension of the program so that is why i got "Duplication " To solve such problem just type local label1,....as many labels you want at the beginning of the macro . Bye

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.