CROWD: setting up graphics

[From Bill Powers (990826.1206 MDT)]

This is for everyone in the Crowdv3 project who has or intends to get Turbo
Pascal 7.0 or any other Pascal program that turns out to be compatible. I
will not be programming in object-oriented code, so all versions of TP back
to about 3.0 ought to work with code that I write. If Bruce Abbott
introduces OOP code, however, you'll need at least version 5.0 -- 7.0 would
be preferable.

I have found a freeware source for a SVGA BGI driver. This will allow
setting screen resolutions to anywhere from 320 x 200 to 1280 x 1024 just
by changing one number in the source code -- if your graphics card will
allow.

The driver itself, SVGA.BGI, is attached; it should be placed in the BGI
directory (on my machine, the directory is \tp\bgi ). This is all you will
need. For those who read German, however, the Web page where I got it is at

http://www.von-bassewitz.de/uz/bgi.html

It's quite possible that I have not done this in the neatest way, my German
being at about the dictionary-in-hand level. Perhaps Wolfgang could write
us a better version of the initializing unit (mine needs the SVGA.BGI file
to run, but it's possible to "register" the driver so the programs will be
stand-alone).

Anyway, here is the Unit that initializes the graphics to Super-VGA modes:

svga.bgi (57 Bytes)

Turbo.tpl (58 Bytes)

···

========================================================================
unit setsvga;
interface
uses graph;

procedure InitSVGA(mode: integer);
{ mode in argument of initSVGA:
     3 = 640 x 480
     4 = 800 x 600
     5 = 1024 x 768
     6 = 1280 x 1024
    40 = 640 x 480 VESA
    41 = 800 x 600 VESA
    42 = 1024 x 768 VESA
    43 = 1280 x 1024 VESA
}

var GraphMode,GraphDriver: integer; {THESE ARE GLOBAL FOR CALLING PROGRAM}
    hsize,vsize,maxcolor: integer;
{ -------------------------------------------------------------------------}
implementation

procedure InitSVGA(mode: integer);
var ch: char;
    i: integer;
begin
graphdriver := InstallUserDriver('SVGA',nil);
if GraphDriver < 0 then halt;
GraphMode := mode;
InitGraph(GraphDriver,GraphMode,'\tp\bgi');
hsize := getmaxx + 1; vsize := getmaxy + 1;
maxcolor := getmaxcolor;
end;

begin
end.

Note that in the "InitGraph" statement, the last argument is, in single
quotes, the path to the location of the file SVGA.BGI. The name of this
Unit is "setsvga" and the file name you store it under must be
"setsvga.pas". You will need to compile this file; doing that will create a
file "setsvga.tpu" in your "units" directory (set up when you establish the
"directory" options for Turbo Pascal). Note, too, that I have set this
initialization up to just halt if there's any problem. If you need to know
more you can write a more extensive error-handling routine.

Now here is a program to test this driver on your machine. It assumes you
have compiled the Unit above, so that setSVGA.TPU is in your "Units"
subdirectory:

program testSVGA;

uses dos,crt,graph,setSVGA;

var ch : char;

begin
  initSVGA(4); {set this argument to the mode you want to test}
setcolor(white);
rectangle(0,0,hsize-1,vsize-1);
ch := readkey;
closegraph;
writeln(hsize:4,' horizontal by ',vsize,' vertical');
ch := readkey;
end.

The "readkey" statements allow a pause so you can see what you have.

I plan to use mode 4 (800 x 600), so if this works you will be able to run
my programs. You can test the other modes by changing the argument in
setSVGA(). If 3 - 6 don't work you might have some luck with the VESA
arguments, 40 - 43.

One more detail. On today's fast machines, Turbo comes up with an error
because initializing the "Delay" function doesn't work. I am attaching (I
hope legally) a patched version of Turbo.tpl, the library, which will cure
this problem. Substitute it for the turbo.tpl you already have (it's in the
BIN subdirectory). The attachment is also called turbo.tpl. To play it safe
you can rename the old turbo.tpl to old.tpl, then copy the attached version
to the BIN subdirectory. The new version MUST be named turbo.tpl.

If you don't have Turbo Pascal 7.0 yet, save all this stuff somewhere until
you do get it.

I'd like to hear back from potential collaborators so I will know who has
TP 7.0 and has succeeded in running these test programs.

Best,

Bill P.

[From Bruce Gregory (990826.1736 EDT)]

Bill Powers (990826.1206 MDT)

For those who may be Turbo Pascal "challenged", you can download a free
copy of v5.5 from the following URL:

http://community.borland.com/museum/

You may have to register, but that is fairly painless.

Bruce Gregory

[From Bill Powers (990827.1936 MDT)]

Bruce Gregory (990826.1736 EDT)]

For those who may be Turbo Pascal "challenged", you can download a free
copy of v5.5 from the following URL:

http://community.borland.com/museum/

Thanks for that, Bruce. If there are any version difficulties between 7.0
and 5.5, I'm sure we can work around them.

Best,

Bill P.

[(Norman Hovda (990828.1147 MST)]

At 19:37 Bill wrote about Re: CROWD: setting up graphics on 27 Aug 99,

Bruce Gregory (990826.1736 EDT)]

>For those who may be Turbo Pascal "challenged", you can download a free
>copy of v5.5 from the following URL:
>
>http://community.borland.com/museum/

Will v5.5 run in Win9x?

nth

[From Bruce Gregory (990828.1503 EDT)]

Norman Hovda (990828.1147 MST)

Will v5.5 run in Win9x?

It runs in the DOS window.

Bruce Gregory