Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4.  
  5. str1 db "Vnesi n:$"
  6. first db 10 dup(?)
  7. last db 10 dup(?)
  8. str1 db "Nema greska$"
  9. str2 db "Greska$"
  10.  
  11.  
  12.  
  13.  
  14. pkey db "press any key...$"
  15. ends
  16.  
  17. stack segment
  18. dw 128 dup(0)
  19. ends
  20.  
  21. code segment
  22.  
  23. read proc
  24.  
  25.  
  26.  
  27. lea si,first
  28. lea di,last
  29.  
  30.  
  31.  
  32.  
  33.  
  34. prvpat:
  35. cmp cl,0
  36. je kraj
  37. mov ah,1h
  38. int 21h
  39. mov ah,0d
  40.  
  41. mov si,ax
  42.  
  43. jmp citaj
  44.  
  45. citaj:
  46.  
  47.  
  48. mov ah,01h
  49. int 21h
  50.  
  51. cmp al,'-'
  52. je poslednabukva
  53. mov [bx],al
  54. jmp citaj
  55.  
  56. poslednabukva:
  57.  
  58. mov di,[bx]
  59.  
  60. dec cl
  61. jmp prvpat
  62.  
  63.  
  64.  
  65. kraj:
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. ret
  75. read endp
  76. start:
  77. ; set segment registers:
  78. mov ax, data
  79. mov ds, ax
  80. mov es, ax
  81.  
  82. mov ah,9h
  83. lea dx,str1
  84. int 21h
  85.  
  86. mov ah,01h
  87. int 21h
  88. mov cx,0d
  89. sub al,30h
  90. mov cl,al
  91. call read
  92.  
  93.  
  94.  
  95. lea dx, pkey
  96. mov ah, 9
  97. int 21h ; output string at ds:dx
  98.  
  99. ; wait for any key....
  100. mov ah, 1
  101. int 21h
  102.  
  103. mov ax, 4c00h ; exit to operating system.
  104. int 21h
  105. ends
  106.  
  107. end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement