getname.asm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ; Вариант 19
  2. ; Еникеев И.Р. 2084/1
  3. .286
  4. .model tiny
  5. .data
  6. org 100h
  7. start:
  8. mov dx, offset path
  9. mov di, offset pass
  10. mov cx, 10
  11. mov al, ' '
  12. repnz scasb
  13. jnz $+3
  14. inc cx
  15. sub cx, 10
  16. neg cx
  17. call bps
  18. bps:
  19. pop bp
  20. sub bp, offset bps
  21. ;---------------------
  22. push ds
  23. push dx
  24. ; Test, if currently opening file is in database
  25. mov di, dx
  26. call SeekZ
  27. push di
  28. std
  29. mov al, '\'
  30. repnz scasb
  31. cld
  32. jnz $+3
  33. inc di
  34. inc di
  35. pop cx
  36. sub cx, di
  37. push cx
  38. push di
  39. mov dx, 12
  40. push cs
  41. pop es
  42. lea di, [bp+files]
  43. searchloop:
  44. pop si
  45. pop cx
  46. push cx
  47. push si
  48. push di
  49. mov al, es:[di]
  50. jz not_found
  51. repz cmpsb
  52. jz found
  53. pop di
  54. add di, dx
  55. jmp searchloop
  56. found:
  57. pop di
  58. pop si
  59. pop cx
  60. jmp outta
  61. not_found:
  62. outta:
  63. mov ah, 4ch
  64. int 21h
  65. SeekZ proc near
  66. mov al, 0
  67. mov cx, 0ffffh
  68. repnz scasb
  69. neg cx
  70. dec cx
  71. dec di
  72. ret
  73. endp
  74. path db 0
  75. files db 0
  76. pass db '1234567890 '
  77. end start