Advertisement
salmancreation

PRINT A HALF PIRAMID UPSIDE DOWN

Nov 9th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .DATA
  2. MSG1 DB "PRINT A HALF PIRAMID UPSIDE DOWN$"
  3. MSG2 DB 10,13,"ENTER A NUMBER: $"
  4. R DB ?
  5. C DB ?
  6.  
  7. .CODE
  8. MAIN PROC
  9.     MOV AX,DATA
  10.     MOV DS,AX
  11.     INT 21H
  12.    
  13.     ;PRINT MSG1
  14.     MOV AH,9
  15.     MOV DX,OFFSET MSG1
  16.     INT 21H
  17.    
  18.     ;PRINT MSG2
  19.     MOV AH,9
  20.     MOV DX,OFFSET MSG2
  21.     INT 21H
  22.    
  23.     ;INPUT TO R
  24.     MOV AH,1
  25.     INT 21H
  26.     SUB AL,30H
  27.     MOV R,AL
  28.    
  29.     MOV C,AL
  30.    
  31.    
  32.     MOV DL,10 ;NEW LINE
  33.     MOV AH,2
  34.     INT 21H
  35.  
  36.     MOV DL,13 ;CARRIAGE RETURN
  37.     MOV AH,2
  38.     INT 21H
  39.    
  40.     MOV CL,R
  41.    
  42.     TOP:
  43.     MOV R,CL
  44.     MOV CL,C
  45.    
  46.     TOP1:
  47.     MOV DL,42 ;PRINT STAR
  48.     MOV AH,2
  49.     INT 21H
  50.     LOOP TOP1
  51.        
  52.     MOV DL,10 ;NEW LINE
  53.     MOV AH,2
  54.     INT 21H
  55.  
  56.     MOV DL,13 ;CARRIAGE RETURN
  57.     MOV AH,2
  58.     INT 21H
  59.    
  60.     DEC C
  61.     MOV DL,R
  62.     MOV CL,DL
  63.     LOOP TOP
  64.    
  65.     MOV AH,4CH
  66.     INT 21H
  67.    
  68. ENDP
  69. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement