                      TPLDEV Device Driver for Tandy
                             Jeffrey L. Hayes
                              August 20, 2005


Description
-----------

TPLDEV.BIN is a device driver (and associated command-line program) that 
provides access to the planar control register, port 65h, in the Tandy 
1000SL's, TL's, RL's, and RLX's, allowing users of those machines to 
selectively disable and enable the following onboard peripherals:

    hard drive controller
    parallel port
    video controller (TGA)
    floppy controller
    serial port

This program will not work on the original 1000, 1000A, SX, TX, EX, or HX, 
nor will it work on the RSX.  I don't know whether it would work on any 
Tandy laptops - maybe some.

On the SL's, TL's, RL's, and RLX's, not every bit is controllable on every 
system.  The onboard VGA on the RLX cannot be disabled, for example.  On 
the RL, the floppy controller can be disabled from AUTOEXEC.BAT, but 
attempting to do so from CONFIG.SYS hangs the system, and once the floppy 
controller has been disabled, it can't be reenabled.  In other words, take 
care, your milage may vary.

Some of these bits can be controlled using the system setup program, but 
some can't.  Again, it depends on the system.  In some cases, you can 
disable a bit in setup, but the BIOS ignores the setting.  TPLDEV gives 
finer control even if the BIOS does allow onboard devices to be disabled, 
however.


Usage of the Device Driver
--------------------------

TPLDEV.BIN must be loaded as a device driver in CONFIG.SYS, with or without 
options:

    DEVICE=TPLDEV.BIN
    DEVICE=TPLDEV.BIN -f

The following options are supported in the DEVICE= line:

    +H or +h     Enable hard disk controller
    -H or -h     Disable hard disk controller
    +P or +p     Enable parallel port
    -P or -p     Disable parallel port
    +V or +v     Enable video controller
    -V or -v     Disable video controller
    +F or +f     Enable floppy controller
    -F or -f     Disable floppy controller
    +S or +s     Enable serial port
    -S or -s     Disable serial port

Options can be specified in any order.  If conflicting options are 
specified, the last one governs.  Invalid characters on the DEVICE= line 
are ignored.

TPLDEV.BIN may appear more than once in the CONFIG.SYS file.  On the first 
invocation, the device driver is installed and an initial value is written 
to the planar control register.  The driver stores the value internally.  
If no options are specified on the DEVICE= line this first time, TPLDEV 
will enable all the bits listed above.  On the second and subsequent 
invocations, TPLDEV.BIN does not load but just processes options.  For 
example:

    DEVICE=TPLDEV.BIN      <- enables all bits, i.e., +h+p+v+f+s
    DEVICE=FOOBAR.SYS
    DEVICE=TPLDEV.BIN -s   <- serial port off, remaining bits still on
    FILES=20
    DEVICE=TPLDEV.BIN +S-P <- serial port back on, parallel port off,
                              remaining bits still on

and so forth.  On the second and subsequent invocations, DEVICE=TPLDEV.BIN 
just displays the current register setting if no options are given.

When loaded the first time, TPLDEV.BIN displays the register contents:

    Planar control register control for the Tandy 1000 series
    Device driver installed, register set to 11111111B

When invoked a second time to change bits, TPLDEV.BIN displays the new 
contents:

    Planar control register control for the Tandy 1000 series
    Driver already resident, register set to 11101111B


Usage of the Command-line Program
---------------------------------

Once TPLDEV.BIN has been loaded in CONFIG.SYS (with or without options), 
TPLCMD.COM can be used in AUTOEXEC.BAT or from the command line to control 
devices.  TPLCMD.COM can be invoked without options, with the same options 
as the device driver above, or with a binary string to set all bits at 
once, as follows:

    TPLCMD
    TPLCMD -h+p
    TPLCMD W01111101B

Without options, TPLCMD just displays the current planar control register 
value stored in the device driver:

    C:\>TPLCMD
    Planar control register control for the Tandy 1000 series -
    No change made, register value is 11111101B.

With +/- options (see above), TPLCMD enables or disables individual 
peripherals and displays the new register value:

    C:\>TPLCMD -h
    Planar control register control for the Tandy 1000 series -
    Register set to 11111110B.

To set or clear all bits at once, specify a string of the format 
WxxxxxxxxB, where xxxxxxxx are 8 binary digits, for example:

    C:\>TPLCMD w11111101b
    Planar control register control for the Tandy 1000 series -
    Register set to 11111101B.

In all three cases, TPLCMD will return errorlevel 0.  If incorrect syntax 
is used, TPLCMD displays the following:

    C:\>TPLCMD /?
    Planar control register control for the Tandy 1000 series -
    Syntax:
      TPLCMD (options)

    where (options) are:
      -h or +h  Disable/enable hard drive controller
      -p or +p  Disable/enable parallel port
      -v or +v  Disable/enable video controller
      -f or +f  Disable/enable floppy controller
      -s or +s  Disable/enable serial port

and returns errorlevel 1.  In many cases, bad syntax is just ignored, 
however.  If TPLDEV.BIN was not loaded in CONFIG.SYS, TPLCMD displays an 
error message:

    C:\>TPLCMD -f
    Planar control register control for the Tandy 1000 series -
    TPLDEV.BIN not loaded, no change made.

Errorlevel 2 is returned.  In case of an error writing to or reading from 
the device, errorlevels 3 or 4 (respectively) are returned, and the 
following messages are displayed:

    Planar control register control for the Tandy 1000 series -
    Error writing to device TPLDEV.BIN.

    Planar control register control for the Tandy 1000 series -
    Error reading from device TPLDEV.BIN.

Those errors are unlikely, however, and would probably indicate memory 
corruption.


Advanced Usage
--------------

TPLDEV.BIN is controlled programmatically by writing to, and reading from, 
character device TPLANAR$.  It is best to place the device in raw mode 
before reading from it.  There is also a backdoor interface through the 
multiplex interrupt, 2Fh.  See TPLDEV.ASM and TPLCMD.ASM for details.
