vakho

არქიტექტურა - Compare numbers

Oct 16th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. data segment
  2. num1 db ? ; define byte carieli (arainicializirebuli)
  3. num2 db ?
  4. msg1 db 10,13,"Enter first number to compare : $"
  5. msg2 db 10,13,"Enter second number to compare : $"
  6. msg3 db 10,13,"Smaller number is : $"
  7. ends
  8.  
  9. code segment
  10.  
  11. start:
  12. mov ax, data ; data ax (nebismier zogadi danishnulebis registrshi)
  13. mov ds, ax ;da mere ds-shi!
  14.  
  15. ; lea misamarts inaxavs igive mov dx, offset msg1
  16. lea dx, msg1
  17. mov ah, 9
  18. int 21h ; DO IT - sheasrule brdzaneba romelic weria ah-Shi mxolod!
  19.  
  20. mov ah, 1 ; konsolidan kitxva da chawera mxolod al-shi!
  21. int 21h
  22. mov num1, al
  23.  
  24. mov dx, offset msg2
  25. mov ah, 9
  26. int 21h
  27.  
  28. mov ah, 1
  29. int 21h
  30. mov num2, al
  31.  
  32. lea dx, msg3
  33. mov ah, 9
  34. int 21h
  35.  
  36. mov al, num1
  37.  
  38. cmp al, num2 ; compare
  39. jg second
  40. ; jump greater anu tu metia pirveli
  41. ; mashin gadava second-is shesrulebaze
  42.  
  43. first:
  44. mov ah, 2; shedegis gamotana print mxolod dl-dan!
  45. mov dl, num1
  46. int 21h
  47. jmp exit ; exit-ze gadaxtoma
  48.  
  49. second:
  50. mov ah, 2
  51. mov dl, num2
  52. int 21h
  53. exit:
  54. ; operaciulze moqmedebis gadacema (return-i)
  55. mov ah, 4Ch ; 4C00 chaiwereba ah-shi mxolod 4C rac programis dasasruls nishnavs
  56. int 21h
  57. ends
  58. end start
Advertisement
Add Comment
Please, Sign In to add comment