Advertisement
alvsjo

zad6

Jun 7th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .stack
  3. .data
  4. n dw 23
  5. f1 dw 1
  6. f2 dw 1
  7. p dw ?
  8. .code
  9.  
  10. main:
  11.  
  12. mov ax,@data
  13. mov ds,ax
  14.  
  15.  
  16. mov ax,n
  17. sub ax,2
  18. mov n,ax
  19.  
  20. mov cx, 0
  21.  
  22. petlja:
  23. cmp cx,n
  24. je done
  25. mov ax,f1
  26. mov bx,f2
  27.  
  28. add ax,bx
  29. mov f1,bx
  30. mov f2,ax
  31. inc cx
  32. jmp petlja
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. done:
  45.  
  46. mov ax,f2
  47. mov bx,0
  48. mov cx,10
  49. stampa:
  50. cmp ax, 0
  51. je kraj_stampa
  52. mov dx,0
  53. div cx
  54. push dx
  55. inc bx
  56. jmp stampa
  57.  
  58. kraj_stampa:
  59.    cmp bx, 0
  60.    je kraj
  61.    pop dx
  62.    add dx, '0'
  63.    mov ah, 2
  64.    int 21h
  65.    dec bx
  66.    jmp kraj_stampa
  67.  
  68. kraj:
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. mov ah,4ch
  85. int 21h
  86.  
  87. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement