Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Write a program to PRINT 11*11 astaric and print 3letter in the middle
- .MODEL SMALL ; IN THIS COURSE ALL MODEL ARE SMALL
- .STACK 100H ; WE ALWAYS USE STACK 100H
- .DATA ; DATA SEGMENT
- PROMPT DB "Enter three initials : $\" ; to print it we store in it a prompt variable
- ASTERISKS DB "***********",0DH,0AH,"$" ; to print 11*11 we store here 11 asterisks
- NEXT_LINE DB 0DH,0AH,"$" ; we took new line here
- .CODE
- MAIN PROC ; main code start here
- ;PROGRAMME SEGMENT PREFIX
- MOV AX,@DATA
- MOV DS,AX ; INITILATION OF DS
- LEA DX, PROMPT ; to print the prompt value we load the data
- MOV AH, 9 ; this instraction will print the loaded data
- INT 21H ; this is used to print the instruction
- MOV AH, 1 ; it is used to input a single chracter
- INT 21H ; computer will take a input here
- MOV BL, AL ; move the input value in BL, as we know generally when we input it will store it on AL
- INT 21H ; this will take another input
- MOV BH, AL ; we move the next input into BH
- INT 21H ; this will take the third input
- MOV CL, AL ; we move the third input into CL
- LEA DX, NEXT_LINE ; this instruction is used to take a new line.. as it contains new line
- MOV AH, 9 ; this function is to used the load value of new_line
- INT 21H ; computer give new line here
- ; we print asterisks from here as our input already taken
- LEA DX, ASTERISKS ; we load the asterisks variable here.. as it contains *
- MOV AH, 9 ; this instruction is to print the loaded value
- INT 21H ; computer will print 11* . because asterisks variable contains 11 *.. it will print 1 time
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- ; 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
- MOV ASTERISKS+4, BL ; we print our first input value into 4th positon of asterisks
- MOV ASTERISKS+5, BH ; we print our second input value into 5th positon of asterisks
- MOV ASTERISKS+6, CL ; we print our third input value into 6th positon of asterisks
- INT 21H ; this will print three variable into the 4,5,6 th position...
- MOV ASTERISKS+4, "*" ; then we update 4th position into * to print the remain line in *
- MOV ASTERISKS+5, "*" ; then we update 5th position into * to print the remain line in *
- MOV ASTERISKS+6, "*" ; then we update 6th position into * to print the remain line in *
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- INT 21H ; it will print 1 time 1 * 11
- MOV AH,4CH ; TERMINATED THE CODE AND EXIT
- INT 21H
- MAIN ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement