Advertisement
apl-mhd

print pyramid

Jul 23rd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. mov bx,0
  3.  
  4.  
  5. lop:
  6. cmp bx, 4
  7. JL printspace  
  8. hlt
  9.  
  10.  
  11.  
  12. printspace:
  13.        
  14. mov cx, 4
  15. sub cx, bx
  16. add cx,1
  17.  
  18. cmp cx,0
  19. jz hold
  20.  
  21. mov cx,cx
  22. mov ah,2
  23. mov dl, ' '    ; print space
  24. top1:
  25. int 21H
  26. loop top1
  27.  
  28.  
  29.   cmp bx,0
  30.   jz addbx
  31.  
  32.  
  33.   add bx,2
  34.  
  35.  
  36.  
  37.  
  38. jmp printstar
  39.  
  40.  
  41.  
  42. printstar:  
  43.  
  44.  
  45.  mov cx,bx
  46.  mov ah,2
  47.  mov dl, '*'
  48.  top2:
  49.  int 21h
  50.  loop top2  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. mov ah,2
  57. mov dl, 0AH
  58. int 21h
  59.               ;print newline
  60. mov ah,2
  61. mov dl, 0DH
  62. int 21h
  63.  
  64.  
  65. cmp bx,1
  66. JNE subbx
  67.  
  68.  
  69.  
  70. jmp lop
  71.  
  72. hlt
  73.  
  74.  
  75. hold:
  76. hlt
  77.  
  78.  
  79. addbx:
  80.  
  81. add bx,1
  82.  
  83. jmp printstar
  84. hlt
  85.  
  86. subbx:
  87.  
  88. sub bx,1
  89. jmp lop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement