diff --git a/docs/config.txt b/docs/config.txt index 3bd6b1e..0ec7d19 100644 --- a/docs/config.txt +++ b/docs/config.txt @@ -1,51 +1,220 @@ -Advanced - FreeDOS specific - CONFIG.SYS processing - -a new command DOSDATA=UMB -DOSDATA=UMB loads some FreeDOS specific stuff in Upper Memory Blocks, -like the RAM that FILESHIGH, LASTDRIVEHIGH, and STACKSHIGH occupy - -a new command ECHO -ECHO does ECHO its argument (surprised ?-) and is executed at -the time the DEVICE= lines are executed. -use it similarly to - - ECHO loading driver 1 - device=Driver1.sys - ECHO driver1 successfully loaded - -a new command called EECHO is also available, for echo-ing ANSI Escape Sequences -(redefines keyboard input for example). +Configuring your DOS system for use: +------------------------------------ +When booting DOS, you will find it only supports a subset of +the devices available on many computers. To support additional +devices and advanced features, device specific driver and +memory resident software most be loaded. This allows the +kernel to be easily extended to support hardware not presently +available and take better advantage of installed hardware +without wasting resources on computers lacking it. This +software is generally loaded during the kernel initialization +phase, with details describing what to load expressed in the +file CONFIG.SYS. The FreeDOS kernel will first look for a +file named FDCONFIG.SYS, should it exist, it will will be used +instead of CONFIG.SYS; this allows the FreeDOS kernel to coexist +and be configured differently than another DOS kernel. There +are additional options available to adjust other aspects of the +kernel's behaviour. Note: some options listed below are FreeDOS +specific and will not work when using other/older DOS kernels. +Below is list of all documented FreeDOS config.sys supported +options; additional undocumented options may exist but are not +meant for normal usage. -an undocumented command SCREEN=xx -SCREEN= switches into videomode xxx (INT10/11xx/000) -useful - SCREEN=0x11 -- 28 lines - SCREEN=0x12 -- 43/50 lines (on EGA/VGA) +BREAK +Usage: break=on|off +Set extended Control-C/Control-Break checking to on [default] or off. +When set to on, the kernel will perform the check (and invoke current +handler if pressed) prior to most int 21h calls. When set to off, +the kernel only performs the check on I/O calls using standard streams. +e.g. break=off + +BUFFERS +BUFFERSHIGH +Usage: buffers=nn[,n] where nn is in range 1-99 & n is in range 1-8 +Memory buffers used by the kernel; primary[,secondary] +The secondary buffer option is available for compatibility with +other DOS kernels, but is ignored by the FreeDOS kernel. +e.g. buffers=20 + +COUNTRY +Usage: country=nnn[,[mmm][,[d:][path]file]] +Only limited country=nnn support is presently available. +Enables/sets international features of DOS +nnn is country code (001==US) +mmm is code page (437 is default, 850 is updated form, 1252 for Windows) +[drive][path]file specifies file with country specific data +e.g. country=001,850,C:\FDOS\BIN\COUNTRY.SYS + +DEVICE +Usage: device=[d:][path]file [options] +Load the device driver specified by d:path\file (into conventional +[low 640KB] memory). The options are for the driver itself; refer +to documentation that came with your particular device for supported +options and their usage. +e.g. device=himem.sys + +DEVICEHIGH +Usage: devicehigh=[d:][path]file [options] +This is just like device= statement, except it attempts to load +the device driver into high memory first (failing that it should +load it in conventional memory). +Note: The order you load devices may have a large impact on amount +of free memory available. In general try to load large (in memory +usage) programs into high memory first. +Important: You should have a high memory manager such as FDXMS or +Himem installed (prior device=FDXMS.SYS or device=HIMEM.SYS) before +using this option. +e.g. devicehigh=atapicdd.sys /D:FDCD0001 + +DOS +Usage: dos=high|low,umb|noumb +Indicates whether the kernel should try to load itself into +high memory or only conventional (low), and whether to link +upper memory blocks in with normal memory or not. +Note: only one set need be given, ie dos=high and dos=noumb are ok. +Important: if you specify dos=high[,umb|noumb] then you must also +load a high memory manager (first), ie FDXMS or HIMEM +e.g. dos=high,umb +or dos=low,noumb + +DOSDATA +Usage: dosdata=umb +Try to load kernel data into Upper Memory Blocks; effectively +same as using the HIGH variant of kernel parameters, +such as fileshigh, lastdrivehigh, and stackshigh (does not +effect drivers loaded using device= or install=). +e.g. dosdata=umb + +ECHO +Usage: ECHO Message to be displayed to user. +ECHO displays (echos) its arguments to the console during +config.sys processing when device drivers are loaded (when +DEVICE= lines are executed). +e.g. + ECHO loading driver 1 + device=Driver1.sys + ECHO driver1 successfully loaded + +EECHO +Usage: EECHO Message with ANSI Escape Sequence +EECHO allows for echo-ing ANSI Escape Sequences +(redefines keyboard input for example). Use a dollar sign ($) +to represent the ANSI Escape character. Note: requires an +ansi driver loaded prior to use. + +FCBS +Usage: fcbs=nnn +where nnn is in range 1-255 +Sets the number of File Control Blocks to reserve room for. +As file control blocks have been replaced by file handles +(see files) most applications will not need this value adjusted. +e.g. fcbs=4 + +FILES +FILESHIGH +Usage: files=nnn +where nnn is in range 8-255 (default 8) +Specifies how many files allowed open at once (reserves +memory necessary to support opening this many files). +Note: there are other restrictions, so a given program + may not be able to actually open this many +A good number is 20, though some programs suggest/require +30, 40, or even 255 +e.g. files=20 + +INSTALL +INSTALLHIGH +Usage: install=[d:][path]file [options] +Load the program specified by d:path\file. Generally used to +load TSR (terminate and stay resident) programs with a minimal +environment block. The options are for the program itself; refer +to documentation that came with your particular software for +supported options and usage. +e.g. install=nansi.com + +LASTDRIVE +LASTDRIVEHIGH +Usage: lastdrive=x +where x is last drive letter available for use; A-Z +e.g. lastdrive=z + +NUMLOCK +Usage: numlock=on|off +Set the keyboard number lock to on or off. +e.g. numlock=off + +REM +Usage: rem Your remarks! +This provides the ability to place comments within the configuration +file. The text following the rem until the end of the line is +reached are ignored. This may also be used to temporarily disable +loading a particular device or other option. + +SCREEN +Usage: screen=xx +Switches into videomode xxx (INT10/11xx/000) +where xx should be 0x11 for 28 lines or 0x12 for 43/50 (EGA/VGA) lines + +SET +Usage: set ENVVAR=value +Sets the environment variable to provided value. +e.g. set HOME=C:\home\me + +SHELL +SHELLHIGH +Usage: shell=[d:][path]file [options] +Indicates the shell to use; often used to alter COMMAND.COM's behavior. +Note: it is command.com that processes AUTOEXEC.BAT; by using the +shell option, you can get command.com to process a differently named +file (such as FDAUTO.BAT for coexisting with another DOS using different +configuration options) or run a completely different command interpreter +such as 4DOS or a (unix) sh variant. +e.g. shell=C:\COMMAND.COM /E:256 /P + +STACKS +STACKSHIGH +Usage: stacks=nn,nnn +where nn is in range 0,8-64 and nnn is in range 32-512 +Changes number of stacks available +nn is number of different stacks and nnn is size in bytes of each one +e.g. stacks=16,256 + +SWITCHAR +Usage: switchar=c +Sets the default switchar to character c. Where c is a single character +that is used to indicate a command line parameter is an option switch. +The default is a forward slash (/). Note: This simply sets the value +returned by a get switchar query, it will not effect programs that use +hardcoded switch characters. +e.g. switchar=- + +VERSION +Usage: version=x.y +FreeDOS specific command to specify what DOS version to report. +e.g. version=6.2 -the following advanced config.sys processing options are available: +Advanced - FreeDOS specific CONFIG.SYS menu processing: +------------------------------------------------------- normal FILES=20 DEVICE=MyNetWorkDriver.sys '?' - ALWAYS ask if a single line shall be executed - FILES=20 ?DEVICE=MyNetWorkDriver.sys '!' - NEVER ask if a single line shall be executed, even if single stepping - !FILES=20 !DOS=HIGH,UMB !BUFFERS=30 DEVICE=MyNetWorkDriver.sys - configuration management - you may compose several configurations, using following special commands: @@ -66,8 +235,11 @@ MENUDEFAULT=0,1 ( configuration 0, wait 1 second) 2? device=MyNetworkDriver.SYS -Although this is definitively worse then MSDOS menuing possibilities, -IMHO it's better then nothing. +Although this is different than MSDOS menuing possibilities, it +allows for selecting from multiple options during bootup while +remaining simple. It, however, does not allow for multi-level +menuing based configuration schemes. + It's also possible to combine menu options, to avoid writing thing every time again. @@ -165,11 +337,7 @@ MENUDEFAULT=1,10 ( configuration 1, wait 10 seconds) 4? ECHO You selected menu #4 - - - - - 2002-11-28 - Tom Ehlert 2003-07-15 - Bernd Blaauw -2003-09-18 - Bart Oldeman \ No newline at end of file +2003-09-18 - Bart Oldeman +2004-07-24 - Jeremy Davis diff --git a/docs/contrib.txt b/docs/contrib.txt index f5fede2..6f446a5 100644 --- a/docs/contrib.txt +++ b/docs/contrib.txt @@ -1,13 +1,16 @@ These are the known contributors of the FreeDOS kernel. If you have contributed in any way to the kernel, but are not on this list, -please email me at bart@dosemu.org so I can add you to the list! +please email the current kernel maintainer so we can add you to the list! Thanks to all the following for contributing to the FreeDOS kernel: +Aitor Santamaria (aitor.sm@wanadoo.es) Arkady Belousov (ark@mos.ru) Bart Oldeman (bart@dosemu.org) +Bernd Blaauw (bblaauw@home.nl) Brian Reifsnyder (reifsnyderb@mindspring.com) Charles Dye (raster@highfiber.com) +Eduardo Casino (eduardo@terra.es) Eric Auer (eric@coli.uni-sb.de) Eric Biederman (ebiederm+eric@ccr.net) Eric Luttmann (ecl@users.sourceforge.net) diff --git a/docs/fdkernel.lsm b/docs/fdkernel.lsm index d9a21de..1c63a3f 100644 --- a/docs/fdkernel.lsm +++ b/docs/fdkernel.lsm @@ -1,11 +1,11 @@ Begin3 Title: The FreeDOS Kernel -Version: 2.0.35 -Entered-date: 30 May 2004 +Version: 2.0.35a +Entered-date: 12 Sept 2004 Description: The FreeDOS Kernel. Keywords: kernel freedos dos msdos Author: (developers) -Maintained-by: bartoldeman@users.sourceforge.net +Maintained-by: jeremyd@computer.org Primary-site: http://freedos.sourceforge.net Original-site: http://www.gcfl.net/pub/FreeDOS/kernel Platforms: dos dosemu diff --git a/docs/history.txt b/docs/history.txt index f028d19..1c2a152 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -1,3 +1,16 @@ +2004 Sept ?? - Build 2035a +-------- Jeremy Davis (jeremyd@computer.org) ++ Changes Bart + * int2f.asm: call_nls: DI register was not preserved (bug 1812) ++ Changes Arkady + * floppy.asm: fix epilog for FL_SETMEDIATYPE & FL_SETDISKTYPE + to use 'ret' instead of 'ret 8'; improve comments + * entry.asm: use unsigned comparision instead of signed ++ Changes Lucho + * dsk.c: text in play_dj + * fatfs.c: + - zero creation/access stamp on directory entry write as MS-DOS 7.10 + - prevent removal or renaming of the current directory of that drive 2004 May 30 - Build 2035 -------- Bart Oldeman (bart@dosemu.org) + Changes Lucho + Tom diff --git a/hdr/device.h b/hdr/device.h index a01bae5..11b6d7c 100644 --- a/hdr/device.h +++ b/hdr/device.h @@ -374,7 +374,8 @@ typedef struct { struct { UBYTE _r_cat; /* Category code */ UBYTE _r_fun; /* Function code */ - UBYTE unused[4]; /* SI or DI contents or DS:reqhdr */ + UWORD _r_si; /* Contents of SI and DI */ + UWORD _r_di; /* (PC DOS 7 Technical Update, pp 104,105) */ union { struct gblkio FAR *_r_io; @@ -424,6 +425,8 @@ typedef struct { /* generic IOCTL and IOCTL query macros */ #define r_cat _r_x._r_gen._r_cat #define r_fun _r_x._r_gen._r_fun +#define r_si _r_x._r_gen._r_si +#define r_di _r_x._r_gen._r_di #define r_rw _r_x._r_gen._r_par._r_rw #define r_io _r_x._r_gen._r_par._r_io #define r_fv _r_x._r_gen._r_par._r_fv diff --git a/hdr/portab.h b/hdr/portab.h index 78bb79f..7d6a1f0 100644 --- a/hdr/portab.h +++ b/hdr/portab.h @@ -119,6 +119,10 @@ unsigned short getCS(void); #define _SS getSS() unsigned short getSS(void); #pragma aux getSS = "mov dx,ss" value [dx] modify exact[dx]; +#if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300 +#pragma aux default parm [ax dx cx] modify [ax dx es fs] /* min.unpacked size */ +#endif + /* enable Possible loss of precision warning for compatibility with Borland */ #pragma enable_message(130) diff --git a/kernel/asmsupt.asm b/kernel/asmsupt.asm index 92286b3..ab53290 100644 --- a/kernel/asmsupt.asm +++ b/kernel/asmsupt.asm @@ -416,13 +416,9 @@ FMEMCHR: mov ax, di jmp short strchr_found1 -%endif - ;********************************************************************** -%if 0 -nix pascal - still untested - global _fstrcmp -_fstrcmp: + global FSTRCMP +FSTRCMP: call pascal_setup ; Get the source pointer, ss diff --git a/kernel/entry.asm b/kernel/entry.asm index d0610fd..f7fe4c5 100644 --- a/kernel/entry.asm +++ b/kernel/entry.asm @@ -314,7 +314,7 @@ int21_2: inc byte [_InDOS] or ah,ah jz int21_3 cmp ah,0ch - jle int21_normalentry + jbe int21_normalentry int21_3: call dos_crit_sect diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 764666a..59608bd 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -107,27 +107,20 @@ struct dpb FAR *get_dpb(COUNT dsk) return cdsp->cdsDpb; } -/* initialize all direntry fields except for the name */ +/* initialize directory entry (creation/access stamps 0 as per MS-DOS 7.10) */ STATIC void init_direntry(struct dirent *dentry, unsigned attrib, - CLUSTER cluster) + CLUSTER cluster, char *name) { - struct dostime dt; - dentry->dir_size = 0l; + memset(dentry, 0, sizeof(struct dirent)); + memcpy(dentry->dir_name, name, FNAME_SIZE + FEXT_SIZE); #ifdef WITHFAT32 dentry->dir_start_high = (UWORD)(cluster >> 16); -#else - dentry->dir_start_high = 0; #endif dentry->dir_start = (UWORD)cluster; - dentry->dir_attrib = attrib; - dentry->dir_case = 0; - DosGetTime(&dt); - dentry->dir_crtimems = dt.hundredth; - if (dt.second & 1) - dentry->dir_crtimems += 100; - dentry->dir_time = dentry->dir_crtime = time_encode(&dt); - dentry->dir_date = dentry->dir_crdate = dentry->dir_accdate = dos_getdate(); + dentry->dir_attrib = (UBYTE)attrib; + dentry->dir_time = dos_gettime(); + dentry->dir_date = dos_getdate(); } /************************************************************************/ @@ -154,7 +147,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib) if ((flags & O_ACCMODE) > 2) return DE_INVLDACC; - /* first split the passed dir into comopnents (i.e. - path to */ + /* next split the passed dir into comopnents (i.e. - path to */ /* new directory and name of new directory. */ if ((fnp = split_path(path, fcbname)) == NULL) return DE_PATHNOTFND; @@ -206,9 +199,6 @@ long dos_open(char *path, unsigned flags, unsigned attrib) int ret = alloc_find_free(fnp, path, fcbname); if (ret != SUCCESS) return ret; - - /* put the fnode's name into the directory. */ - memcpy(fnp->f_dir.dir_name, fcbname, FNAME_SIZE + FEXT_SIZE); status = S_CREATED; } else @@ -225,7 +215,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib) if (status != S_OPENED) { - init_direntry(&fnp->f_dir, attrib, FREE); + init_direntry(&fnp->f_dir, attrib, FREE, fcbname); fnp->f_flags = F_DMOD | F_DDIR; if (!dir_write(fnp)) { @@ -584,7 +574,12 @@ COUNT dos_rmdir(BYTE * path) BOOL found; char fcbname[FNAME_SIZE + FEXT_SIZE]; - /* first split the passed dir into comopnents (i.e. - */ + /* prevent removal of the current directory of that drive */ + register struct cds FAR *cdsp = get_cds(path[0] - 'A'); + if (!fstrcmp(path, cdsp->cdsCurrentPath)) + return DE_RMVCUDIR; + + /* next, split the passed dir into components (i.e. - */ /* path to new directory and name of new directory */ if ((fnp = split_path(path, fcbname)) == NULL) { @@ -598,24 +593,20 @@ COUNT dos_rmdir(BYTE * path) return DE_ACCESS; } - /* Check that we don't have a duplicate name, so if we */ - /* find one, it's an error. */ + /* Verify name exists, and if so then ensure it refers */ + /* to a directory and directory is empty. */ if (find_fname(fnp, fcbname, D_ALL)) { - /* The only permissable attribute is directory, */ - /* check for any other bit set. If it is, give */ - /* an access error. */ - /* if (fnp->f_dir.dir_attrib & ~D_DIR) */ - - /* directories may have attributes, too. at least my WinNT disk - has many 'archive' directories - we still don't allow RDONLY directories to be deleted TE */ - -/* if (fnp->f_dir.dir_attrib & ~(D_DIR |D_HIDDEN|D_ARCHIVE|D_SYSTEM)) + /* Check if it's really a directory, directories may + have attributes, but if other than 'archive' then do not + allow (RDONLY|SYSTEM|HIDDEN) directory to be deleted. + */ + if ( !(fnp->f_dir.dir_attrib & D_DIR) || + (fnp->f_dir.dir_attrib & ~(D_DIR |D_ARCHIVE)) ) { dir_close(fnp); return DE_ACCESS; - } */ + } /* Check that the directory is empty. Only the */ /* "." and ".." are permissable. */ @@ -628,7 +619,8 @@ COUNT dos_rmdir(BYTE * path) } dir_read(fnp1); - if (fnp1->f_dir.dir_name[0] != '.') + /* 1st entry should be ".", else directory corrupt or not empty */ + if (fnp1->f_dir.dir_name[0] != '.' || fnp1->f_dir.dir_name[1] != ' ') { dir_close(fnp); return DE_ACCESS; @@ -636,7 +628,8 @@ COUNT dos_rmdir(BYTE * path) fnp1->f_diroff++; dir_read(fnp1); - if (fnp1->f_dir.dir_name[0] != '.') + /* secondard entry should be ".." */ + if (fnp1->f_dir.dir_name[0] != '.' || fnp1->f_dir.dir_name[1] != '.') { dir_close(fnp); return DE_ACCESS; @@ -683,6 +676,11 @@ COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib) COUNT ret; char fcbname[FNAME_SIZE + FEXT_SIZE]; + /* prevent renaming of the current directory of that drive */ + register struct cds FAR *cdsp = get_cds(path1[0] - 'A'); + if (!fstrcmp(path1, cdsp->cdsCurrentPath)) + return DE_RMVCUDIR; + /* first split the passed target into compnents (i.e. - path to */ /* new file name and name of new file name */ if ((fnp2 = split_path(path2, fcbname)) == NULL) @@ -723,19 +721,12 @@ COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib) if ((ret = remove_lfn_entries(fnp1)) < 0) return ret; + /* init fnode for new file name to match old file name */ + memcpy(&fnp2->f_dir, &fnp1->f_dir, sizeof(struct dirent)); + /* put the fnode's name into the directory. */ memcpy(fnp2->f_dir.dir_name, fcbname, FNAME_SIZE + FEXT_SIZE); - /* Set the fnode to the desired mode */ - fnp2->f_dir.dir_size = fnp1->f_dir.dir_size; - fnp2->f_dir.dir_start = fnp1->f_dir.dir_start; -#ifdef WITHFAT32 - fnp2->f_dir.dir_start_high = fnp1->f_dir.dir_start_high; -#endif - fnp2->f_dir.dir_attrib = fnp1->f_dir.dir_attrib; - fnp2->f_dir.dir_time = fnp1->f_dir.dir_time; - fnp2->f_dir.dir_date = fnp1->f_dir.dir_date; - /* The directory has been modified, so set the bit before */ /* closing it, allowing it to be updated. */ fnp1->f_flags = fnp2->f_flags = F_DMOD | F_DDIR; @@ -798,10 +789,8 @@ STATIC VOID wipe_out_clusters(struct dpb FAR * dpbp, CLUSTER st) /* */ STATIC VOID wipe_out(f_node_ptr fnp) { - /* if already free or not valid file, just exit */ - if ((fnp == NULL) || checkdstart(fnp->f_dpb, &fnp->f_dir, FREE)) - return; - + /* if not already free and valid file, do it */ + if (fnp && !checkdstart(fnp->f_dpb, &fnp->f_dir, FREE)) wipe_out_clusters(fnp->f_dpb, getdstart(fnp->f_dpb, &fnp->f_dir)); } @@ -1105,13 +1094,10 @@ COUNT dos_mkdir(BYTE * dir) return DE_HNDLDSKFULL; } - /* put the fnode's name into the directory. */ - memcpy(fnp->f_dir.dir_name, fcbname, FNAME_SIZE + FEXT_SIZE); - /* Set the fnode to the desired mode */ fnp->f_mode = WRONLY; - init_direntry(&fnp->f_dir, D_DIR, free_fat); + init_direntry(&fnp->f_dir, D_DIR, free_fat, fcbname); fnp->f_flags = F_DMOD | F_DDIR; @@ -1135,9 +1121,7 @@ COUNT dos_mkdir(BYTE * dir) } /* Create the "." entry */ - DirEntBuffer.dir_name[0] = '.'; - memset(DirEntBuffer.dir_name + 1, ' ', FNAME_SIZE + FEXT_SIZE - 1); - init_direntry(&DirEntBuffer, D_DIR, free_fat); + init_direntry(&DirEntBuffer, D_DIR, free_fat, ". "); /* And put it out */ putdirent(&DirEntBuffer, bp->b_buffer); @@ -1986,6 +1970,7 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp) /* set attributes that user requested */ fnp->f_dir.dir_attrib |= attrp; /* JPP */ fnp->f_flags |= F_DMOD | F_DDATE; + merge_file_changes(fnp, FALSE); save_far_f_node(fnp); dos_close(fd); return SUCCESS; @@ -2135,7 +2120,7 @@ COUNT media_check(REG struct dpb FAR * dpbp) /* If it definitely changed, don't know (falls through) */ /* or has been changed, rebuild the bpb. */ - case M_CHANGED: + /* case M_CHANGED: */ default: setinvld(dpbp->dpb_unit); ret = rqblockio(C_BLDBPB, dpbp);