rework sys option handling and add some, update sys docs

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1072 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Kenneth J Davis 2004-12-19 19:33:29 +00:00
parent 7b0a023193
commit 89c51f2223
10 changed files with 771 additions and 409 deletions

View File

@ -169,12 +169,11 @@ cont:
lea sp, [bp-0x60] lea sp, [bp-0x60]
sti sti
; ;
; Some BIOS don't pass drive number in DL, so don't use it if [drive] is known ; Note: some BIOS implementations may not correctly pass drive number
; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL
; (formerly we checked for [drive]==0xff; update sys.c if code moves)
; ;
cmp byte [drive], 0xff ; impossible number written by SYS mov [drive], dl ; rely on BIOS drive number in DL
jne dont_use_dl ; was SYS drive: other than A or B?
mov [drive], dl ; yes, rely on BIOS drive number in DL
dont_use_dl: ; no, rely on [drive] written by SYS
mov LBA_SIZE, 10h mov LBA_SIZE, 10h
mov LBA_SECNUM,1 ; initialise LBA packet constants mov LBA_SECNUM,1 ; initialise LBA packet constants

View File

@ -11,22 +11,22 @@
all: fat12.bin fat16.bin fat32chs.bin fat32lba.bin oemfat12.bin oemfat16.bin all: fat12.bin fat16.bin fat32chs.bin fat32lba.bin oemfat12.bin oemfat16.bin
fat12.bin: boot.asm $(DEPENDS) fat12.bin: boot.asm $(DEPENDS)
$(NASM) -DISFAT12 boot.asm -o$*.bin $(NASM) -DISFAT12 boot.asm -l$*.lst -o$*.bin
fat16.bin: boot.asm $(DEPENDS) fat16.bin: boot.asm $(DEPENDS)
$(NASM) -DISFAT16 boot.asm -o$*.bin $(NASM) -DISFAT16 boot.asm -l$*.lst -o$*.bin
fat32chs.bin: boot32.asm $(DEPENDS) fat32chs.bin: boot32.asm $(DEPENDS)
$(NASM) boot32.asm -o$*.bin $(NASM) boot32.asm -l$*.lst -o$*.bin
fat32lba.bin: boot32lb.asm $(DEPENDS) fat32lba.bin: boot32lb.asm $(DEPENDS)
$(NASM) boot32lb.asm -o$*.bin $(NASM) boot32lb.asm -l$*.lst -o$*.bin
oemfat12.bin: oemboot.asm $(DEPENDS) oemfat12.bin: oemboot.asm $(DEPENDS)
$(NASM) -DISFAT12 oemboot.asm -o$*.bin $(NASM) -DISFAT12 oemboot.asm -l$*.lst -o$*.bin
oemfat16.bin: oemboot.asm $(DEPENDS) oemfat16.bin: oemboot.asm $(DEPENDS)
$(NASM) -DISFAT16 oemboot.asm -o$*.bin $(NASM) -DISFAT16 oemboot.asm -l$*.lst -o$*.bin
######################################################################## ########################################################################

View File

@ -99,7 +99,6 @@
;%define LOOPONERR 1 ; if defined on error simply loop forever ;%define LOOPONERR 1 ; if defined on error simply loop forever
;%define SETROOTDIR 1 ; if defined dir entry copied to 0:500 ;%define SETROOTDIR 1 ; if defined dir entry copied to 0:500
;%define RETRYALWAYS 1 ; if defined retries read forever ;%define RETRYALWAYS 1 ; if defined retries read forever
;%define FORCEBIOSDRV 1 ; if defined always use boot drive from BIOS
;%define MSCOMPAT 1 ; sets default filename to MSDOS IO.SYS ;%define MSCOMPAT 1 ; sets default filename to MSDOS IO.SYS
segment .text segment .text
@ -219,14 +218,11 @@ real_start:
sti ; enable interrupts sti ; enable interrupts
; ;
; Some BIOS don't pass drive number in DL, so don't use it if [drive] is known ; Note: some BIOS implementations may not correctly pass drive number
; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL
; (formerly we checked for [drive]==0xff; update sys.c if code moves)
; ;
%ifndef FORCEBIOSDRV mov [drive], dl ; rely on BIOS drive number in DL
cmp byte [drive], 0xff ; impossible number written by SYS
jne dont_use_dl ; was SYS drive: other than A or B?
%endif
mov [drive], dl ; yes, rely on BIOS drive number in DL
dont_use_dl: ; no, rely on [drive] written by SYS
; GETDRIVEPARMS: Calculate start of some disk areas. ; GETDRIVEPARMS: Calculate start of some disk areas.

View File

@ -132,4 +132,4 @@ cd ..
echo Compilation was aborted! echo Compilation was aborted!
:end :end
defaults.bat clearset call defaults.bat clearset

View File

@ -21,7 +21,7 @@ if not "%LINK%" == "" goto skip_link
set LINK=%BASE%\bin\tlink /c/m set LINK=%BASE%\bin\tlink /c/m
if "%COMPILER%" == "TC" set LINK=%BASE%\tlink /c/m if "%COMPILER%" == "TC" set LINK=%BASE%\tlink /c/m
if "%COMPILER%" == "WATCOM" set LINK=..\utils\wlinker /nologo if "%COMPILER%" == "WATCOM" set LINK=call ..\utils\wlinker /nologo
if "%COMPILER%" == "MSC" set LINK=%BASE%\bin\link /ONERROR:NOEXE /batch if "%COMPILER%" == "MSC" set LINK=%BASE%\bin\link /ONERROR:NOEXE /batch
echo Linker is %LINK% echo Linker is %LINK%

View File

@ -378,6 +378,12 @@
+ Changes Jeremy + Changes Jeremy
* config.txt * config.txt
- update to include all CONFIG.SYS options (except ANYDOS) - update to include all CONFIG.SYS options (except ANYDOS)
* boot.asm
- use static read buffer to avoid crossing 64KB boundary
* oemboot.asm - add [optional] PC/MS DOS compatible boot sector
* sys.c
- incorporate changes from/for DR-DOS enhancement project
- rework option handling, add backup & restore boot sector
* exeflat.c * exeflat.c
- show usage also when number of arguments incorrect - show usage also when number of arguments incorrect
< many other changes to be added by Jeremy himself :-> < many other changes to be added by Jeremy himself :->

100
docs/sys.htm Normal file
View File

@ -0,0 +1,100 @@
<html>
<title>sys</title>
<body>
<h1>sys</h1>
Copy system files and make a floppy disk or hard disk bootable.
<pre>
<b>sys [[d:]path] d: [bootsect] [switches]</b>
</pre>
<h2>Options</h2>
<pre>
<b>[[d:]path]</b>
The (optional) location of the system files.
If not given, the current directory is assumed.
<b>d:</b>
The drive to make bootable.
<b>bootsect</b>
The name of file, to which the 512-byte boot sector image
will be written.
(the drive's real boot sector won't be
written to unless BOTH is used.)
Switches (FreeDOS specific):
<b>/BOTH</b>
The new boot sector will be written to the image file
and to the actual drive boot sector.
<b>/BOOTONLY</b>
With this option the boot sector (or image) will be updated,
but the kernel and <a href="command.htm">command.com</a> will
not be copied to the destination.
<b>/K <i>filename</i></b>
Gives the <i>filename</i> of the kernel file to be copied. This option
is only required when the kernel is not called "kernel.sys"
Note: when combined with the /L option, allows one to use FreeDOS
<i>sys</i> to create a system to boot custom kernels (ie custom OS)
<b>/L <i>segment</i></b>
The load <i>segent</i>, in hexadecimal, to use. The default is 0x60.
<b>/B <i>btdrv</i></b>
Sets the BIOS boot drive # (in hex) stored within the boot sector.
<b>/FORCEDRV</b>
Causes the boot sector to only use the <i>btdrv</i> indicated in
boot sector. NOPs the code that normally uses BIOS provided
drive # passed at boot time in the DL register.
<b>/BACKUPBS <i>[path]filename</i></b>
The original boot sector is written to <i>[path]filename</i> prior
to overwriting with FreeDOS one. The filename may refer to any
[image or bs] file, if exists only the 1st 512 bytes will be
overwritten.
<b>/RESTORBS <i>[path]filename</i></b>
Restores original boot sector (<i>[path]filename</i>) and exits.
The boot sector specified is written with no modifications.
The filename may refer to any [image or bs] file, only the 1st
512 bytes are used.
<b>/OEM:<i>DOS</i></b>
Where <i>DOS</i> is one of
<b>AUTO</b> - the default, attempts to determine automatically,
checking for FreeDOS, DR-DOS, PC-DOS, then MS-DOS;
<b>FD</b> - FreeDOS mode, setup destination drive to boot
the FreeDOS kernel and copy FreeDOS system files
(default to KERNEL.SYS and load segment of 0x60)
<b>DR</b> - use DR DOS 7+ (including Udo Kuhnt's DR-DOS
Enhanement Project) compatible settings
(use IBMBIO.COM & IBMDOS.COM, and loadseg=0x70)
<b>PC</b> - use PC-DOS (any) compatible settings, including
alternate boot sector (supports FAT12/16 only)
Must be explicitly choosen, AUTO selects DR mode.
(use IBMBIO.COM & IBMDOS.COM, and loadseg=0x70)
<b>MS</b> - use MS-DOS (pre 7) compatible settings, including
alternate boot sector (supports FAT12/16 only)
(use IO.SYS & MSDOS.SYS, and loadseg=0x70)
<b>W9x</b> - use MS-DOS 7+, aka Windows 9x DOS compatible
settings, Win ME unsupported ...
Note: when attempting to boot older PC/MS DOS versions, even when
using the alternate boot sector, one may need to ensure the
system files are the 1st two filesystem entries and in consecutive
sectors at the beginning of the drive; so for best results when
creating a PC/MS DOS boot disk, format the drive first, do NOT
create a label, and then run sys on it. You can then add a label.
Newer releases, such as PC-DOS 7.x do not have these limitations.
</pre>
<hr>
<address>
<b>Copyright &copy; 1998 Jim Hall</b><br>
This file is derived from the FreeDOS Spec Command HOWTO.
See the file <a href="H2Cpying.txt">H2Cpying.txt</a> for copying conditions.
</address>
</body>
</html>

View File

@ -1,17 +1,44 @@
SYS documentation by Jeremy Davis FreeDOS SYS 3.5
Updated by Bart Oldeman documentation by:
Jeremy Davis
Bart Oldeman
SYS's standard behavior is very similar (though in SYS's standard behavior is very similar (though in
my opinion improved) to that of other DOSes. my opinion improved) to that of other DOSes.
SYS (no options) should provide a general usage, SYS /? (or no options) should provide a general usage,
and SYS CONFIG /help (or SYS CONFIG /?) should and SYS CONFIG /help (or SYS CONFIG /?) should
provide usage for the new configuration options. provide usage for the new configuration options.
Admittedly its brief, but it is there. The best documentation is the source itself, but
Below is a more detailed documentation on its we try to keep this document updated.
usage (from memory, but I believe it is close to right).
The best documentation (and maybe only) is the
source itself. Usage:
SYS [source] dest: [bootsect] [{option}]
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
dest = A,B,etc.
bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector
{option} is one or more of the following:
/BOTH : write to *both* the real boot sector and the image file
/BOOTONLY: do *not* copy kernel / shell, only update boot sector or image
/OEM : indicates boot sector, filenames, and load segment to use
/OEM:FD use FreeDOS compatible settings
/OEM:DR use DR DOS 7+ compatible settings (same as /OEM)
/OEM:PC use PC-DOS compatible settings
/OEM:MS use MS-DOS compatible settings
/OEM:W9x use MS Win9x DOS compatible settings
default is /OEM:AUTO, select DOS based on existing files
/K name : name of kernel to use in boot sector instead of KERNEL.SYS
/L segm : hex load segment to use in boot sector instead of 0x60
/B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...
/FORCEDRV: force use of drive # set in bs instead of BIOS boot value
/SKFN filename : set KERNEL.SYS input file and /OEM:FD
/SCFN filename : sets COMMAND.COM input file
/BACKUPBS [path]filename : save current bs before overwriting
/RESTORBS [path]filename : overwrite bs and exit
SYS CONFIG /help
The simplest usage: The simplest usage:
@ -27,7 +54,7 @@ be in the root directory of the current drive.
Complete form: Complete form:
SYS [source] dest: [bootsect [BOTH]] SYS [source] dest: [bootsect [/BOTH]]
Here dest is the same as before, but this time Here dest is the same as before, but this time
you specify where KERNEL.SYS and COMMAND.COM are. you specify where KERNEL.SYS and COMMAND.COM are.

View File

@ -1229,8 +1229,7 @@ dispatch:
lregs er; lregs er;
fmemcpy(&er, FP_DS_DX, sizeof(er)); fmemcpy(&er, FP_DS_DX, sizeof(er));
CritErrCode = er.AX; CritErrCode = er.AX;
FP_SEG(CritErrDev) = er.ES; CritErrDev = MK_FP(er.ES, er.DI);
FP_OFF(CritErrDev) = er.DI;
CritErrLocus = er.CH; CritErrLocus = er.CH;
CritErrClass = er.BH; CritErrClass = er.BH;
CritErrAction = er.BL; CritErrAction = er.BL;

975
sys/sys.c

File diff suppressed because it is too large Load Diff