Documentation for DCC-MB.COM v 1.0


Installing the Driver

Type DCC-MB at the DOS prompt to install on LPT1, or
Type DCC-MB /2 to install on LPT2.
The driver will display an installation message and then return you to the DOS prompt.
Notes:
Installing the driver will make the parallel port unavailable to most programs that try to use it.
There is no "uninstall" feature at this time.

Calling the driver from high level languages

Any language that supports calls to software interrupts can be used. All calls to the driver are made through interrupt 70h, with the registers set up as in the following table. Examples of QuickBasic and c programs can be found on the SOFTWARE page.

List of Driver Functions accessed through interrupt 70h

-----------------------------------------------------------------------------
                        DCC CONTROLLER FUNCTIONS
-----------------------------------------------------------------------------
SET DCC CONTROLLER MODE:  ah = 0
  Sets the mode of the DCC controller system.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Arguments:
    al = Controller Mode:
      [0] OFF. Turns off track power. Disables LPT hardware interrupts.
      [1] OPERATE. Turns on track power. Driver repeatedly sends speed/
          direction packets to all active locos. Other operational packets 
          may also be inserted into the data stream.
      [2] PROGRAM. Turns on current-limited track power, only on program 
          track. The DCC Idle Packet is sent repeatedly, except when the 
          programming functions are called.
  Return Value:
    ax = Return Value:
      [0] Ok
     [-1] Error: Mode Number out of range
-----------------------------------------------------------------------------
QUERY DCC CONTROLLER:  ah = 0
  Queries the controller mode, and other things.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Arguments:
    al = 255
  Return Values:
    ax = FACEh (64206d), to check for driver's existence
    bx = current driver mode (as set above)
    cx = current number of active locos
-----------------------------------------------------------------------------
DCC RESET:  ah = 1
  Sends 20 DCC Reset packets, while setting speed to 0 for all active locos.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OPERATE, PROGRAM 
  Arguments: 
    none
  Return Value:
    ax = Return Value:
      [0] Ok
-----------------------------------------------------------------------------
                     SPEED/DIRECTION PACKET FUNCTIONS
       Speed/Direction packets are sent repeatedly to all active 
       locomotive decoders while the driver is in OPERATE mode.
-----------------------------------------------------------------------------
ACTIVATE LOCOMOTIVE:  ah = 10
  Activates any multifunction locomotive decoder. Initial speed is set to 0, 
  direction to forward. When the driver is in OPERATE mode, Speed/Direction 
  packets are sent repeatedly to all active decoders (whether or not their 
  speed or direction changes.)
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = Speed Control Mode:
      [1] 14 Step Mode (Standard)
      [2] 28 Step Mode
      [3] 128 Step Mode (Direct Speed Programming)
      Note: The decoder must be pre-programmed to operate in the specified
      speed control mode. All decoders support 14 Step mode, but not all 
      decoders support the higher modes.
    bl = Locomotive Decoder's DCC Address: 
      [1 to 127]
  Return Value:
    ax = Return Value:
      [0] Ok
      [-1] Error: Loco Already Active. (If you wish to change the Speed 
           Control Mode of an active loco, you must deactivate it first.)
      [-2] Error: Speed control mode out of range
      [-3] Error: DCC Address out of range
-----------------------------------------------------------------------------
DEACTIVATE LOCOMOTIVE: ah = 11
  Deactivates a currently active locomotive decoder. Speed is set to zero,
  then no more Speed/Direction packets are sent.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    bl = Locomotive Decoder's DCC Address: 
      [1 to 127]
  Return Value:
    ax = Return Value:
      [0] Ok
      [-1] Error: Loco Not Active.
-----------------------------------------------------------------------------
SET SPEED OF AN ACTIVE LOCOMOTIVE: ah = 12
  The number of speed steps is determined when the locomotive is activated.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = New Speed:
      [0-15] when in 14 Step Mode (0=stop  1=emerg  2-15=speed steps)
      [0-31] when in 28 Step Mode (0,1=stop  2,3=emerg  4-31=speed steps)
      [0-127] when in 128 step mode
    bl = DCC Address: 
      [1 to 127]
  Return Value:
    ax = Return Value:
      [0] Ok
     [-1] Error: Loco is not active
-----------------------------------------------------------------------------
SET DIRECTION OF AN ACTIVE LOCOMOTIVE: ah = 13
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = New Direction:
      [0] Reverse
      [1] Forward
    bl = DCC Address: 
      [1 to 127]
  Return Value:
    ax = Return Value:
      [0] Ok
     [-1] Error: Loco is not active
-----------------------------------------------------------------------------
SET EXTRA (14-STEP) BIT OF AN ACTIVE LOCOMOTIVE: ah = 14
  Sets the undefined bit (bit 5) in all 14-step speed/direction packets 
  sent to an active loco. (This bit is used by some decoders to turn the 
  headlight on and off.)
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = Value:
      [0 or 1]
    bl = DCC Address: 
      [1 to 127]
  Return Value:
    ax = Return Value:
      [0] Ok
     [-1] Error: Loco is not active
-----------------------------------------------------------------------------
                        ONE-SHOT PACKET FUNCTIONS
       A One-shot packet is sent as soon as its specific function 
       is called. The packet is repeated a set number of times, then the
       controller resumes sending the queue of speed/direction packets.
-----------------------------------------------------------------------------
SET NUMBER OF REPETITIONS: ah = 30
  Sets the number of times a one-shot packet (command) is sent. If the 
  one-shot packet functions are unreliable (due to track noise), 
  increase this value. The default value is 5.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = Number of repetitions:
      [1 to 255]
  Return Value:
    none
-----------------------------------------------------------------------------
SET MULTI-FUNCTION GROUP 1 ACCESSORY: ah = 31
  Sets one of the five on/off accessories in a multi-function locomotive
  decoder. The locomotive does not need to be active.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OPERATE
  Arguments:
    al = Value:
      [0 or 1] for off/on
    bl = DCC Address: 
      [1 to 127]
    cl = Accessory function number (0 to 4)
  Return Value:
    ax = Return Value:
      [0] Ok
-----------------------------------------------------------------------------
SET TYPE 1 ACCESSORY FUNCTION: ah = 33
  Sets one of the eight on/off functions in a type 1 accessory decoder.
  NOTE: This has not yet been tested. If it works/doesn't work for you, please
        let me know (mobrandt@mailbox.syr.edu)
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OPERATE
  Arguments:
    al = Value:
      [0 or 1] for off/on
    bx = 10-bit DCC Address: 
      [0 to 1023]
    cl = Accessory function number (0 to 7)
  Return Value:
    ax = Return Value:
      [0] Ok
-----------------------------------------------------------------------------
                        DECODER PROGRAMING FUNCTIONS
-----------------------------------------------------------------------------
WRITE REGISTER (USING PAGED ADDRESSING): ah = 50
  Writes a new value into a register in a decoder. The driver must be in
  program mode (see function 00h).
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: PROGRAM 
  Arguments:
    al = Register Address (3 bits)
      [0 to 3] (Paged) Data Registers
      [4] Basic Configuration Flags
      [5] Paging Register
    bl = New Register Value (8 bits)
      [0 to 255]
  Return Value:
    ax = Return Value:
      [0] Ok
     [-1] Error: Not in Program Mode

-----------------------------------------------------------------------------
                      MISC. HARDWARE FUNCTIONS
-----------------------------------------------------------------------------
SET A PARALLEL PORT OUTPUT LINE:  ah = 200
  Sets one of the unused digital output lines of the parallel port.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Controller Modes: OFF, OPERATE, PROGRAM 
  Arguments:
    al = Value
      [0] Output Low (around 0 volts)
      [1-127] Output High (around 5 volts)
    bl = Output Line, as follows:
      [0] Auto Linefeed (pin 14)
      [1-127] Select (pin 17)
  Return Value:
    none
-----------------------------------------------------------------------------
READ A PARALLEL PORT INPUT LINE:  ah = 201
  Reads one of the unused digital input lines of the parallel port.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Arguments:
    bl = Input Line, as follows:
      [0] Error (pin 15)
      [1] Select (pin 13)
      [2] Paper Out (pin 12)
      [3] Acknowledge (pin 10)
      [4] Busy (pin 11)
    Return Value in ax:
        Input line level, 0 or 1
-----------------------------------------------------------------------------
READ ALL JOYSTICK (THROTTLE) VALUES:  ah = 202
  Reads the value of all four joysticks
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Arguments:
    none
  Return Values:
    al = value of switches
    ch = Throttle 1 value
    cl = Throttle 2 value
    dh = Throttle 3 value
    dl = Throttle 4 value


Back to DCC-MB Home Page
Copyright (c) 1996 Michael Brandt / mobrandt@mailbox.syr.edu