; multi-segment executable file template.

data segment
    ; add your data here!
    msj db "Introduzca el Nro.:$" 
    enter db 13,10,"$"
ends

stack segment
    dw   128  dup(0)
ends

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax
    mov es, ax

    ; add your code here
            
    lea dx, msj
    mov ah, 9
    int 21h        ; output string at ds:dxį
    
    ;LECTURA DE NRO
    mov bx,0
    mov cx,10
  ciclo:
    mov ah,1
    int 21h 
    mov cx,0
    mov cl,al
    cmp cl,13
    jz finlee
    sub cl,48
    mov ax,bx
    mov dx,10
    mul dx
    add ax,cx
    mov bx,ax
    jmp ciclo
  finlee:        
    ;desde aqui la impresion del numero en BX
    lea dx,enter
    mov ah,9
    int 21h
    mov ax,bx
    mov bx,0
  siguiente:
    mov dx,0
    mov cx,10
    div cx
    push dx
    add bx,1
    cmp ax,0
    jnz siguiente
    mov cx,bx
  imprime:
    pop dx
    add dl,48
    mov ah,2   
    int 21h
    loop imprime
    
    mov ax, 4c00h ; exit to operating system.
    int 21h    
ends

end start ; set entry point and stop the assembler.
