]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/doscmd/doscmd.1
This commit was generated by cvs2svn to compensate for changes in r76238,
[FreeBSD/FreeBSD.git] / usr.bin / doscmd / doscmd.1
1 .\"
2 .\" Copyright (c) 1992, 1993, 1996
3 .\"     Berkeley Software Design, Inc.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by Berkeley Software
16 .\"     Design, Inc.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\"     BSDI doscmd.1,v 2.3 1996/04/08 19:32:29 bostic Exp
31 .\" $FreeBSD$
32 .\"
33 .Dd January 30, 1995
34 .Dt DOSCMD 1
35 .Os
36 .Sh NAME
37 .Nm doscmd
38 .Nd run a subset of real-mode DOS programs
39 .Sh SYNOPSIS
40 .Nm
41 .Fl 23AbDEfHIMOPRrtVvXxYz
42 .Fl c Ar file
43 .Fl d Ar file
44 .Fl i Ar port Ns Xo 
45 .Op : Ns Ar cnt
46 .Xc
47 .Fl o Ar port Ns Xo 
48 .Op : Ns Ar cnt
49 .Xc
50 .Fl S Ar int
51 .Fl U Ar int
52 .Op Ar cmd Op Ar args ...
53 .Sh DESCRIPTION
54 .Nm Doscmd
55 can either emulate a subset of DOS and run the
56 single command
57 .Ar cmd
58 .Ar args ,
59 or it can be used to emulate a PC and boot DOS,
60 which allows it to run a larger variety of DOS applications.
61 It should be noted that MS DOS 6.2 and higher appear
62 to cause difficulties for
63 .Nm .
64 To boot DOS, either provide the 
65 .Fl b
66 flag or omit the
67 .Ar cmd
68 argument.
69 If
70 .Fl b
71 is specified,
72 .Ar cmd
73 and
74 .Ar args
75 are ignored.
76 .Pp
77 Although 
78 .Nm
79 only provides a subset of DOS, it is sufficient to run a variety of
80 programs, including, but not limited to, compilers, assemblers and
81 linker-loaders.
82 .Pp
83 The various flags available to
84 .Nm
85 are:
86 .Bl -tag -width indent
87 .It Fl 2
88 Enable debugging traces of every trap to the
89 .Nm
90 emulator from the DOS program.
91 Note that some traps are handled in the kernel and hence will not
92 be traced.
93 .It Fl 3
94 Enable debugging of several lower level functions, such
95 as changing of interrupt vectors and initializing paths to logical drives.
96 .\"
97 .\"
98 .\"
99 .It Fl A
100 Enable tracing of all interrupts that pass into the emulator.
101 This is the same as using the
102 .Fl S
103 option with all 256 possible interrupt values.
104 .\"
105 .\"
106 .\"
107 .It Fl b
108 Attempt to boot DOS rather than emulate it.
109 .\"
110 .\"
111 .\"
112 .It Fl c Ar file
113 Capture all output directed at the screen into
114 .Ar file .
115 Note that direct screen writes will not be captured.
116 .\"
117 .\"
118 .\"
119 .It Fl C
120 List MS-DOS calls emulated and their return values.
121 .\"
122 .\"
123 .\"
124 .It Fl D
125 Enable debugging of the disk and file operations.
126 .\"
127 .\"
128 .\"
129 .It Fl d Ar file
130 Send the debug output to
131 .Ar file
132 instead of stderr.
133 .\"
134 .\"
135 .\"
136 .It Fl E
137 Enable debugging of the exec routines.
138 .\"
139 .\"
140 .\"
141 .It Fl H
142 Enable tracing of half implemented calls.
143 .\"
144 .\"
145 .\"
146 .It Fl I
147 Enable tracing of all interrupts.  Almost the same as
148 .Fl A
149 except a few less traces are turned on.
150 .\"
151 .\"
152 .\"
153 .It Fl i Ar port Ns Xo
154 .Op : Ns Ar cnt
155 .Xc
156 Enable tracing of all inputs requested from the io
157 .Ar port .
158 If
159 .Ar cnt
160 is present, trace from
161 .Ar port
162 to
163 .Ar port+cnt Ns No -1 .
164 .\"
165 .\"
166 .\"
167 .It Fl M
168 Enable debugging of the memory operations.
169 .\"
170 .\"
171 .\"
172 .It Fl O
173 Direct the debugging output to stdout rather than stderr.
174 .\"
175 .\"
176 .\"
177 .It Fl o Ar port Ns Xo
178 .Op : Ns Ar cnt
179 .Xc
180 Enable tracing of all outputs requested from the io
181 .Ar port .
182 If
183 .Ar cnt
184 is present, trace from
185 .Ar port
186 to
187 .Ar port+cnt Ns No -1 .
188 .\"
189 .\"
190 .\"
191 .It Fl p Ar port Ns Xo
192 .Op : Ns Ar cnt
193 .Xc
194 Map the requested io
195 .Ar port
196 (with optional range up to to
197 .Ar port+cnt Ns No -1 )
198 to the real hardware I/O port(s).
199 This will likely require root privs to access them.
200 .\"
201 .\"
202 .\"
203 .It Fl P
204 Enable tracing of io port calls (such as
205 .Li inb ,
206 .Li outb ,
207 etc).
208 .\"
209 .\"
210 .\"
211 .It Fl R
212 Enable debugging of the file redirect code.
213 .\"
214 .\"
215 .\"
216 .It Fl r
217 Use the raw keyboard and display.  Pressing <CTRL-ALT-DEL> will
218 cause doscmd to exit.  This allows use of VGA graphics.
219 .\"
220 .\"
221 .\"
222 .It Fl S Ar int
223 Enable tracing of the interrupt
224 .Ar int .
225 .\"
226 .\"
227 .\"
228 .It Fl t
229 Attempt to do instruction level tracing.
230 Some instructions confuse the trace.
231 Pressing
232 .Li <CTRL-ALT-T>
233 attempts to toggle the trace mode on and off.
234 .\"
235 .\"
236 .\"
237 .It Fl U Ar int
238 Disable tracing of the interrupt
239 .Ar int .
240 Useful after
241 .Fl A
242 or
243 .Fl I .
244 .\"
245 .\"
246 .\"
247 .It Fl V
248 Include register dumps when reporting unknown interrupts.
249 .\"
250 .\"
251 .\"
252 .It Fl v
253 Same as
254 .Fl AH
255 .\"
256 .\"
257 .\"
258 .It Fl X
259 Enable debugging of the XMS operations.
260 .\"
261 .\"
262 .\"
263 .It Fl x
264 Open an X11 window to display output.  This enables a
265 variety interrupts not available otherwise.  This
266 can be used with or without
267 .Fl b .
268 .\"
269 .\"
270 .\"
271 .It Fl Y
272 Enable debugging of the EMS operations.
273 .\"
274 .\"
275 .\"
276 .It Fl z
277 Cause
278 .Nm
279 to pause just prior to jumping to the DOS program.
280 Very little use except for developing
281 .Nm .
282 .El
283 .Pp
284 When starting up,
285 .Nm
286 attempts to read a configuration file.  First the file
287 .Cm .doscmdrc
288 in the current directory.  If not found there, the
289 .Cm $HOME
290 directory is searched.  If still not found, the file
291 .Cm /etc/doscmdrc
292 is used.
293 .Pp
294 In the configuration file, a comment is started with the \fB#\fP character.
295 Blank lines are ignored.
296 Non empty lines either are environment variables
297 or commands which configure devices.
298 Any line which has an \fB=\fP before any white space is considered to be
299 an environment variable assignment and is added to the DOS environment.
300 The rest of the lines are one of the following
301 .Bl -tag -width XXXXX
302 .\"
303 .\"
304 .\"
305 .It Cm boot Op Cm A: | C:
306 Set the device to boot from.
307 By default
308 .Cm A:
309 is first tried, if it is defined, and if that fails,
310 .Cm C:
311 is tried.
312 .\"
313 .\"
314 .\"
315 .It Cm assign Xo
316 .Op Cm A-Z :
317 .Op Fl ro
318 .Ar path
319 .Xc
320 Assigns the
321 .Tn BSD/OS
322 directory
323 .Ar path
324 to be assigned as the specified drive.  If the
325 .Fl ro
326 flag is specified, it is a read only file system.
327 These assignments will not take place when booting DOS until the
328 .Pa /usr/libdata/doscmd/redir.com
329 binary is run.
330 .\"
331 .\"
332 .\"
333 .It Cm assign Xo
334 .Cm lpt Ns Op Cm 0-4 :
335 .Op Cm direct
336 .Ar path
337 .Op Ar timeout
338 .Xc
339 Attempt to assign the specified printer to
340 .Ar path .
341 If
342 .Ar timeout
343 is specified then use it as the length of time for no
344 activity (in seconds) to indicate that the printer
345 should be flushed.  The default is 30 seconds.
346 The
347 .Cm direct
348 option should be set when
349 .Ar path
350 refers to a real printer.
351 .\"
352 .\"
353 .\"
354 .It Cm assign Xo
355 .Op Cm A: | B:
356 .Op Fl ro
357 .Ar path
358 .Ar density
359 .Xc
360 .It Cm assign Xo
361 .Cm flop Ns Op Cm 01
362 .Op Fl ro
363 .Ar path
364 .Ar density
365 .Xc
366 Assign the file
367 .Ar path
368 to be used as either the next available floppy or
369 to the specified floppy.
370 If
371 .Fl ro
372 is specified the floppy will be read only.
373 The
374 .Ar density
375 may be one of:
376 .Pp
377 .Bl -tag -compact -width 1440x
378 .It 180
379 9 head 40 track single sided floppy
380 .It 360
381 9 head 40 track double sided floppy
382 .It 720
383 9 head 80 track double sided floppy
384 .It 1200
385 15 head 80 track double sided floppy
386 .It 1440
387 18 head 80 track double sided floppy
388 .It 2880
389 36 head 80 track double sided floppy
390 .El
391 .\"
392 .\"
393 .\"
394 .It Cm assign Xo
395 .Op Cm C-Z  :
396 .Op Fl ro
397 .Ar path
398 .Op Ar type | cyl head sec
399 .Op Ar fdisk_tab
400 .Xc
401 .It Cm assign Xo
402 .Cm hard Ns Op Cm 01
403 .Op Fl ro
404 .Ar path
405 .Op Ar type | cyl head sec
406 .Op Ar fdisk_tab
407 .Xc
408 Assign the file
409 .Ar path
410 to be used as either the next available hard disk or
411 to the specified hard disk.
412 A disk's geometry can either be directly specified with
413 .Ar cyl
414 being the number of cylinders,
415 .Ar head
416 the number of heads and
417 .Ar sec
418 the number of sectors per track,
419 or it can be one of the standard types specified by
420 .Ar type 
421 (see below).
422 The option
423 .Ar fdisk_tab
424 argument specifies file to use as the first sector
425 of this disk.  This can be useful for inserting a
426 false fdisk table when
427 .Ar path
428 only refers to part of a disk.
429 .\"
430 .\"
431 .\"
432 .It Cm assign Xo
433 .Cm com Ns Op Cm 1-4 :
434 .Ar path
435 .Ar port
436 .Ar irq
437 .Xc
438 Assign the tty or pty specified by
439 .Ar path
440 to be used as the specified com port.
441 It's base address will be emulated at
442 .Ar port
443 at interrupt specified by
444 .Ar irq .
445 This code is lightly tested and may not suit all needs.
446 .\"
447 .\"
448 .\"
449 .It Cm portmap Xo
450 .Ar port
451 .Op Ar count
452 .Xc
453 Map the requested io
454 .Ar port
455 (with optional range up to to
456 .Ar port+count Ns No -1 )
457 to the real hardware I/O port(s).
458 This will likely require root privs to access them.
459 .\"
460 .\"
461 .\"
462 .It Cm "setver command version"
463 Cause doscmd, when emulating DOS, to report
464 .Cm version
465 as the version number of DOS when called from the program named
466 .Cm command .
467 The format of
468 .Cm version
469 is the same as of the
470 .Cm MS_VERSION
471 variable described below.
472 .El
473 .Pp
474 If not already assigned,
475 .Cm C:
476 will be assigned to the root directory (/) and the current directory
477 for
478 .Cm C:
479 will be set to the actual current directory.
480 Note that this means that invocations such as:
481 .Pp
482 .Dl "doscmd ../foo
483 .Pp
484 will not work as the
485 .Cm C:
486 directory will start with the current path.
487 Also, the following environment variables will be defined if not
488 already defined:
489 .Bd -literal
490 .Cm "COMSPEC=C:\eCOMMAND.COM
491 .Cm "PATH=C:\e
492 .Cm "PROMPT=DOS> 
493 .Ed
494 .Pp
495 The
496 .Cm PATH
497 variable is also used to find
498 .Ar cmd .
499 Like DOS, first
500 .Ar cmd.com
501 will be looked for and then
502 .Ar cmd.exe .
503 .Sh "CONFIGURATION VARIABLES"
504 .Pp
505 There are several variables in the 
506 .Cm .doscmdrc
507 file which are internal to doscmd and do not actually get inserted into
508 the DOS environment.  These are:
509 .Bl -tag -width MS_VERSION
510 .It Cm MS_VERSION
511 The value of this variable is used to determine the version of DOS that
512 should be reported by
513 .Nm .
514 Note that
515 .Nm
516 will not change the way
517 it works, just the way it reports.  By default this value is
518 .Cm 410 ,
519 which corresponds to
520 .Tn "MS DOS
521 version 4.1.
522 To change it to version 3.2 (the default in previous versions of
523 .Nm )
524 use the value of
525 .Cm 320 .
526 .It Cm X11_FONT
527 The value of this variable determines the font used in an X window.
528 The default font is
529 .Cm vga ,
530 which is installed in
531 .Pa /usr/libdata/doscmd/fonts .
532 Add the line
533 .Ql xset fp+ /usr/libdata/doscmd/fonts
534 to your
535 .Pa ${HOME}/.xsession
536 or
537 .Pa ${HOME}/.xinitrc
538 to let the X server find it.
539 .El
540 .Sh FILE TRANSLATION
541 .Nm Doscmd
542 translates
543 .Tn BSD/OS
544 file names into 
545 .Tn DOS
546 file names by converting to all upper case and eliminating any invalid
547 character.  It does not make any attempt to convert ASCII files into
548 the
549 .Cm <CR><LF>
550 format favored in the DOS world.  Use
551 .Xr fconv 1
552 (part of the ports collection) or similar tools to convert ASCII files.
553 .bp
554 .Sh DISK TYPES
555 .TS H
556 expand, box;
557 r | r | r | r | r.
558 Type    Cylinders       Heads   Sectors Size
559 =
560 01      306     4       17      10MB
561 02      615     4       17      20MB
562 03      615     6       17      30MB
563 04      940     8       17      62MB
564 05      940     6       17      46MB
565 _
566 06      615     4       17      20MB
567 07      462     8       17      30MB
568 08      733     5       17      30MB
569 09      900     15      17      112MB
570 10      820     3       17      20MB
571 _
572 11      855     5       17      35MB
573 12      855     7       17      49MB
574 13      306     8       17      20MB
575 14      733     7       17      42MB
576 15      976     15      17      121MB
577 _
578 16      612     4       17      20MB
579 17      977     5       17      40MB
580 18      977     7       17      56MB
581 19      1024    7       17      59MB
582 20      733     5       17      30MB
583 _
584 21      733     7       17      42MB
585 22      733     5       17      30MB
586 23      306     4       17      10MB
587 24      925     7       17      53MB
588 25      925     9       17      69MB
589 _
590 26      754     7       17      43MB
591 27      754     11      17      68MB
592 28      699     7       17      40MB
593 29      823     10      17      68MB
594 30      918     7       17      53MB
595 _
596 31      1024    11      17      93MB
597 32      1024    15      17      127MB
598 33      1024    5       17      42MB
599 34      612     2       17      10MB
600 35      1024    9       17      76MB
601 _
602 36      1024    8       17      68MB
603 37      615     8       17      40MB
604 38      987     3       17      24MB
605 39      987     7       17      57MB
606 40      820     6       17      40MB
607 _
608 41      977     5       17      40MB
609 42      981     5       17      40MB
610 43      830     7       17      48MB
611 44      830     10      17      68MB
612 45      917     15      17      114MB
613 _
614 46      1224    15      17      152MB
615 .TE
616 .bp
617 .Sh INSTALLING DOS ON A PSEUDO DISK
618 .Pp
619 To install DOS on a pseudo hard disk under doscmd, do the following:
620 .Bl -tag -width XXXX
621 .It 1
622 Create a 
623 .Pa .doscmdrc
624 with at least the following:
625 .Bd -literal -offset indent
626 assign A: /dev/fd0.1440 1440
627 assign A: /dev/fd0.720 720
628 assign hard boot_drive 80 2 2
629 .Ed
630 .Pp
631 You may need to adjust the raw files for the A: drive to match
632 your system.  This example will cause the HD drive to be tried
633 first and the DD drive second.
634 .Pp
635 Note that you should only use raw devices or files at this point,
636 do not use a cooked device!  (Well, it would probably be okay
637 for a hard disk, but certainly not the floppy)
638 .Pp
639 .Li boot_drive
640 should be the file name of where you want your bootable
641 image to be.  The three numbers which follow
642 .Li 80 2 2
643 say that the drive will have 80 cylinders, 2 heads and 2 sectors per track.
644 This is the smallest drive possible which still can have MS DOS
645 5.0 installed on it along with a
646 .Pa config.sys
647 and
648 .Pa autoexec.bat
649 file.
650 .Pp
651 You might want to create a larger boot drive.
652 .Pp
653 The file
654 .Pa boot_drive
655 must exist, so use the command touch to create it.
656 .It 2
657 Insert a floppy disk into the A: drive which is bootable to MS-DOS
658 and has the commands fdisk, format and sys on it.  You should also
659 copy the file redir.com onto the floppy by either mounting it
660 with the msdos file system type or by using mtools
661 (e.g.,
662 .Dq Li mwrite redir.com a: ) .
663 .It 3
664 run doscmd.
665 .It 4
666 At the > prompt type
667 .Li fdisk .
668 .It 5
669 Select 
670 .Li Create DOS partition or Logical Drive .
671 .It 6
672 Select 
673 .Li Create Primary DOS Partition .
674 .It 7
675 Tell it how big to make it
676 (Typically the whole drive.  It is pretty tiny after all.)
677 .It 8
678 Get out of FDISK by hitting
679 .Li <ESC>
680 a few times.
681 .It 9
682 doscmd may abort, if it does, start up doscmd again.
683 .It 10
684 At the > prompt, type
685 .Li format c:
686 and follow the instructions.
687 .It 11
688 At the > prompt type
689 .Li sys c: .
690 .It 12
691 Get out of doscmd.
692 .It 13
693 Either remove the floppy from the drive or add the line
694 .Bd -literal -offset indent 
695 boot C:
696 .Ed
697 to your
698 .Pa .doscmdrc .
699 .It 14
700 You should now be running DOS off of your new disk.  You will
701 probably want both config.sys and an autoexec.bat file.  To
702 start with, you can say:
703 .Bd -literal -offset indent
704 > copy con: config.sys
705 LASTDRIVE=Z
706 ^Z
707 > copy con: autoexec.bat
708 @echo off
709 redir.com
710 ^Z
711 .Ed
712 .It 15
713 Quit doscmd.
714 .It 16
715 You know have a bootable pseudo disk which will automatically call
716 the magic 
717 .Li redir
718 program, which installs
719 .Fx
720 disks.  To use
721 them add lines to your .doscmdrc such as:
722 .Bd -literal -offset indent
723 assign D: /usr/dos
724 assign P: -ro /usr/prb
725 .Ed
726 Note that you will not always be able to access every file due to
727 naming problems.
728 .El
729 .Sh DIAGNOSTICS
730 .Pp
731 If
732 .Nm
733 encounters an interrupt which is unimplemented, it will print a message
734 such as:
735 .Pp
736 .Dl Unknown interrupt 21 function 99
737 .Pp
738 and exit.
739 .Pp
740 If
741 .Nm
742 emits the message 
743 .Ic X11 support not compiled in
744 when supplied the
745 .Fl x
746 switch, this support can be added by defining an environment variable
747 .Ev X11BASE
748 which points to the installed X Window System (normally
749 .Pa /usr/X11R6
750 ) and then typing 
751 .Ic make install
752 in the source directory (normally 
753 .Pa /usr/src/usr.bin/doscmd 
754 ).  For this to work, the X programmer's kit must have been installed.
755 .Sh AUTHORS
756 .An Pace Willisson ,
757 .An Paul Borman
758 .Sh HISTORY
759 The
760 .Nm
761 program first appeared in BSD/386.