Categories
- 4th semester (27)
- 5th semester (3)
- ADA (13)
- Assembly Level Language (12)
- BE (45)
- C Language Programming (5)
- C language (20)
- C++ Language (5)
- CCP Lab programing (3)
- Computer Programming Lab (3)
- DAA Lab Programming (13)
- Data Structure and C++ laboratory Program (6)
- Data Structure and C++ labotary Program (5)
- Design and Analysis of algorithm (14)
- First Year (5)
- MASM (12)
- Microprocessor (12)
- Microprocessor lab program (12)
- System Software & OS Laboratory (5)
- Unix program (4)
- bachelor of engineering (30)
- basic (1)
- basic mathematics (2)
- beginners (10)
- c++ program (9)
- calculations (7)
- computer science (30)
- downloadable (5)
- engineering syllabus (4)
- simple program (6)
Trend Posts
Blogger news
Author
Followers
Showing posts with label display string. Show all posts
Showing posts with label display string. Show all posts
Monday, July 21, 2014
//refer libraries
#include<stdio.h>
#include<conio.h>
void main() //main function definition
{
char c[10];// string variable declaration
clrscr();//to clear the screen it explained in conio.h
printf(“enter your string \n”);
scanf(“%s”,c);
printf(“you are entered string is :%s”,c);
getch();//this function makes to wait a character from standard input or keyboard this function described in conio.h
}
Labels:
beginners,
C language,
display string,
print,
read,
simple program,
string
|
0
comments
Friday, February 21, 2014
ASSUME CS: CODE, DS: DATA
DATA SEGMENT ; start of data
segment
MSG1 DB 0DH, 0AH,'ENTER YOUR NAME : ', '$'
MSG2 DB 'WHAT IS YOUR NAME? ',
'$'
STR DB
25 DUP(' '), '$' ; 25 bytes of STR array (blank) is declared to store
the user entered name.
X DB 04H ; X coordinate
value
Y DB 12H ; Y
coordinate value
DATA ENDS
DISPLAY MACRO MSG ; DISPLAY macro definition starts
MOV DX, OFFSET MSG
MOV AH, 09H ; display the message whose offset is in
DX using 09H
INT 21H ; with DOS 21H interrupt.
ENDM ; end of macro definition
CODE SEGMENT
START:
MOV AX, DATA ; data segment initialization
MOV DS, AX
DISPLAY MSG1 ; invoke the DISPLAY macro to display
MSG1
MOV SI, OFFSET STR ; SI
point to the 1st memory location of STR array
BACK: MOV AH, 01H ; read a character from keyboard using
01H service
INT 21H ; with 21h interrupt, then compare with
enter key
CMP AL, 0DH ; if yes terminate, otherwise store in
STR array pointed by SI JE
STOP ; if yes terminate,
MOV [SI], AL ; otherwise store in STR array pointed by
SI
INC
SI ; increment SI, to point to the next
location of STR array
JMP BACK ; jump to BACK to
read the next character
STOP: MOV
AH, 07H ; service number
to clear the screen
MOV AL, 00H
; Number of lines to scroll; 00 blank
screen.
MOV BH, 0FH ; attribute of
character; 0F white and 00 black
MOV CX, 00H ; CH=00 Y coordinate of upper left corner
and
; CL=00 X
coordinate of upper right corner.
MOV DH, 31H ; Number of rows;
MOV DL, 79H ; Number of columns;
INT 10H ; BIOS interrupt
to clear the screen is invoked
MOV
AH, 02H ; service number to set the cursor
MOV BH, 00H ; set video Page number to 0
MOV DH, Y ; store row
number in DH (Y coordinate)
MOV
DL, X ; store the
column number (X) in DL register
INT
10H ;
BIOS interrupt to set the cursor is invoked.
DISPLAY MSG2 ; invoke the
DISPLAY macro to display MSG2.
DISPLAY STR ; invoke the
DISPLAY macro to display STR array contents
MOV AH, 4CH ; terminate the program
INT 21H
CODE ENDS ; end of code segment
END
START ; end of program
Output:
D:\MASM>
Masm 7a.asm;
D:\MASM>
Link 7a.obj;

D:\MASM>
TD 7a.exe
Press
F7 to trace the program (line by
line execution).
Subscribe to:
Posts (Atom)