Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4. arr db 10 DUP(?)
  5. ends
  6.  
  7. stack segment
  8. dw 128 dup(0)
  9. ends
  10.  
  11. code segment
  12. start:
  13.  
  14. mov ax, data
  15. mov ds, ax
  16. mov es, ax
  17. call input
  18. call min
  19.  
  20. mov al,2
  21. int 21h
  22.  
  23.  
  24. mov ax, 4c00h ; exit to operating system.
  25. int 21h
  26. ends
  27.  
  28. input proc
  29. mov cx,10
  30. mov si,offset arr
  31.  
  32. again:
  33.  
  34. mov al,1
  35. int 21h
  36. mov [si],al
  37.  
  38. inc si
  39. loop again
  40. RET
  41. name EndP
  42.  
  43.  
  44. min PROC
  45.  
  46. mov cx,9
  47. mov si,offset arr
  48. mov bl, arr[si]
  49. mov bh,0
  50. inc si
  51.  
  52. again2:
  53.  
  54. cmp [si],bl
  55. jc smaller
  56. abortmission:
  57. inc si
  58. loop again2
  59. jmp dontjump
  60.  
  61. smaller:
  62. mov bl,[si]
  63. mov di,si
  64. jmp abortmission
  65.  
  66.  
  67. dontjump: RET
  68. min EndP
  69.  
  70.  
  71. end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement