Guest User

Untitled

a guest
May 26th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. ; multi-segment executable file template.
  2.  
  3. include 'emu8086.inc'
  4.  
  5. data segment
  6. ; add your data here!
  7.  
  8. array db 100 dup(?)
  9. dim db ?
  10. n db ?
  11. min db ?
  12.  
  13.  
  14.  
  15. a_capo db 13,10,'$'
  16.  
  17. ends
  18.  
  19. stack segment
  20. dw 128 dup(0)
  21. ends
  22.  
  23. code segment
  24. start:
  25. ; set segment registers:
  26. mov ax, data
  27. mov ds, ax
  28. mov es, ax
  29.  
  30. ; add your code here
  31.  
  32. call pthis
  33. db "inserisci dimensione array ",0
  34.  
  35. call scan_num
  36.  
  37. lea dx,a_capo
  38. mov ah,9
  39. int 21h
  40.  
  41. call pthis
  42. db "inserisci elementi array ",0
  43.  
  44. lea dx,a_capo
  45. mov ah,9
  46. int 21h
  47.  
  48. call inserisci
  49.  
  50. lea dx,a_capo
  51. mov ah,9
  52. int 21h
  53.  
  54. call pthis
  55. db "gli elementi dell'array sono: ",0
  56.  
  57. lea dx,a_capo
  58. mov ah,9
  59. int 21h
  60.  
  61. call visualizza
  62.  
  63. lea dx,a_capo
  64. mov ah,9
  65. int 21h
  66.  
  67. call pthis
  68. db "calcolo minimo o massimo",0
  69.  
  70. lea dx,a_capo
  71. mov ah,9
  72. int 21h
  73.  
  74. call pthis
  75. db "immettere m per minimo oppure M per massimo ",0
  76.  
  77. call inserisci2
  78.  
  79. lea dx,a_capo
  80. mov ah,9
  81. int 21h
  82.  
  83.  
  84.  
  85.  
  86. ; wait for any key....
  87. mov ah, 1
  88. int 21h
  89.  
  90. mov ax, 4c00h ; exit to operating system.
  91. int 21h
  92. ends
  93.  
  94. inserisci proc
  95. mov bl,0
  96.  
  97.  
  98. mov ah,1
  99. int 21h
  100. mov array[bl],al
  101. inc bl
  102. cmp bl,dim
  103. jne ins
  104.  
  105. ret
  106. inserisci endp
  107.  
  108. visualizza proc
  109. xor si,si
  110. xor cx,cx
  111.  
  112. visual:
  113. mov cl,array[si]
  114. mov ah,2
  115. mov dl,cl
  116. int 21h
  117. inc si
  118. cmp si,
  119. jne visual
  120.  
  121. fine:
  122. ret
  123. visualizza endp
  124.  
  125. inserisci2 proc
  126. mov ah,1
  127. int 21h
  128. mov n,'0'
  129. ret
  130. inserisci2 endp
  131.  
  132.  
  133.  
  134.  
  135. define_pthis
  136. define_scan_num
  137.  
  138. end start ; set entry point and stop the assembler.
Add Comment
Please, Sign In to add comment