Advertisement
Nahid8195

LAB 4 ( Write a program to PRINT 11*11 astaric and print 3letter in the middle)

Oct 29th, 2021
3,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  ;   Write a program to PRINT 11*11 astaric and print 3letter in the middle
  2.  
  3. .MODEL SMALL   ; IN THIS COURSE ALL MODEL ARE SMALL
  4. .STACK 100H    ; WE ALWAYS USE STACK 100H
  5.  
  6.  
  7. .DATA     ; DATA SEGMENT
  8.  
  9.     PROMPT     DB  "Enter three initials : $\"    ; to print it we store in it a prompt variable
  10.     ASTERISKS  DB  "***********",0DH,0AH,"$"              ; to print 11*11 we store here 11 asterisks
  11.     NEXT_LINE  DB  0DH,0AH,"$"                            ; we took new line here
  12.  
  13.  .CODE
  14.  
  15.     MAIN PROC   ; main code start here
  16.  
  17.     ;PROGRAMME SEGMENT PREFIX
  18.     MOV AX,@DATA
  19.     MOV DS,AX    ; INITILATION OF DS
  20.  
  21.  
  22.      LEA DX, PROMPT  ; to print the prompt value we load the data            
  23.      MOV AH, 9       ; this instraction will print the loaded data
  24.      INT 21H         ; this is used to print the instruction
  25.  
  26.      MOV AH, 1       ; it is used to input a single chracter            
  27.      INT 21H         ; computer will take a input here
  28.  
  29.      MOV BL, AL      ; move the input value in BL, as we know generally when we input it will store it on AL            
  30.  
  31.      INT 21H         ; this will take another input            
  32.  
  33.      MOV BH, AL      ; we move the next input into BH            
  34.  
  35.      INT 21H         ; this will take the third input            
  36.  
  37.      MOV CL, AL      ; we move the third input into CL            
  38.  
  39.      LEA DX, NEXT_LINE  ; this instruction is used to take a new line.. as it contains new line          
  40.      MOV AH, 9          ; this function is to used the load value of new_line
  41.      INT 21H            ; computer give new line here
  42.      
  43.      ; we print asterisks from here  as our input already taken
  44.  
  45.      LEA DX, ASTERISKS   ; we load the asterisks variable here.. as it contains *        
  46.      MOV AH, 9           ; this instruction is to print the loaded value                                
  47.  
  48.      INT 21H             ; computer will print 11* . because asterisks variable contains 11 *.. it will print 1 time        
  49.      INT 21H             ;  it will print 1 time  1 * 11
  50.      INT 21H             ;  it will print 1 time  1 * 11
  51.      INT 21H             ;  it will print 1 time  1 * 11
  52.      INT 21H             ;  it will print 1 time  1 * 11
  53.      
  54.      ; at the end of this instruction we got 5 * 11 asteriks. now we print 4 * and the three initials and the other 4 * .. and then 5line 5*11 asteriks
  55.  
  56.      MOV ASTERISKS+4, BL   ; we print our first input value into 4th positon of asterisks      
  57.      MOV ASTERISKS+5, BH   ; we print our second input value into 5th positon of asterisks      
  58.      MOV ASTERISKS+6, CL   ; we print our third input value into 6th positon of asterisks
  59.  
  60.      INT 21H               ; this will print three variable into the 4,5,6 th position...      
  61.  
  62.      MOV ASTERISKS+4, "*"  ; then we update 4th position into * to print the remain line in *        
  63.      MOV ASTERISKS+5, "*"  ; then we update 5th position into * to print the remain line in *        
  64.      MOV ASTERISKS+6, "*"  ; then we update 6th position into * to print the remain line in *
  65.  
  66.      INT 21H             ;  it will print 1 time  1 * 11
  67.      INT 21H             ;  it will print 1 time  1 * 11
  68.      INT 21H             ;  it will print 1 time  1 * 11
  69.      INT 21H             ;  it will print 1 time  1 * 11
  70.      INT 21H             ;  it will print 1 time  1 * 11
  71.  
  72.     MOV AH,4CH   ; TERMINATED THE CODE AND EXIT
  73.     INT 21H
  74.  
  75.     MAIN ENDP
  76. END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement