Advertisement
Guest User

asm

a guest
Jan 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Exercice 1
  2. Donner la traduction en assembleur des différentes expressions :
  3. 1)  z := x + y 2) y := d – x 3) x := a + b – c 4) x := a - b + c 3)
  4.  
  5. z = y+ X
  6. mov tmp0,x
  7. add tmp0,y
  8. mov z,tmp0
  9. y= d-x
  10. mov tmp0,x
  11. sub tmp0,d
  12. mov y,tmp0
  13. x = a+b-c
  14. mov tmp0,c
  15. sub tmp0,b
  16. add tmp0,a
  17. mov x,tmp0
  18.  
  19. 2)  SI (e1 = e2) ALORS r :=1 SINON r :=0 FIN_SI
  20.  
  21. cmp e1,e2
  22. jne sin
  23. mov r,1
  24. jmp fin
  25. sin: mov r,0
  26. fin:
  27. mov ah,4ch
  28. int 21h
  29.  
  30. 3)  Exercice 2 Écrire un programme assembleur qui lit et affiche un caractère.
  31.  
  32. mov dl,65
  33. mov ah,2
  34. int 21h
  35. mov ah,4ch
  36. int 21h
  37.  
  38. 4)  Exercice 3 Écrire un programme assembleur qui affiche l’alphabet en majuscule.
  39.  
  40. mov dl,64
  41. mov cx,0
  42. boucle:
  43. cmp cx,26
  44. je fin
  45. inc cx
  46. inc dl
  47. mov ah,2
  48. int 21h
  49. jmp boucle
  50. fin:
  51. mov ah,4ch
  52. int 21h
  53.  
  54. 5)  Exercice 4 :  Écrire un programme qui affiche la série de nombres suivante {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
  55.  
  56. mov dl,'/'
  57. mov cx,0
  58. boucle:
  59. cmp cx,10
  60. je fin
  61. inc cx
  62. inc dl
  63. mov ah,2
  64. int 21h
  65. jmp boucle
  66. fin:
  67. mov ah,4ch
  68. int 21h
  69.  
  70. 6)  Exercice 5 :  Écrire un programme permettant la saisie et l'affichage tant que le caractère saisi est différent de  A (code ASCII 65).
  71.  
  72. mov dl,'A'
  73. boucle:
  74. mov ah,1
  75. int 21h
  76. cmp dl,ah
  77. jne boucle
  78. je fin
  79. fin:
  80. mov ah,4ch
  81. int 21h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement