Advertisement
apl-mhd

assembly online 3

Sep 4th, 2018
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;problem one
  2. mov ax,8
  3. mov bx, 9
  4. mov cx,1
  5. looop:
  6. cmp ax,bx
  7. je gcd
  8. if :
  9.  
  10. cmp ax,bx
  11. jl else
  12. sub ax,bx
  13. jmp looop
  14. else:
  15. sub bx,ax
  16. jmp looop
  17. gcd:
  18. mov dx, ax
  19.  
  20.  
  21.  
  22. ;problem 2
  23. mov ah,1
  24. int 21h
  25. sub al, 48
  26.  
  27.  
  28. mov cl ,al
  29. mov ch,al
  30. cwd
  31.  
  32. mov ax,1
  33. multi:
  34. cmp cl,1
  35.  
  36. jl movbx
  37. mul cl
  38. dec cl
  39. jmp multi:
  40.  
  41. movbx:
  42. mov bx,ax
  43. mov al, ch
  44.       cbw
  45.  
  46.  
  47. ;problem 3
  48.  
  49. mov bx,1
  50.  
  51.  add bl,1
  52. lop:
  53. mov dl,0
  54. cmp bx, 5
  55. JLE pyramid
  56. hlt
  57.  
  58.  
  59.  
  60.  
  61.  
  62. pyramid:
  63.  
  64. mov cx, bx
  65.  
  66. print:
  67. mov ah,2
  68.  add dl, 1
  69. ;add dl, 30
  70. ;mov dl, '1'
  71.  
  72.  
  73.  
  74.  
  75. int 21h
  76. loop print
  77.  
  78. mov ah,2
  79. mov dl, 0AH ;print new line
  80. int 21h
  81.  
  82.  
  83.  
  84. mov ah,2
  85. mov dl, 0DH ;print start of new line
  86. int 21h
  87.  
  88. Add bx,1
  89. mov dl,0
  90. jmp lop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement