Advertisement
SquirrelInBox

Untitled

Apr 11th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. model tiny
  2. .code
  3. org 100h
  4.  
  5. start:
  6. jmp main
  7. handler_for_r1 proc
  8. cmp ax, 80f0h
  9. mov ax, error_code_ok
  10. jne end1
  11. end1:
  12. iret
  13. handler_for_r1 endp
  14.  
  15.  
  16. handler_for_r2 proc
  17. cmp ax, 81f1h
  18. mov ax, error_code_ok
  19. jne end2
  20. end2:
  21. iret
  22. handler_for_r2 endp
  23.  
  24. main:
  25.  
  26. get_args:
  27.  
  28. xor bx, bx
  29. mov si, 82h
  30. mov bx, 2fh
  31. cmp [si], bl
  32. jne afail
  33.  
  34. inc si
  35. xor bx, bx
  36. mov bx, 30h
  37. cmp [si], bl
  38. je r1
  39.  
  40. xor bx, bx
  41. mov bx, 31h
  42. cmp[si], bl
  43. je r2
  44. jmp afail
  45.  
  46.  
  47. r1:
  48. mov ah, magic_num1
  49. mov al, magic_func1
  50. int 2fh
  51. cmp ax, error_code_ok
  52. je installed
  53.  
  54. mov ah, 25h
  55. mov al, 2fh
  56. mov dx, offset handler_for_r1
  57. int 21h
  58.  
  59. mov dx, offset r1
  60. int 27h
  61. jmp installed
  62.  
  63. r2:
  64. mov ah, magic_num2
  65. mov al, magic_func2
  66. int 2fh
  67. cmp ax, error_code_ok
  68. je installed
  69.  
  70. mov ah, 25h
  71. mov al, 2fh
  72. mov dx, offset handler_for_r2
  73. int 21h
  74.  
  75. mov ah, 31h
  76. mov al, 01h
  77. mov dx, offset r2
  78. int 21h
  79.  
  80.  
  81. afail:
  82. mov ah, 9h
  83. lea dx, argmess
  84. int 21h
  85. ret
  86.  
  87. installed:
  88. mov ah, 9h
  89. lea dx, msg_n_inst
  90. int 21h
  91. ret
  92.  
  93. finish:
  94. mov ah, 9h
  95. lea dx, msg_inst
  96. int 21h
  97. ret
  98.  
  99. magic_num1 db 80h
  100. magic_num2 db 81h
  101. magic_func1 db 0f0h
  102. magic_func2 db 0f1h
  103. error_code_ok dw 0ffh
  104. argmess db "Error: This programm needs args", 24h
  105. msg_n_inst db "Allready installed", 0dh, 0ah, '$'
  106. msg_inst db "Resident installed", 0dh, 0ah, '$'
  107. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement