Dec 232017
 
Aids in the debugging of planar modes, aka "Mode X", within Borland IDE's such as BC++, BP, TP, TPROF, TD and others. Also Palette restoring (works in Mode 13h) & page viewing.

Full Description of File



UNCHAIN Planar VGA Mode 13h Enforcer
v3.1 December 1, 1993 *FREEWare*
Aids in the debugging of planar modes, aka
"Mode X" within Borland IDE's such as BC++,
BP, TP, TPROF, TD and others. Also Palette
restoring (works in Mode 13h) & page viewing.



File UCHAIN31.ZIP from The Programmer’s Corner in
Category Miscellaneous Language Source Code
Aids in the debugging of planar modes, aka “Mode X”, within Borland IDE’s such as BC++, BP, TP, TPROF, TD and others. Also Palette restoring (works in Mode 13h) & page viewing.
File Name File Size Zip Size Zip Type
FILE_ID.DIZ 368 221 deflated
UNCHAIN.DOC 12608 4341 deflated
UNCHAIN.EXE 1540 1476 deflated
UNCHAINR.EXE 1614 1560 deflated

Download File UCHAIN31.ZIP Here

Contents of the UNCHAIN.DOC file




UNCHAIN Planar VGA Mode 13h Enforcer
v3.1 December 1, 1993

Copyright 1993 Colin Buckley. All Rights Reserved.

Colin Buckley
151 Roxanne Cresent
Scarborough, ON
Canada M1V 4G7

Use or distribute freely in any environment. In other words, it's Freeware




Introduction


Borland development tools will only remember which video mode you are
in, it doesn't save any possible video card register changes you might have
made.

There is a great deal of hype over "Mode X", but if you don't own
a secondary video card (monochrome), it's impossible to debug in a Borland
IDE.

UNCHAIN will allow you to do just that. It is all completely transparent
to the user, only the viewing of video pages is interactive as it should be.
UNCHAIN can also restore your palette. Palette restoring works indepentently
of the VGA register savings, so you can use UNCHAIN to restore the palette in
regular Mode 13h aswell.


Usage


There are two versions of UNCHAIN, one spawns your program and the
other is a TSR which remains in memory. There are advantages and disadvantabes
to both.

UNCHAIN requires 3K and requires you to specify the full path to
the file you wish to enforce planar modes. However, it is only active
while your program is active and will not cause problems to other programs
entering Mode 13h. The full file names didn't bother me, but others hated it.

UNCHAINR requires about 1.5K and can be loaded and unload like other
TSRs, if no TSRs were loaded after it. It can be loaded into high memory by
DOS's LOADHIGH or third-party memory managers. UNCHAINR will even be able to
remove itself from high memory if it was the last loaded TSR. You do not
have to type long file names, but UNCHAINR can cause problems for other
programs. A commandline switch is provided to reset UNCHAINR if that
happens, but it's possible to forget about UNCHAINR being resident.


UNCHAIN Usage


UNCHAIN requires <3K of memory.

If you use...

>TD YourGame.EXE

then use...

>UNCHAIN TD.EXE YourGame.EXE

Note the addition of the extension for TD. If TD.EXE is not in the
current directory, you will have to use the entire filename, such as...

>UNCHAIN C:\TD\TD.EXE YourGame.EXE

UNCHAIN will spawn TD and Turbo Debugger will load your game and operate
as usual.


UNCHAIN Resident Usage


UNCHAINR requires <2K of memory.

Type...

>UNCHAINR

to installed UNCHAIN in memory. "/I" installs, but it's not necessary.

Type...

>UNCHAINR /U

to uninstall UNCHAIN from memory.

Type...

>UNCHAIN /R

to reset the enforcing flag. If you experience a program that looks
visually corrupt (only 1/4 of the screen looks visable and it has large
pixels with big gaps between lines), run with this switch. If the problem
does not go away, then UNCHAIN is not at fault.

Any other switch will give you a help screen.


UNCHAIN Video BIOS Extentions


Any following reference to UNCHAIN applies to both versions.

You must add some assembler instructions in order for this program to
work transparently. If the instructions are not present, the program
will act like it was not loaded.

If you are unfamiliar with assembler, in Turbo/Borland Pascal use..

ASM
Assembler Instructions
End;

In Turbo/Borland C/C++ use...

asm{
Assembler Instructions
}


After you have entered Mode 13h and modified the VGA registers, use the
following code...

MOV AX,0CB00h
INT 10h

The above code is the only really necessary instructions. If you
are using the TSR, then you should add the reset code below, otherwise you do
not have to add any of the following instructions unless you want these
features aswell.


To reset the VGA registers saved by the above command, use the following
code...

MOV AX,0CB06h
INT 10h

The purpose of this command is to allow you to use Mode 13h and unchained
modes together. Place the above code before you enter Mode 13h, so
UNCHAIN doesn't restore the VGA registers. If you use multiple resolutions
in your program, then it would be wise to use the above code before you
enter each one, but not necessary. It is also advised you use this command
before exitting to DOS and in your error/exit handlers so you do not cause
problems with the TSR version, UNCHAINR.


Every time you set the palette use the following code..


MOV AX,0CB05h
INT 10h

If you do Screen Fades then they will run at half speed because UNCHAIN
gets the palette everytime, assuming you add the above code to your SetPalette
routine and it is called by your screen fade. They will work at full speed
when UNCHAIN is not loaded.

I only use one palette per game, so I actually use the above code
as part of the game after I set the palette. It's not part of the SetPalette
code, so I can avoid the fade slow down problem.

Palette restoring works indepentently of the VGA register savings, so
you can use UNCHAIN to restore the palette in regular Mode 13h aswell.


In order to view Video Pages, you must tell UNCHAIN the offsets of upto 4
pages, then while looking at the USER SCREEN (ALT-F5), you may press CTRL-1
for Page 1, CTRL-2 for Page 2, CTRL-3 for Page 3, CTRL-4 for Page 4.

To tell UNCHAIN what offset Page 1 is at use the following code..

MOV BX,Page1Offset
MOV AX,0CB01h
INT 10h


To tell UNCHAIN what offset Page 2 is at use the following code..

MOV BX,Page2Offset
MOV AX,0CB02h
INT 10h

To tell UNCHAIN what offset Page 3 is at use the following code..

MOV BX,Page3Offset
MOV AX,0CB03h
INT 10h

To tell UNCHAIN what offset Page 4 is at use the following code..

MOV BX,Page4Offset
MOV AX,0CB04h
INT 10h

The following default offsets are set until you change them.

Page 1 defaults to offset 0000 (Page 1 in 320x200)
Page 2 defaults to offset 16000 (Page 2 in 320x200)
Page 3 defaults to offset 32000 (Page 3 in 320x200)
Page 4 defaults to offset 48000 (Page 4 in 320x200)

******************************************************************
NOTE: DO NOT PRESS CTRL-x UNLESS YOU ARE VIEWING THE USER SCREEN

It's not hazardous, atleast not to my SVGA card but... View which
ever page points to OFFSET 0000 to restore your screen correctly.
******************************************************************

If you use a library, it would be best to add the code directly to
the library routines so it's always set up correctly. If UNCHAIN is not
loaded the added instructions should do absolutely nothing.


Applications that Work


I have only tested UNCHAIN with the following programs, and it works
perfectly. There is no screen corruption at all.

Turbo Debugger v3.2: Graphics Save = On
Display Method = Swap Pages

Turbo Profiler v2.2: Graphics Save = On
Display Method = Swap Pages

Turbo Pascal v6: Graphics Save = On

Borland Pascal v7: Graphics Save = On


UNCHAIN does work with Turbo and Borland C/C++, I was just never told
what version(s) and options allowed it to work.

For TD and TPROF it would be wise to save your setup as the default config
file, rather then updating an EXE, so that all the TD and TPROF incarnations
will be setup correctly.

Please report all applications that work with UNCHAIN to me so I can
update this list. Please include the options necessary for it to work.
My address is at the end of this file.


Problems


Problem:

UNCHAIN is running but there are 4-16 smaller screens instead of the regular
full screen.

Solution:

UNCHAIN can not remove Chain 4 from Mode 13h, because you haven't added the
assembler instructions to your code that UNCHAIN needs to operate transparently.


Problem:

UNCHAIN is running, I see the regular full screen, but portions of the
screen become corrupt.

Solution:

Change the display method the application UNCHAIN is spawning to use Swap
Pages (which saves and restores the text screen to conventional memory, rather
then VGA display memory) and set Graphics Save to On. The Borland applications
I run have display methods as a configuration option, with the exception
of Borland Pascal, but it's method is still UNCHAIN friendly.

If you're not using a Borland application, play around with the display
methods, if that is not an option, or you still can't correct the screen,
you'll have to live with it.


Problem:

UNCHAINR reports "UNCHAIN can not be removed from memory!"

Solution:

You must unload any TSRs loaded after UNCHAIN before you can uninstall
UNCHAIN. The reason is some program has hooked on to one of the interrupts
UNCHAIN uses (Keyboard and Video BIOS), and can not remove itself without
leaving the system in an unstable state.


Problem:

UNCHAIN reports "Error: Can not execute file!"

Solution:

COMMAND.COM is not executing the file, rather UNCHAIN is spawning it.
Therefore you must specify the extension of the file you wish to execute,
along with the entire path to the file, if it is not in the current directory.

For example...

If you use...

>TD YourGame.EXE

...and TD.EXE is in your path as being in C:\TD, you will have to use...

>UNCHAIN C:\TD\TD.EXE YourGame.EXE

...unless it is in the current directory, in which case...

>UNCHAIN TD.EXE YourGame.EXE

...is fine.

If you are already doing this then the file doesn't exist or there is some
other problem preventing it from running like insufficent free memory.


History


UNCHAIN v1.O -*- January 1, 1993

o Forced 320x200x256x4 only.

UNCHAIN v2.O -*- June 1, 1993

o Support for all the various resolutions possible in Planar Mode 13h
o Palette saving and restoring
o Viewing of upto 4 video pages

UNCHAIN v2.1 -*- June 1, 1993

o Help Screen updated
o Minor bugs fixed
o Memory resizing at runtime.
o RESET function added
o Palette saving and restoring now affecting colour 255.
o Palette saving and restoring now independent of Planar modes and works
in regular Mode 13h
o Video page viewing corrected
o Keyboard ISR optimized, now works under TD386.
o Documentation rewrote and heavily updated

UNCHAIN v3.O -*- November 1, 1993

o TSR version added. Uses 1/2 as much memory, and can be loaded high.

UNCHAIN v3.1 -*- December 1, 1993

o Page Viewing was always active even if you weren't currently debugging,
so you always lost CTRL-1 to CTRL-4. UNCHAIN now watches the Save Planar
state flag and only allows Page Viewing while debugging, allowing other
programs to use CTRL-1 to CTRL-4 while UNCHAIN is in memory.


Credits


The Planar Mode set routines were influenced by Themie's XLIB,
who based his on Michael Abrash's, who got his from public domain code courtesy
of John Bridges.

The Video Page display routine was taken from John Slagel's XBLT as it
used Display Enable.

Everything else was pieced together from various code I had written in
the past.

The TSR code is all new and took about 2 hours to complete and debug.

If you want to include and distribute this with your own library, code, or
whatever go right ahead.

Colin Buckley
Toronto, Ontario, Canada.

[email protected]




 December 23, 2017  Add comments

Leave a Reply