Type: External (1.1 and later)
Syntax:
MODE n MODE LPT#[:][n][,][m][,][P] MODE [n],m[,T] MODE (displaytype,linetotal) MODE COMn[:]baud[,][parity][,][databits][,][stopbits][,][retry] MODE LPTn[:]=COMn MODE CON[RATE=(number)][DELAY=(number)] MODE (device) CODEPAGE PREPARE=(codepage) [d:][path]filename MODE (device) CODEPAGE PREPARE=(codepage list) [d:][path]filename MODE (device) CODEPAGE SELECT=(codepage) MODE (device) CODEPAGE [/STATUS] MODE (device) CODEPAGE REFRESH
Purpose: MODE sets the mode of operation for devices or communications. It can be used to set the mode for printers, monitors, or for the serial interface. It can be used to prepare and select code pages and to redirect printer output to the serial interface.
Discussion
The MODE command can be used for five different types of operations. Each is summarized below. Option 1. Printer Settings
Syntax:
MODE LPT#[:][n][,][m][,][P] Use this version of the MODE command to set the output to the printer as either 80 or 132 characters per line. Unless this option is specifically set to 132, DOS uses the 80 characters per line setting for all printouts. When any one of the DOS commands is used to send lines to the printer, this setting determines the MAXIMUM number of characters that will be sent before a line feed is sent to the printer to force the printing to continue on the next line.
Options
# – This option sets the printer number. You can enter 1, 2, or 3 to designate one of three printers.. n – characters per line (80 or 132). m – number of lines per inch (6 or 8). This option sets the output to the printer as either 6 or 8 lines per inch. Unless this option is specifically set to 8, DOS uses the 6 lines per inch setting for all printouts. When using the MODE command to set either the number of characters per line or the number of lines per inch, the program will not warn you if you enter an illegal number. P – places a portion of the MODE program in memory and tells DOS to continuously try to send output to the printer if a time-out error occurs. This gives you a way to correct a printer error without terminating the printout. An example is when the printer returns an out-of-paper error. If you have used the P option, the computer will continue to try to send while you refill the paper supply. The printing will continue when the out-of-paper condition is resolved. If an error occurs that can’t be so easily resolved, you can stop the continuous retrying by pressing and holding the Ctrl key and then pressing the Break key. To change this condition, you must re-enter the MODE command with the printer options , but without using this P option.
Example
MODE LPT1,132,8 Sets printer number 1 to 132 characters per line and 8 lines per inch. Option 2. Monitor Settings
Syntax:
MODE n MODE [n],m[,T]
Options
n – should be one of the following expressions: 40 – 40 characters per line 80 – 80 characters per line BW40 – 40 characters per line, black and white (color display adapter) BW80 – 80 characters per line, black and white (color display adapter) CO40 – 40 characters per line, color (color display adapter) CO80 – 80 characters per line, color (color display adapter) MONO – monochrome display adapter m – R or L (shifts display right or left) T – Displays a test pattern used to align the display.
Discussion
Most computers include a switch on the system board that specifies the type of monitor you will be using. Other computers set the monitor display options using a special software program. Either way, the MODE command can usually be used to override this setting. If you change monitors, you can quickly reset the output format used by your display adapter by using this command. You can shift the display left or right one character (40-character mode) or two characters (80-character mode) by specifying R or L. When you use the T option, the program will display a prompt that asks if the screen is aligned properly. If you enter Y, the command ends. If you enter N, the shift is repeated, followed by the same prompt.
Examples
If you enter mode 80,r,t The display mode is set to 80 characters-per-line and the display is shifted two character positions to the right. The test pattern is displayed so that you can shift the display again without re-entering the command. If your monitor display needs aligning, you may want to put a form of this command in your AUTOEXEC.BAT file. If your display always needs to be shifted to the right, enter the following line into your AUTOEXEC.BAT file. c:\dos\mode ,r Each time this command is issued, the display will be shifted two characters to the right. Remember, MODE is an external DOS command. To use it in your AUTOEXEC.BAT file you must tell DOS where to find the MODE.COM program (in this case, in the DOS directory). Option 3. Asynchronous Communications Settings
Syntax:
MODE COMn[:]baud[,][parity][,][databits][,][stopbits][,][retry]
Options
n – 1 to 4 to indicate the asynchronous communications controller number (the communications port you want to use for communications). This will generally be set at 1 (unless your computer uses more than one output port).
baud – 11 (110 baud), 15 (150 baud), 30 (300 baud), 60 (600 baud), 12 (1200 baud), 24 (2400 baud), 48 (4800 baud), or 96 (9600 baud)
parity – N (none), O (odd), or E (even) (default = E)
databits – 7 or 8 (default = 7)
stopbits – 1 or 2 (for 110 baud, default is 2; for all other baud rates, default is 1)
retry – e (returns error from a status check of a busy port), b (returns busy from a status check of a busy port), p (continues retry until printer accepts output), r (returns ready from a status check of a busy port), and n (default value – takes no retry action)
Discussion
These parameters are used to initialize the asynchronous communications controller. The baud rate is required, but for the other parameters, you may enter a comma to accept the default value. As discussed above concerning the MODE option for printers, the retry options tell DOS what to do if errors occur while sending output to the printer. You can stop the continuous re-trying by pressing and holding the Ctrl key and then pressing the Break key. The retry options are generally used when the asynchronous controller is being used with a serial interface printer. The parity, databits, and stopbits settings depend on the control parameters required by your communications software. Different hardware manufacturers may provide slightly different versions of this command.
Examples
To set the mode of operation to 1200 baud, no parity, eight databits, and one stopbit, enter mode com1:12,n,8,1 To accept the default values (even parity, 7 databits, and 1 stopbit) and use the P option, enter: mode com1:12,,,,retry=p Option 4. Direct Parallel Printer Output (to an asynchronous communications controller)
Syntax:
MODE LPT#[:]=COM n
Options
# – The printer number (1 to 4) n – The asynchronous communications controller number (1 to 4)
Discussion
This command redirects output directed to printer LPT# to asynchronous controller n.
You have to initialize the asynchronous controller with option 3 when you use option 4.
You also have to specify one of the retry parameters when a serial interface printer is connected to the RS-232C controller. Option 5. To set MODE for Code Pages
Syntax:
MODE (device) CODEPAGE
Used to display the current code page. MODE (device) CODEPAGE REFRESH
Used to refresh the active current code page when the resident code page settings for a device have been lost. This can occur, for example, when a code page has been set for a printer and the printer loses power.
The words CODEPAGE REFRESH can be abbreviated as CP REFRESH. MODE (device) CODEPAGE PREPARE=((codepage list) [d:][path]filename) MODE (device) CODEPAGE PREPARE=((codepage) [d:][path]filename) Used to specify the prepared code page for the named device. The words CODEPAGE PREPARE can be abbreviated as CP PREP.
MODE (device) CODEPAGE SELECT=(codepage)
Used to select the code page to be activated for the specified device. The words CODEPAGE SELECT can be abbreviated as CP SELECT.
Options
device – Used to specify one of these device identifiers: CON, PRN, LPT1, LPT2, LPT3. codepage – Used to specify the code page number (refer to Appendix B, Country-Specific Information for information on these code page numbers). codepage list – Used to specify the list of code page numbers (refer to Appendix B, Country-Specific Information for information on these code page numbers).
Discussion
The country-specific options were new with DOS Version 3.3. They are used to pass country-specific information to DOS. They offer a number of new files with functions related to the use of languages. Some of these files have a .CPI filename extension; these filenames are specified when using the country-specific options of the MODE command.
Examples
To display the currently active code page for the device LPT1, enter mode lpt1 cp codepage To re-establish a previously set code page for the device LPT1, enter mode lpt1 cp refresh To specify three code pages related to the CONSOLE device using the file EGA.CPI, enter mode con cp prep=((860,,865) EGA) Notice that the comma (without entering a code page number) is used to specify that the second code page previously prepared does not change. To select the code page 850 for the printer LPT1, enter mode lpt1 cp select=850 The specified code page must be one of the code pages previously specified with CODEPAGE PREPARE.