home | help
DOSCMD(1)		     General Commands Manual		       DOSCMD(1)

NAME
     doscmd -- run a subset of real-mode DOS programs

SYNOPSIS
     doscmd -23AbDEfGHIMOPRrtVvXxYz -c file -d file -i port[:cnt] -o port[:cnt]
	    -S int -U int [cmd [args ...]]

DESCRIPTION
     The  doscmd  utility  can either emulate a subset of DOS and run the single
     command cmd args, or it can be used to emulate a PC and boot DOS, which al-
     lows it to run a larger variety of DOS applications.  It  should  be  noted
     that  MS  DOS  6.2  and higher appear to cause difficulties for doscmd.  To
     boot DOS, either provide the -b flag or omit the cmd argument.   If  -b  is
     specified, cmd and args are ignored.

     Although  doscmd  only  provides a subset of DOS, it is sufficient to run a
     variety of programs, including, but not limited to,  compilers,  assemblers
     and linker-loaders.

     The various flags available to doscmd are:

     -2      Enable  debugging	traces of every trap to the doscmd emulator from
	     the DOS program.  Note that some traps are handled  in  the  kernel
	     and hence will not be traced.

     -3      Enable debugging of several lower level functions, such as changing
	     of interrupt vectors and initializing paths to logical drives.

     -A      Enable tracing of all interrupts that pass into the emulator.  This
	     is  the same as using the -S option with all 256 possible interrupt
	     values.

     -b      Attempt to boot DOS rather than emulate it.

     -c file
	     Capture all output directed at the screen into file.  Note that di-
	     rect screen writes will not be captured.

     -C      List MS-DOS calls emulated and their return values.

     -D      Enable debugging of the disk and file operations.

     -d file
	     Send the debug output to file instead of stderr.

     -E      Enable debugging of the exec routines.

     -G      Enable debugging of the video (graphics) routines.

     -H      Enable tracing of half implemented calls.

     -I      Enable tracing of all interrupts.	Almost the same as -A  except  a
	     few less traces are turned on.

     -i port[:cnt]
	     Enable tracing of all inputs requested from the io port.  If cnt is
	     present, trace from port to port+cnt-1.

     -M      Enable debugging of the memory operations.

     -O      Direct the debugging output to stdout rather than stderr.

     -o port[:cnt]
	     Enable  tracing  of all outputs requested from the io port.  If cnt
	     is present, trace from port to port+cnt-1.

     -p port[:cnt]
	     Map the requested io port (with optional range up to to port+cnt-1)
	     to the real hardware I/O port(s).	This will  likely  require  root
	     privs to access them.

     -P      Enable tracing of io port calls (such as inb, outb, etc).

     -R      Enable debugging of the file redirect code.

     -r      Use  the  raw  keyboard  and display.  Pressing <CTRL-ALT-DEL> will
	     cause doscmd to exit.  This allows use of VGA graphics.

     -S int  Enable tracing of the interrupt int.

     -t      Attempt to do instruction level tracing.  Some instructions confuse
	     the trace.  Pressing <CTRL-ALT-T> attempts to toggle the trace mode
	     on and off.

     -U int  Disable tracing of the interrupt int.  Useful after -A or -I.

     -V      Include register dumps when reporting unknown interrupts.

     -v      Same as -AH

     -X      Enable debugging of the XMS operations.

     -x      Open an X11 window to display output.  This enables a  variety  in-
	     terrupts not available otherwise.	This can be used with or without
	     -b.

     -Y      Enable debugging of the EMS operations.

     -z      Cause  doscmd  to	pause  just prior to jumping to the DOS program.
	     Very little use except for developing doscmd.

     When starting up, doscmd attempts to read a configuration file.  First  the
     file .doscmdrc in the current directory.  If not found there, the $HOME di-
     rectory is searched.  If still not found, the file /etc/doscmdrc is used.

     In  the  configuration  file,  a  comment	is started with the # character.
     Blank lines are ignored.  Non empty lines either are environment  variables
     or  commands  which  configure devices.  Any line which has an = before any
     white space is considered to be an environment variable assignment  and  is
     added to the DOS environment.  The rest of the lines are one of the follow-
     ing

     boot [A: | C:]
	    Set the device to boot from.  By default A: is first tried, if it is
	    defined, and if that fails, C: is tried.

     assign [A-Z]: [-ro] path
	    Assigns  the  BSD/OS  directory path to be assigned as the specified
	    drive.  If the -ro flag is specified, it is a read only file system.
	    These assignments will not take place when	booting  DOS  until  the
	    /usr/libdata/doscmd/redir.com binary is run.

     assign lpt[0-4]: [direct] path [timeout]
	    Attempt  to  assign  the  specified  printer to path.  If timeout is
	    specified then use it as the length of time for no activity (in sec-
	    onds) to indicate that the printer should be flushed.   The  default
	    is	30 seconds.  The direct option should be set when path refers to
	    a real printer.

     assign [A: | B:] [-ro] path density

     assign flop[01] [-ro] path density
	    Assign the file path to be used as either the next available  floppy
	    or	to the specified floppy.  If -ro is specified the floppy will be
	    read only.	The density may be one of:

	    180    9 head 40 track single sided floppy
	    360    9 head 40 track double sided floppy
	    720    9 head 80 track double sided floppy
	    1200   15 head 80 track double sided floppy
	    1440   18 head 80 track double sided floppy
	    2880   36 head 80 track double sided floppy

     assign [C-Z]: [-ro] path [type | cyl head sec] [fdisk_tab]

     assign hard[01] [-ro] path [type | cyl head sec] [fdisk_tab]
	    Assign the file path to be used as either the  next  available  hard
	    disk or to the specified hard disk.  A disk's geometry can either be
	    directly  specified with cyl being the number of cylinders, head the
	    number of heads and sec the number of sectors per track, or  it  can
	    be one of the standard types specified by type (see below).  The op-
	    tion fdisk_tab argument specifies file to use as the first sector of
	    this  disk.   This	can  be useful for inserting a false fdisk table
	    when path only refers to part of a disk.

     assign com[1-4]: path port irq
	    Assign the tty or pty specified by path to be used as the  specified
	    com  port.	 Its  base address will be emulated at port at interrupt
	    specified by irq.  This code is lightly tested and may not suit  all
	    needs.

     portmap port [count]
	    Map   the	requested   io	port  (with  optional  range  up  to  to
	    port+count-1) to the real hardware I/O port(s).   This  will  likely
	    require root privs to access them.

     setver command version
	    Cause  doscmd,  when emulating DOS, to report version as the version
	    number of DOS when called from the program named command.  The  for-
	    mat  of  version is the same as of the MS_VERSION variable described
	    below.

     If not already assigned, C: will be assigned to the root directory (/)  and
     the  current  directory for C: will be set to the actual current directory.
     Note that this means that invocations such as:

	   doscmd ../foo

     will not work as the C: directory will start with the current path.   Also,
     the following environment variables will be defined if not already defined:

     COMSPEC=C:\COMMAND.COM
     PATH=C:\
     PROMPT=DOS>

     The  PATH	variable is also used to find cmd.  Like DOS, first cmd.com will
     be looked for and then cmd.exe.

CONFIGURATION VARIABLES
     There are several variables in the .doscmdrc file	which  are  internal  to
     doscmd  and  do  not actually get inserted into the DOS environment.  These
     are:

     MS_VERSION  The value of this variable is used to determine the version  of
		 DOS  that  should be reported by doscmd.  Note that doscmd will
		 not change the way it works, just the way it reports.	 By  de-
		 fault	this  value  is 410, which corresponds to MS DOS version
		 4.1.  To change it to version 3.2 (the default in previous ver-
		 sions of doscmd) use the value of 320.

     X11_FONT	 The value of this variable determines the font  used  in  an  X
		 window.   The	default  font  is  vga,  which	is  installed in
		 /usr/libdata/doscmd/fonts.    Add   the    line    `xset    fp+
		 /usr/libdata/doscmd/fonts'   to   your   ${HOME}/.xsession   or
		 ${HOME}/.xinitrc to let the X server find it.

FILE TRANSLATION
     The doscmd utility translates BSD/OS file names into DOS file names by con-
     verting to all upper case and eliminating any invalid character.	It  does
     not  make	any  attempt to convert ASCII files into the <CR><LF> format fa-
     vored in the DOS world.  Use fconv(1) (part of  the  ports  collection)  or
     similar tools to convert ASCII files.

DISK TYPES
     +----------+-----------------+--------------+----------------+----------+
     | Type	|    Cylinders	  |    Heads	 |    Sectors	  |	Size |
     +----------+-----------------+--------------+----------------+----------+
     |	 01	|	   306	  |	   4	 |	   17	  |	10MB |
     |	 02	|	   615	  |	   4	 |	   17	  |	20MB |
     |	 03	|	   615	  |	   6	 |	   17	  |	30MB |
     |	 04	|	   940	  |	   8	 |	   17	  |	62MB |
     |	 05	|	   940	  |	   6	 |	   17	  |	46MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 06	|	   615	  |	   4	 |	   17	  |	20MB |
     |	 07	|	   462	  |	   8	 |	   17	  |	30MB |
     |	 08	|	   733	  |	   5	 |	   17	  |	30MB |
     |	 09	|	   900	  |	  15	 |	   17	  |    112MB |
     |	 10	|	   820	  |	   3	 |	   17	  |	20MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 11	|	   855	  |	   5	 |	   17	  |	35MB |
     |	 12	|	   855	  |	   7	 |	   17	  |	49MB |
     |	 13	|	   306	  |	   8	 |	   17	  |	20MB |
     |	 14	|	   733	  |	   7	 |	   17	  |	42MB |
     |	 15	|	   976	  |	  15	 |	   17	  |    121MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 16	|	   612	  |	   4	 |	   17	  |	20MB |
     |	 17	|	   977	  |	   5	 |	   17	  |	40MB |
     |	 18	|	   977	  |	   7	 |	   17	  |	56MB |
     |	 19	|	  1024	  |	   7	 |	   17	  |	59MB |
     |	 20	|	   733	  |	   5	 |	   17	  |	30MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 21	|	   733	  |	   7	 |	   17	  |	42MB |
     |	 22	|	   733	  |	   5	 |	   17	  |	30MB |
     |	 23	|	   306	  |	   4	 |	   17	  |	10MB |
     |	 24	|	   925	  |	   7	 |	   17	  |	53MB |
     |	 25	|	   925	  |	   9	 |	   17	  |	69MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 26	|	   754	  |	   7	 |	   17	  |	43MB |
     |	 27	|	   754	  |	  11	 |	   17	  |	68MB |
     |	 28	|	   699	  |	   7	 |	   17	  |	40MB |
     |	 29	|	   823	  |	  10	 |	   17	  |	68MB |
     |	 30	|	   918	  |	   7	 |	   17	  |	53MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 31	|	  1024	  |	  11	 |	   17	  |	93MB |
     |	 32	|	  1024	  |	  15	 |	   17	  |    127MB |
     |	 33	|	  1024	  |	   5	 |	   17	  |	42MB |
     |	 34	|	   612	  |	   2	 |	   17	  |	10MB |
     |	 35	|	  1024	  |	   9	 |	   17	  |	76MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 36	|	  1024	  |	   8	 |	   17	  |	68MB |
     |	 37	|	   615	  |	   8	 |	   17	  |	40MB |
     |	 38	|	   987	  |	   3	 |	   17	  |	24MB |
     |	 39	|	   987	  |	   7	 |	   17	  |	57MB |
     |	 40	|	   820	  |	   6	 |	   17	  |	40MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 41	|	   977	  |	   5	 |	   17	  |	40MB |
     |	 42	|	   981	  |	   5	 |	   17	  |	40MB |
     |	 43	|	   830	  |	   7	 |	   17	  |	48MB |
     |	 44	|	   830	  |	  10	 |	   17	  |	68MB |
     |	 45	|	   917	  |	  15	 |	   17	  |    114MB |
     +----------+-----------------+--------------+----------------+----------+
     |	 46	|	  1224	  |	  15	 |	   17	  |    152MB |
     +----------+-----------------+--------------+----------------+----------+

INSTALLING DOS ON A PSEUDO DISK
     To install DOS on a pseudo hard disk under doscmd, do the following:

     1	   Create a .doscmdrc with at least the following:

		 assign A: /dev/fd0.1440 1440
		 assign A: /dev/fd0.720 720
		 assign hard boot_drive 80 2 2

	   You	may  need to adjust the raw files for the A: drive to match your
	   system.  This example will cause the HD drive to be tried  first  and
	   the DD drive second.

	   Note  that you should only use raw devices or files at this point, do
	   not use a cooked device!  (Well, it would probably be okay for a hard
	   disk, but certainly not the floppy)

	   boot_drive should be the file name of where you  want  your	bootable
	   image  to  be.   The  three	numbers which follow 80 2 2 say that the
	   drive will have 80 cylinders, 2 heads and 2 sectors per track.   This
	   is  the  smallest  drive possible which still can have MS DOS 5.0 in-
	   stalled on it along with a config.sys and autoexec.bat file.

	   You might want to create a larger boot drive.

	   The file boot_drive must exist, so use the command  touch  to  create
	   it.

     2	   Insert  a  floppy  disk into the A: drive which is bootable to MS-DOS
	   and has the commands fdisk, format and sys on it.   You  should  also
	   copy  the  file  redir.com onto the floppy by either mounting it with
	   the msdos  file  system  type  or  by  using  mtools  (e.g.,  "mwrite
	   redir.com a:").

     3	   run doscmd.

     4	   At the > prompt type fdisk.

     5	   Select Create DOS partition or Logical Drive.

     6	   Select Create Primary DOS Partition.

     7	   Tell  it how big to make it (Typically the whole drive.  It is pretty
	   tiny after all.)

     8	   Get out of FDISK by hitting <ESC> a few times.

     9	   doscmd may abort, if it does, start up doscmd again.

     10    At the > prompt, type format c: and follow the instructions.

     11    At the > prompt type sys c:.

     12    Get out of doscmd.

     13    Either remove the floppy from the drive or add the line

		 boot C:
	   to your .doscmdrc.

     14    You should now be running DOS off of your new disk.	You will  proba-
	   bly	want  both  config.sys and an autoexec.bat file.  To start with,
	   you can say:

		 > copy con: config.sys
		 LASTDRIVE=Z
		 ^Z
		 > copy con: autoexec.bat
		 @echo off
		 redir.com
		 ^Z

     15    Quit doscmd.

     16    You know have a bootable pseudo disk which  will  automatically  call
	   the	magic  redir program, which installs FreeBSD disks.  To use them
	   add lines to your .doscmdrc such as:

		 assign D: /usr/dos
		 assign P: -ro /usr/prb
	   Note that you will not always be able to access  every  file  due  to
	   naming problems.

DIAGNOSTICS
     If  doscmd  encounters an interrupt which is unimplemented, it will print a
     message such as:

	   Unknown interrupt 21 function 99

     and exit.

     If doscmd emits the message X11 support not compiled in when  supplied  the
     -x  switch,  this	support can be added by defining an environment variable
     X11BASE which points to the installed X Window System (normally /usr/X11R6)
     and  then	typing	make  install  in   the   source   directory   (normally
     /usr/src/usr.bin/doscmd).	 For  this  to work, the X programmer's kit must
     have been installed.

AUTHORS
     Pace Willisson,
     Paul Borman

HISTORY
     The doscmd program first appeared in BSD/386.

FreeBSD 4.8			January 30, 1995		       DOSCMD(1)

home | help