.model small
.386
.stack 64
.data
v1 dw 23,09,1991
maestro db ?
.code
inicio proc near
mov ax,@data
mov ds,ax
lea si, v1
mov ax,0
mov bx,0
mov cx,0
mov ax,[si]
add ax,[si+2]
add ax,[si+4]
ciclo:
cmp ax,1000
ja miles
cmp ax,100
ja cientos
cmp ax,10
ja decenas
call suma
jmp salir
miles:
inc bh
sub ax,1000
jmp ciclo
cientos:
inc bl
sub ax,100
jmp ciclo
decenas:
inc ch
sub ax,10
jmp ciclo
suma:
add al,bh
add al,bl
add al,ch
mov bx,0
mov cx,0
cmp al,10
ja ciclo
salir:
mov maestro,al
mov ax,4c00h
int 21h
inicio endp
end