Displaying Source Code(s)
|
|
Program for implementing all the display functions.
--------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<process.h>
#include<iostream.h>
# include<ctype.h>
main()
{
int choice;
char cont='y';
int
a1q1(),a1q2(),a1q3(),a1q4(),a1q5(),a1q6(),a1q7(),a1q8(),a1q9(),a1q10();
clrscr();
gotoxy(24,3);
while(cont=='y')
{
clrscr();
printf("
---------------------------------------");
printf("
|1.Get current Display Mode. | ");
printf("
|2.Character with chosen attribute. | ");
printf("
|3. Scroll the window up. | ");
printf("
|4.Scroll the window down. | ");
printf("
|5.Read the character & it's attribute| ");
printf("
|6.Positioning the Cursor . | ");
printf("
|7.Selecting the Video Mode. | ");
printf("
|8.Selecting the type of the Cursor. | ");
printf("
|9.Reading the Cursor position | ");
printf("
|10.Select the page of the text. | ");
printf("
|11. Exit. | ");
printf("
---------------------------------------");
printf("
Enter your choice [ ]");
gotoxy(37,16);
scanf("%d",&choice);
switch(choice)
{
case 1:
a1q1();
break;
case 2:
a1q2();
break;
case 3:
a1q3();
break;
case 4:
a1q4();
break;
case 5:
a1q5();
break;
case 6:
a1q6();
break;
case 7:
a1q7();
break;
case 8:
a1q8();
break;
case 9:
a1q9();
break;
case 10:
a1q10();
break;
case 11:
exit(0);
}
gotoxy(3,21);
printf("
Do you want to continue[y/n]: [ ]");
gotoxy(32,22);
cin>>cont;
}
getch();
}
/****************************************************************************/
a1q1()
{
clrscr();
union REGS regs;
regs.h.ah=0x0f;
int86(0x10,Žs,Žs);
int noofcol;
int displaymode;
int activetextpage;
noofcol = regs.h.ah;
displaymode = regs.h.al;
activetextpage = regs.h.bh;
printf("<BR>);
printf(" No. of Columns on Screen - %d<BR>,noofcol);
printf(" Display Mode - %d<BR>,displaymode);
printf(" The Active Text Page - %d<BR>,activetextpage);
return(0);
}
/****************************************************************************/
a1q2()
{
clrscr();
union REGS regs;
regs.h.ah = 2;
regs.h.dh = 0;
regs.h.dl = 0;
regs.h.bh = 0;
int86(0x10,Žs,Žs);
getch();
regs.h.ah = 9;
regs.h.bh = 0;
regs.h.al = 65;
regs.h.dl = 8;
regs.h.cl = 2;
regs.h.ch = 0;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
a1q3()
{
clrscr();
union REGS regs;
regs.h.ah = 6;
regs.h.al = 5;
regs.h.bh = 8;
regs.h.ch = 0;
regs.h.cl = 0;
regs.h.dh = 50;
regs.h.dl = 50;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
a1q4()
{
clrscr();
union REGS regs;
regs.h.ah = 7;
regs.h.al = 5;
regs.h.bh = 8;
regs.h.ch = 0;
regs.h.cl = 0;
regs.h.dh = 50;
regs.h.dl = 50;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
a1q5()
{
clrscr();
int x,y;
union REGS regs;
regs.h.ah = 2;
regs.h.dh = 0;
regs.h.dl = 0;
regs.h.bh = 0;
int86(0x10,Žs,Žs);
getch();
regs.h.ah = 8;
regs.h.bh = 0;
int86(0x10,Žs,Žs);
x = regs.h.al;
y = regs.h.ah;
clrscr();
printf("Ascii Character is - %d<BR>,x);
printf("The attribute of Character is - %d<BR>,y);
return(0);
}
/****************************************************************************/
a1q6()
{
clrscr();
int x,y;
union REGS regs;
printf("
Enter the X-position - ");
scanf("%d",&x);
printf("
Enter the Y-position - ");
scanf("%d",&y);
regs.h.ah = 2;
regs.h.bh = 0;
regs.h.dh = y;
regs.h.dl = x;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
a1q7()
{
clrscr();
int choice;
union REGS regs;
printf("
For CGA Mode(0-6).");
printf("
For Mono MOde(1).");
printf("
Select the Mode - ");
scanf("%d",&choice);
clrscr();
regs.h.ah = 0; /*Set cursor position*/
regs.h.al = choice;
int86(0x10,Žs,Žs);
gotoxy(40,12);
printf(" HAVE A NICE DAY");
return(0);
}
/****************************************************************************/
a1q8()
{
clrscr();
int x,y;
union REGS regs;
printf("
Enter the starting line of the cursor(0-4) - ");
scanf("%d",&x);
printf("
Enter the ending line of the cursor - ");
scanf("%d",&y);
gotoxy(40,12);
regs.h.ah = 1;
regs.h.ch = x;
regs.h.cl = y;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
a1q9()
{
clrscr();
union REGS regs;
regs.h.ah = 3;
regs.h.bh = 9;
regs.h.dh = 8;
regs.h.dl = 27;
int86(0x10,Žs,Žs);
printf("
The row position of cursor on selected page - %d",regs.h.ch);
printf("
The column position of cursor on selected page - %d",regs.h.cl);
return(0);
}
/****************************************************************************/
a1q10()
{
clrscr();
union REGS regs;
regs.h.ah = 5;
regs.h.bh = 6;
int86(0x10,Žs,Žs);
return(0);
}
/****************************************************************************/
--------------------------------------------------------------------------------
|
|
|