home *** CD-ROM | disk | FTP | other *** search
-
- FINDING FORGOTTEN TREASURE WITH TURBO PASCAL
- By D. L. Raney
-
- If you have read the IBM Reference manual or the many other fine
- technical books for the IBM-PC and its many compatibles, you have more
- then likely read about its ablity to use video paging. Video paging is a
- means of using the entire 16k of video memory available on a color video
- card. ( There is no video paging available on the monochrome card, due to
- its limited memory. )
- In the standard 80 column by 25 row video configuration, you are using
- only 4k of the available memory. That leaves 12k of memory to just set
- there idly, but what can we do with this idle memory? For starters, why
- use a tiny window for a help screen when you could have an entire screen
- to display at the blink of an eye (saving stack memory for better things)
- without ever touching your main work screen, or you could draw several
- input screens to use by simply setting a register. You may not have an
- immediate use for this feature, or you have tried to use it and found that
- none of the programming software directly supports this feature. It has been
- my experience with Turbo Pascal that there is no support, and to top that
- off MS-Dos does not even support this feature! In using a program to select
- the active video page, and using MS-Dos function call #2 & #9 ( output
- character & string ), MS-Dos outputs the character(s) to video page #0
- ( 80x25 color or mono pages 0-3, 40x25 color or mono pages 0-7 ), Never
- checking the active video page ( location 0462h contains the byte that
- holds the current display page, 044Ah contains the screen width, 044Eh
- contains screen offset location ) always writing to screen zero.
- We could manipulate these memory locations, but we would be asking for
- trouble down the line, as these memory locations could change in future
- versions. We could also just store the information directly to the screen
- memory, but the screen memory location could also change, which could
- possibly create havoc with the machine.
- There is a better way, a more compatible way, using the video bios rom.
- Using this method will insure are program is compatible with future
- versions of IBM computers, after all the rom may change, but the functions
- remain the same. Now investigating the video bios function ( Intrrupt 10h )
- we find all the primative functions we will need. What we need now is an
- easy method of using these functions, using them as is would be tedious at
- best. The ideal solution would be to have the same functions and procedures
- that are incorporated into Turbo Pascal's video support. So we could design
- our own functions and procedures to handle these for us, much the same as
- the standard ones, with some added parameters of course.
- The following is a list of the standard routines we will need and their
- translation to the routines we will need.
-
- Write(Text: String); ------------> WritePg(Page: Byte; Text: String);
- WriteLn(Text: String); ----------> WriteLnPg(Page: Byte; Text: String);
- ClrEol; -------------------------> ClrEolPg(Page: Byte);
- ClrScr; -------------------------> ClrScrPg(Page: Byte);
- DelLine; ------------------------> DelLinePg(Page: Byte);
- GotoXy(X,Y: Byte);---------------> GotoXyPg(X,Y,Page: Byte);
- InsLine; ------------------------> InsLinePg(Page: Byte);
- WhereX: Integer; ----------------> WhereXPg(Page: Byte): Byte;
- WhereY: Integer; ----------------> WhereYPg(Page: Byte): Byte;
- TextColor(Color: Integer); ------> TextColorPg(Page,Color: Byte);
- TextBackground(Color: Integer); -> TextBackgroundPg(Page,Color: Byte);
- Read(Text: String); -------------> ReadString(Page,Len,Type: Byte);
- N/A -----------------------------> SetVideoPage(Page: Byte);
- N/A -----------------------------> VideoMod; byte (A Function)
- N/A -----------------------------> SetVedeoMod(Mode: byte);
-
- As you will note, the extended functions and procedures all have "Pg"
- appended to them. This is done to distinguish them from the standard ones.
- This will also aid in remembering the syntax of them. You do not need to
- understand how each of these procedures and functions work, only how to
- use them. If you are interested in how they work, read the section on
- the video bios routines in your IBM technical reference manual, or any good
- book on the IBM such as "The Peter Norton Programmers Guide to the IBM PC",
- then study the procedures and functions I have written.
-
-
- EXTENDED VIDEO SCREEN PAGING SYNTAX'S AND DISCRIPTIONS
- ------------------------------------------------------
-
- TEXTCOLORPG
-
- Syntax: TextColorPg(Page,Color);
-
- PAGE is the video screen page on which you wish to set the text color.
- COLOR is the color of text you wish to use. Each Video screen page has
- its own color table, and may be set to their own separate colors.
- COLOR must be in the range of 0 to 15.
-
- TEXTBACKGROUNDPG
-
- Syntax: TextBackgroundPg(Page,Color);
-
- PAGE is the video screen page on which you wish to set the background
- color. COLOR is the color of the background you wish to select. COLOR
- must be in the range of 0 to 7. PAGE if in 80 column mode must be in
- the range of 0 to 3, if in 40 column mode it must be in the range of
- 0 to 7.
-
- WHEREXPG
-
- Syntax: WhereXPg(Page);
-
- This function returns the cursor X position (Row) on the selected video
- screen page. PAGE must be in the correct range, 0 to 3 for 80 column,
- 0 to 7 for 40 column modes.
-
- WHEREYPG
-
- Syntax: WhereYPg(Page);
-
- This function returns the cursor Y position (Column) of the selected
- video screen page. PAGE must be in the range of, 0 to 3 for 80 column,
- 0 to 7 for 40 column mode.
-
- INSLINEPG
-
- Syntax: InsLinePg(Page);
-
- This procedure will insert a blank line at the current cursor line
- position. The attribute will be the current video screen page color
- settings.
-
- DELLINEPG
-
- Syntax: DelLinePg(Page);
-
- This procedure will delete a line on the selected screen page at which
- the cursor is located. A new line will be scrolled onto the bottom of
- the screen. The attribute will be the current video screen page color
- settings.
-
- GOTOXYPG
-
- Syntax: GotoXyPg(X,Y,Page);
-
- This procedure will locate the cursor, on the selected screen page, to
- the desired X,Y position. X and Y must be in proper range, 1 to 25 for
- Y, 1 to (80 or 40) depending on screen width.
-
- CLRSCRPG
-
- Syntax: ClrScrPg(Page);
-
- This will clear the selected video screen page, and set the attribute
- to the current settings for that page, and home the cursor to the upper
- left hand corner.
-
- CLREOLPG
-
- Syntax: ClrEolPg(Page);
-
- This clears from the current cursor location to the end of the line.
- The attribute will be the same as the current color settings.
-
- SETVIDEOPAGE
-
- Syntax: SetVideoPage(Page);
-
- This will set the active displayed video screen page. PAGE must be in
- the correct range for current mode or procedure will return with no
- change to the current active page.
-
- WRITEPG
-
- Syntax: WritePg(Page,String);
-
- PAGE contains the video screen page you wish to write the string of
- characters to. STRING must be of the type string. If you wish to write
- a value to the screen using this procedure it must be converted to a
- string. The same is true for variables of the type char. This procedure
- will write the string starting at the current cursor location, and the
- cursor location will remain at the space following the last character
- printed.
-
- WRITELNPG
-
- Syntax: WriteLnPg(Page,String);
-
- Page equals the video screen page to write to. Sorry, no numeric or
- character types, these must be converted to a string type. This
- procedure will write the string to the current cursor location, and will
- perform a carriage return and line feed following the last character.
-
- READSTRING
-
- Syntax: AString:=ReadString(Page,Length,NumOrStr);
-
- This is an example of how to perform a read from any video screen page.
- Since the standard READ and READLN routines only echo characters input
- to video screen page #0, we need to do our own character echoing, using
- our new routines. Although some what awkward, it does work. You may
- write a better one, or use this one as is, or modify it to suit your own
- needs. READSTRING is declared as a function and will only return a string
- of characters. Any numeric input must be converted using the standard
- routine VAL of Turbo Pascal.
- ASTRING is of the type AnyString which must be defined in the program
- block as AnyString = String[255]. PAGE is of the selected video screen
- page. LENGTH is of a value of 1 to 255, please note though that lengths
- of much more than 20 or 30 characters the input can be quite slow, and
- the length should be contained to one line. NUMORSTR is the type of input
- requested. A value of 0 will accept input of any ASCII character of the
- range Chr(32) to Chr(126). A value of 1 will accept inputs of the type
- "0"-"9","+","-", and ".".
-
-
- COLOR CARD VIDEO SCREEN PAGE'S MEMORY MAP
- -----------------------------------------
-
-
- OFFSET ADDRESS COLOR VIDEO MEMORY MAP
-
- B800 ->:--------------------------------------:
- : PAGE 0 (40 COLUMN MODE) :
- : 2k :
- B880 ->: - - - - - - - - - - - - - - - - - - -:
- : PAGE 1 (40 COLUMN) :
- : PAGE 0 (80 COLUMN MODE) :
- B900 ->:--------------------------------------:
- : PAGE 2 (40 COLUMN) :
- : PAGE 1 (80 COLUMN) :
- B980 ->:- - - - - - - - - - - - - - - - - - - :
- : PAGE 3 (40 COLUMN) :
- : :
- BA00 ->:--------------------------------------:
- : PAGE 4 (40 COLUMN) :
- : PAGE 2 (80 COLUMN) :
- BA80 ->: - - - - - - - - - - - - - - - - - - -:
- : PAGE 5 (40 COLUMN) :
- : :
- BB00 ->:--------------------------------------:
- : PAGE 6 (40 COLUMN) :
- : PAGE 3 (80 COLUMN) :
- BB80 ->:- - - - - - - - - - - - - - - - - - - :
- : PAGE 7 (40 COLUMN) :
- : :
- :--------------------------------------:
-
-
- In conclusion I must state that all of the routines listed could be
- further enhanced, but for most purposes they should fit the bill. There are
- many other features of the IBM-PC that I feel are not being used to their
- full advantage, and I invite anyone to explore their machines to find those
- little known and used features, and let others share in your discoveries.
-
- Comments and questions should be directed to:
- Dennis L. Raney
- 2612 Castle Dr.
- Blue Springs, Mo. 64015
- (or)
- Genie mail address D.L.RANEY
-