How to Use Visual Screen Display (VSD) In Turbo C/C++ Software Using C Language

Introduction

This article explains how to use the Visual Screen Display (VSD) in Turbo C/C++ software using the C language.

Our Monitor Screen is divided into 80 columns and 25 rows and that means that 80 characters can be arranged in a single row.

The starting address defines 1 row and 1 column in memory. We can use the Turbo C/C++ software that provides the facility to use it for creating a graphical compatible application, but it's only one display page and all the work is done on a single page.

create graphical compatible application

Declaration

    char far *<Variable Name> = (char far *) 0xb8000000;

The variable name contains the first address of the VSD.

Address Row Column
b800:0000 print character 0,0
b800:0001 print color 0,0
b800:0002 print character 0,1
b800:0003 print color 0,1

 

  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. #include<dos.h>  
  4. void main()  
  5. {  
  6.    char far *VSD =(char far *) 0xb8000000; //declaration of Visual Screen Display  
  7.    int rows=1 ;  
  8.    clrscr();  
  9.    for(int i=0 ;i<256 ;i+=2) //Every time loop must be increase 2 value  
  10.    {  
  11.       *(VSD+i)='O'//O is a character for print on color.  
  12.       *(VSD+i+1)=i;  
  13.       delay(100);  
  14.    }  
  15.    getch();  
  16. }  
character in single row

See the preceding code seriously, here two lines are important.

    1. *( VSD + i ) = ’O’;

    And

    2. *(VSD + i ) = i;

In the first line, “i=0” means that it's an EVEN value. So when we increase the value of the “i” variable by 2 every time, then *( VSD + i) =’O’;

Print the character on the screen.

And at that time the odd value of the “i” variable defines the print foreground color and the background color depending on address, but always remember that background color starts from “BLACK COLOR”.

Our screen has 80*25 =2000 characters that can print on a display.

So when we want to start, then start it by printing a character to 2 rows then we want to add 2*80=160.

Where:

2 defines 1 bit for the character and 1 bit for the color 1+1=2.

80 defines the total characters in a single row.

VSD =VSD +160;

bit

  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. #include<dos.h>  
  4. void main()  
  5. {  
  6.    char far *VSD =(char far *) 0xb8000000;  //declaration of Visual Screen Display  
  7.    int rows=1,i ;  
  8.    VSD = VSD +160; //Addition of 160 for reaching 2nd row  
  9.    clrscr();  
  10.    for(int i=0 ;i<256 ;i+=2) //Every time loop must be increase 2 value  
  11.    {  
  12.       *(VSD+i)='O'//O is a character for print on color.  
  13.       *(VSD+i+1)=i;  
  14.       delay(100);  
  15.    }  
  16.    getch();  
  17. }  
But remember, when your VSD variable reaches row 2 you want to go again on row 1. So you will subtract 160 from the VSD variable.

VSD = VSD – 160;

So if we want to reach anywhere in the screen, then the addition and subtraction is used with the VSD variable.

The Turbo C/C++ software is developed using this concept.

When you create an .exe file, after running the code that .exe file can run with GUI compatibility, but on the other hand when you use the Graphics header and BGI files for creating any type of GUI .exe file that are not compatible.

You can create anything with the VSD concept easily. It's main feature is compatibility with all Windows OS.

My Project on VSD

I am giving you two files, one is the .c file and other one is the .h file. Copy those files into the directory “C:\TC\Bin”.

After copying of files, run tc.exe and open the window.c file to execute it.

execute

You will see the same type of editor such as the Turbo software.

It supports only the shortcut keys such as “Alt + Red color character in menu” after opening any menu press any arrow key and for closing the menu press the “Esc button”.

turbo software

Arrow keys mean “Alt + Red Character”.

It also includes “Alt+F press enter” and you will see the Green color editor.

You can close this editor using “Alt+F3” and to quit press “Alt + x”. But it has many errors and I have shown you how to work on VSD.

work VSD

Thank you.

Up Next
    Ebook Download
    View all
    Learn
    View all