Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack
- .data
- niz dw 9 dup (45,0,-2,95,91,-36,14,-15,108)
- sum dw ?
- .code
- main:
- mov ax,@data
- mov ds, ax
- mov ax,0
- mov bx,0
- mov sum,0
- suma:
- cmp bx, length niz
- je done
- shl bx,1
- mov cx, niz[bx]
- add ax,cx
- shr bx,1
- inc bx
- jmp suma
- done:
- mov sum, ax
- cmp ax,0
- je nula
- cmp ax, 0
- jg dalje
- negativ:
- mov dx, '-'
- mov ah,2
- int 21h
- mov ax, niz[bx]
- neg ax
- dalje:
- mov cx,0
- mov bx, 10
- cifre:
- cmp ax,0
- jng stampa
- mov dx,0
- div bx
- push dx
- inc cx
- jmp cifre
- stampa:
- cmp cx,0
- jng kraj1
- pop dx
- add dx, '0'
- mov ah,2
- int 21h
- dec cx
- jmp stampa
- nula:
- mov dx, '0'
- mov ah,2
- int 21h
- kraj1:
- mov ah,4ch
- int 21h
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement