diff --git a/boot/boot.asm b/boot/boot.asm index a7c88a6c..6b39d057 100644 --- a/boot/boot.asm +++ b/boot/boot.asm @@ -397,7 +397,7 @@ read_next: ;******************** LBA_READ ******************************* ; check for LBA support - + mov ah,041h ; mov bx,055aah ; mov dl, [drive] @@ -414,22 +414,22 @@ read_next: sbb bx,0aa55h - 1 ; tests for carry (from shr) too! jne read_normal_BIOS - - + + ; OK, drive seems to support LBA addressing lea si,[LBA_PACKET] - - ; setup LBA disk block + + ; setup LBA disk block mov LBA_SECTOR_32,bx ; bx is 0 if extended 13h mode supported mov LBA_SECTOR_48,bx - + mov ah,042h jmp short do_int13_read - -read_normal_BIOS: + +read_normal_BIOS: ;******************** END OF LBA_READ ************************ mov cx,LBA_SECTOR_0 @@ -473,12 +473,12 @@ read_normal_BIOS: les bx,[LBA_OFF] mov ax, 0x0201 -do_int13_read: +do_int13_read: mov dl, [drive] int 0x13 jc boot_error ; exit on error - mov ax, word [bsBytesPerSec] + mov ax, word [bsBytesPerSec] push di mov si,READBUF ; copy read in sector data to diff --git a/boot/boot32.asm b/boot/boot32.asm index 8ac4f3c6..7ac5c2f8 100644 --- a/boot/boot32.asm +++ b/boot/boot32.asm @@ -61,7 +61,7 @@ Entry: jmp short real_start %define LOADSEG 0x0060 -%define FATSEG 0x2000 +%define FATSEG 0x2000 %define fat_sector bp+0x48 ; last accessed sector of the FAT @@ -141,7 +141,7 @@ secshift: inc ax jne secshift mov byte [fat_secshift], al dec cx - + ; FINDFILE: Searches for the file in the root directory. ; ; Returns: @@ -157,7 +157,7 @@ ff_next_cluster: push ax call convert_cluster jc boot_error ; EOC encountered - + ff_next_sector: push bx ; save sector count @@ -189,11 +189,11 @@ ff_find_next_cluster: call next_cluster jmp short ff_next_cluster ff_done: - + mov ax, [es:di+0x1A-11] ; get cluster number mov dx, [es:di+0x14-11] c4: - sub bx, bx ; ES points to LOADSEG + sub bx, bx ; ES points to LOADSEG c5: push dx push ax push bx @@ -209,24 +209,24 @@ c6: pop dx call next_cluster jmp short c5 - + boot_error: xor ah,ah int 0x16 ; wait for a key int 0x19 ; reboot the machine -; input: +; input: ; DX:AX - cluster ; output: ; DX:AX - next cluster ; CX = 0 ; modify: ; DI -next_cluster: +next_cluster: push es mov di, ax and di, [fat_secmask] - + mov cx, [fat_secshift] cn_loop: shr dx,1 @@ -236,7 +236,7 @@ cn_loop: ; cluster resides ; DI - cluster index in this ; sector - + shl di,1 ; DI - offset in the sector shl di,1 add ax, [fat_start] @@ -264,7 +264,7 @@ cn_exit: ret -boot_success: +boot_success: mov bl, [drive] jmp far [loadsegoff_60] @@ -302,7 +302,7 @@ c3: ; prints text after call to this function. -print_1char: +print_1char: xor bx, bx ; video page 0 mov ah, 0x0E ; else print it int 0x10 ; via TTY mode @@ -312,7 +312,7 @@ print1: lodsb ; get token cmp al, 0 ; end of string? jne print_1char ; until done ret ; and jump to it - + ;input: ; DX:AX - 32-bit DOS sector number ; ES:BX - destination buffer @@ -366,7 +366,7 @@ read_next: push dx int 0x13 pop ax - pop dx + pop dx jnc read_ok ; jump if no error xor ah, ah ; else, reset floppy int 0x13 diff --git a/boot/boot32lb.asm b/boot/boot32lb.asm index aa1631bd..e1fb682c 100644 --- a/boot/boot32lb.asm +++ b/boot/boot32lb.asm @@ -180,7 +180,7 @@ ff_next_clust: push eax ; save cluster call convert_cluster jc boot_error ; EOC encountered ; EDX is clust/sector, EAX is sector - + ff_next_sector: les bx, [loadsegoff_60] ; load to loadseg:0 call readDisk ;--- push eax ; save sector @@ -231,7 +231,7 @@ rk_in_cluster: call readDisk rk_walk_fat: pop eax call next_cluster jmp read_kernel - + ;----------------------------------------------------------------------- boot_success: mov bl, [drive] @@ -360,7 +360,7 @@ read_next: push eax ; would ax be enough? mov si, sp mov dl, [drive] mov ah, 42h ; disk read - int 0x13 + int 0x13 mov sp, di ; remove parameter block from stack ; (without changing flags!) diff --git a/boot/oemboot.asm b/boot/oemboot.asm index a57bdbcc..ce94797a 100644 --- a/boot/oemboot.asm +++ b/boot/oemboot.asm @@ -99,7 +99,7 @@ ; |LBA PKT | ; |--------| 0000:7E00 (0:BP+200) ; |BOOT SEC| contains BPB -; |ORIGIN | +; |ORIGIN | ; |--------| 0000:7C00 (0:BP) ; |VARS | only known is 1st data sector (start of cluster 2) ; |--------| 0000:7BFC (DS:[BP-4]) @@ -128,7 +128,7 @@ CPU 8086 ; enable assembler warnings to limit instruction set ;%define WINBOOT 1 ; use win9x kernel calling conventions (name & jmp addr) ;%define MSCOMPAT 1 ; sets default filename to MSDOS IO.SYS -%ifdef WINBOOT ; if set also change from PC-DOS to +%ifdef WINBOOT ; if set also change from PC-DOS to %ifndef MSCOMPAT ; kernel name to MS-DOS kernel name %define MSCOMPAT %endif @@ -452,13 +452,13 @@ cluster_next: lodsw ; AX = next cluster to read mov di, [first_cluster] ; set di (si:di on FAT32) to starting cluster # %ifdef WINBOOT jmp LOADSEG:0x0200 ; yes, pass control to kernel -%else +%else jmp LOADSEG:0000 ; yes, pass control to kernel %endif ; failed to boot -boot_error: +boot_error: call show ; db "Error! Hit a key to reboot." db "):." @@ -530,7 +530,7 @@ read_next: ;******************** LBA_READ ******************************* ; check for LBA support - + %ifdef TRYLBAREAD mov ah,041h ; mov bx,055aah ; @@ -550,15 +550,15 @@ read_next: ; setup LBA disk block mov LBA_SECTOR_32,bx ; bx is 0 if extended 13h mode supported mov LBA_SECTOR_48,bx - + mov ah,042h jmp short do_int13_read %endif - -read_normal_BIOS: + +read_normal_BIOS: ;******************** END OF LBA_READ ************************ mov cx, LBA_SECTOR_0 @@ -600,7 +600,7 @@ read_normal_BIOS: les bx,[LBA_OFF] mov ax, 0x0201 -do_int13_read: +do_int13_read: mov dl, [drive] int 0x13 @@ -616,7 +616,7 @@ read_next_chained: %endif read_ok: - mov ax, word [bsBytesPerSec] + mov ax, word [bsBytesPerSec] mov cl, 4 ; adjust segment pointer by increasing shr ax, cl add word [LBA_SEG], ax ; by paragraphs read in (per sector) diff --git a/docs/config.txt b/docs/config.txt index cff3423c..84f5441b 100644 --- a/docs/config.txt +++ b/docs/config.txt @@ -78,7 +78,7 @@ 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). +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. @@ -91,7 +91,7 @@ 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. +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 @@ -111,7 +111,7 @@ 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). -Example: +Example: ECHO loading driver 1 device=Driver1.sys ECHO driver1 successfully loaded @@ -135,7 +135,7 @@ Example: fcbs=4 FILES FILESHIGH -Usage: files=nnn +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). @@ -186,7 +186,7 @@ A reasonably safe choice should be "keybuf=0x140,0x1c0". LASTDRIVE LASTDRIVEHIGH -Usage: lastdrive=x +Usage: lastdrive=x where x is last drive letter available for use; A-Z Example: lastdrive=z @@ -213,7 +213,7 @@ Example: MENUCOLOR Usage: menucolor foreground[,background] -Use Menucolor before the menu config command, to create a +Use Menucolor before the menu config command, to create a full screen menu which supports the arrow cursor keys. The following colors can be used for foreground and background: 0=Black; 1=Blue; 2=Green; 3=Cyan; 4=Red; 5=Magenta; @@ -225,7 +225,7 @@ If you do not use MENUCOLOR, the menu will not be full screen, so some of the BIOS, bootloader and kernel init messages (list of drives, version info...) stays visible. To change the colour to white text on blue, use the following: -Example: menucolor 15,1 +Example: menucolor 15,1 MENUDEFAULT Usage: menudefault=defaultoption,delay @@ -305,12 +305,12 @@ Example: switchar=- SWITCHES Usage: switches=/E[:xxx] /F /K /N /W Adjusts boot time processing behaviour. -/E specifies how to handle moving of EBDA (Extended BIOS Data Area), +/E specifies how to handle moving of EBDA (Extended BIOS Data Area), if a size in bytes is specified [xxx, in range of 48-1024] then the EBDA will be moved from the top of conventional memory to a lower address (allowing for potentially larger free block of conventional memory if video memory at A0000 is available). - without a size, the EBDA will not be moved + without a size, the EBDA will not be moved /F skips the delay checking for F5/F8 keystroke before processing config.sys [equivalent to SYS CONFIG skipconfigseconds=0] F5 and F8 are only processed if pressed before DOS boots but @@ -326,7 +326,7 @@ Adjusts boot time processing behaviour. /W is NOT supported in FreeDOS. This option in MS DOS would set a flag for Windows 3.0 to skip loading wina20.386 from the root directory, used when \WINA20.386 is moved into a subdirectory, a device line - with proper path must be added to Microsoft (R) Windows SYSTEM.INI + with proper path must be added to Microsoft (R) Windows SYSTEM.INI [386Enhanced] section. --- may be ignored for compatibility VERSION @@ -379,13 +379,13 @@ rem NETWORK rem Menu items can only be selected if at least one line uses them: 3? echo Basic configuration selected -Although this is different than MSDOS menuing possibilities, it +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 +It's also possible to combine menu options, to avoid writing thing every time again. constructions like 0?devicehigh?=cdrom.sys are also possible ("if menu option 0 chosen, ask if you want to load this driver") @@ -469,7 +469,7 @@ MENU MENUDEFAULT=1,10 ( configuration 1, wait 10 seconds) REM 1st choice -1?ECHO You selected menu #1 +1?ECHO You selected menu #1 REM 2nd choice 2?ECHO You selected menu #2 diff --git a/docs/history.txt b/docs/history.txt index 4f7bc979..768be481 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -20,25 +20,25 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. * ensure top of RAM correctly adjusted after moving EBDA * fix reading from NULL * merge creation date & time from old dev branch - * use absolute not relative disk read/writes + * use absolute not relative disk read/writes (allows syslinux DOS installer to work correctly) * Fix FCB parse filename (int21h func 29h) * Improve support for older BPB based volumes lacking extended fields. (Based on lpproj's nec98:Fix for DOS 3.x partitions) * Int 2F/AX=120Ah & AX=120Bh based on RBIL, untested - + + Changes Sava (lpproj) * add cross-compile capability on Windows with OW and mingw32-make * Fix pointer of DBCS table (int 0x21, func 0x6300) * Enable to load DBCS table from COUNTRY.SYS * Return current country code (func 0x38) * Fix broken decompression on loading FAT16 kernel (compressed in dos/sys) - * On creating child PSP (func 0x55), copy command line parameters + * On creating child PSP (func 0x55), copy command line parameters from the parent (required for some device loaders) * Fix incomplete loading of huge (more than 65280 bytes) binary device driver - * Fix an error at opening a character device prefixed with invalid + * Fix an error at opening a character device prefixed with invalid drive letter (e.g. "@:NUL") - * Copy FCB-format filename from PriPathName (some redirectors require + * Copy FCB-format filename from PriPathName (some redirectors require FCB-format filename stored in SDA+22Bh DirEntBuffer) 2012 Feb 07 - Build 2041 @@ -47,9 +47,9 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. + Changes Jeremy * r1637 fix out of range byte in country.asm * r1685 add int 2f subfunc 122B and 122D from Eduardo Casino - * r1697 from Pete Batard, do not display CHS mismatch warning + * r1697 from Pete Batard, do not display CHS mismatch warning during booting when forcing LBA mode option set - * r1702 improve handling for sectors not 512 bytes in size + * r1702 improve handling for sectors not 512 bytes in size (up to 2048 bytes, larger sizes not yet working) * r1705 add cpu detection so memdisk args supported in 8086 build @@ -162,11 +162,11 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. release kernels + Changes Bart - * r1491 hdr/debug.h, kernel/{init-mod.h,kernel/int2f.asm,nls.c,prf.c, + * r1491 hdr/debug.h, kernel/{init-mod.h,kernel/int2f.asm,nls.c,prf.c, proto.h}, sys/{fdkrncfg.c,sys.c}: Use near pointers for printf()s - where possible. Problematic is only the case where SS!=DS (which + where possible. Problematic is only the case where SS!=DS (which happens sometimes in resident code), in which case va_list/va_arg - need to use FAR pointers. DS!=DGROUP never works, so I corrected + need to use FAR pointers. DS!=DGROUP never works, so I corrected that for NLS_DEBUG, by setting DS in int2f.asm. * r1490 kernel/fatfs.c: Check the BPB instead of the DPB for FAT32 after a BUILDBPB device call, as the DPB may still be uninitialized @@ -192,7 +192,7 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. optimization (200 bytes). * r1473 kernel{fatdir.c,fatfs.c,newstuff.c}: If the current directory is no longer valid, call dos_cd() for the root to update the CDS - cluster. Call media_check explicitly in truename() as a central + cluster. Call media_check explicitly in truename() as a central first and only place in directory-using DOS calls (except DosFindNext) to call it. * r1472 kernel/{dosfns.c,newstuff.c}: The original DosGetCuDir @@ -221,7 +221,7 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. * r1452 kernel/initdisk.c: Use a better formula for calculating FAT12 clusters, by multiplying nominator and denominator by 3. * r1451 kernel/{fatfs.c, initdisk.c}: initdisk: further optimizations - in CalculateFATData(): merging the FAT16 & FAT32 loops. + in CalculateFATData(): merging the FAT16 & FAT32 loops. fatfs: #if DEBUG fix. * r1450 kernel/initdisk.c: Optimized initdisk.c by using constants instead of variables where possible. @@ -248,7 +248,7 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. can be expanded as a shell variable when passed to system(). * r1442 kernel/{dosnames.c, fatfs.c, makefile, proto.h}: Remove dosnames.c and inline ParseDosName, because there is only one - user left (split_path()) which only uses it to find out if the path + user left (split_path()) which only uses it to find out if the path ends in a backslash and the length of the directory part. * r1441 kernel/{dosnames.c, fatdir.c, fatfs.c, proto.h}: dos_findfirst() now uses split_path(). The only thing @@ -284,10 +284,10 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. into a new ConvertNameSZToName83 function, also used by dir_open(). * r1432 hdr/fnode.h, kernel/{fatdir.c, fatfs.c, globals.h, init-mod.h, kernel.asm}: - Move the fnode fields f_diroff and f_dirstart into a referenced + Move the fnode fields f_diroff and f_dirstart into a referenced directory match structure with fields dm_entry and dm_dircluster. * r1430 hdr/nls.h, kernel/{config.c, init-mod.h, inthndlr.c, intr.asm, - kernel/nls.c, kernel/nls_hc.asm, kernel/proto.h}: + kernel/nls.c, kernel/nls_hc.asm, kernel/proto.h}: Ported COUNTRY.SYS support from the unstable branch. Simple country support is kept: COUNTRY=31 will look for country.sys but if it does not exist, not complain and load the built-in info. @@ -404,14 +404,14 @@ Changelog items can list SVN revision rNUMBER and bugzilla bug NUMBER. containing dentry) and f_diridx (index within sector) fields to the fnode, to make fnodes more compatible with SFTs. Use them to simplify dir_read() and dir_write(). - * r1389 kernel/{fatdir.c, fatfs.c, globals.h, inthndlr.c, lfnapi.c, - proto.h}: Force near fnode use to use either fnode[0] or fnode[1] + * r1389 kernel/{fatdir.c, fatfs.c, globals.h, inthndlr.c, lfnapi.c, + proto.h}: Force near fnode use to use either fnode[0] or fnode[1] instead of the allocation scheme. This eliminates the checks done in inthndlr.c because the f_count field is no longer checked. * r1388 makefile, mkfiles/owlinux.mak: Change Linux makefiles to only update what is necessary for subsequent makes. * r1387 config.m, docs/build.txt, drivers/makefile, kernel/{makefile, - segs.inc}, makefile, mkfiles/{generic.mak, owlinux.mak, watcom.mak}, + segs.inc}, makefile, mkfiles/{generic.mak, owlinux.mak, watcom.mak}, sys/makefile, utils/{exeflat.c, makefile}: Add Linux cross-compile capability, using Open Watcom: * Flip \ to / where possible. @@ -438,7 +438,7 @@ Patches are mostly from Bart and Eric, some from Jeremy and Tom. http://sf.net/tracker/?func=detail&aid=2253450&group_id=5109&atid=355109 * r1379 dosfns.c fatfs.c proto.h from Eric: only check for SHARE on open/close, avoid extra 2f.1000 calls. - * r1378 dsk.c from Lucho: Press any key, not Press the any key ;-) + * r1378 dsk.c from Lucho: Press any key, not Press the any key ;-) * r1377 initdisk.c from RayeR: Use total cyl count, not max cylinder (fixes off by one bug on non-LBA PC) & fix overflow by ULONG cast. Improve DebugPrintf calls, fix format string (only in debug kernels) @@ -1756,7 +1756,7 @@ Most recent changes to source code (see version.h) are: asks for this single line fill the available HMA with buffers * added kernel configuration options to sys.com, small area at 60:xx - (in cooperation with Jeremy) + (in cooperation with Jeremy) * readblock optimized to read as many data as possible in one int13 request - great speedups for large reads * some more SDA variables need to be updated for the network @@ -1876,7 +1876,7 @@ Most recent changes to source code (see version.h) are: Ctrl-Q is ignored by DOS. * FCB "closing twice is legal" fix. Necessary for visicalc. + fixes Bart + Tom - * fixed shsucdx /u unloading problem + * fixed shsucdx /u unloading problem 2001 Jul 28 - Build 2024/f @@ -2214,7 +2214,7 @@ from 2001 May 21: Build2024L as .com in the hope that we can make it a real .com again. DeviceHigh loads low if there are not enough UMB's available. Fixed another redirector problem. -+ Update Optimized asmsupt.asm a bit with help of the glibc 2.2 source. ++ Update Optimized asmsupt.asm a bit with help of the glibc 2.2 source. + Fixes Tom Ehlert and Brian Reifsnyder: fix partition detection in dsk.c + other bug fixes (also: floppy.asm). + Update Tom Ehlert optimized blockio.c. diff --git a/docs/memdisk.txt b/docs/memdisk.txt index 2e9a0fcc..4a190f1d 100644 --- a/docs/memdisk.txt +++ b/docs/memdisk.txt @@ -19,22 +19,22 @@ FreeDOS config lines are denoted by surrounding the line in curly braces {} thus allowing multiple simulated lines on a single APPEND line. However, the closing brace } may be omitted if it would be immediately followed by an opening brace { or end of the APPEND line. Anything on the memdisk line -outside of the curly braces {} is ignored. The lines may be preceeded by +outside of the curly braces {} is ignored. The lines may be preceeded by FD= to be compatible with earlier FD kernel release or any other key= to specify the environment variable generated by getargs utility. All simulated -config lines (text between the { and }) are evaluated by the kernel asis -except the final line (the line within final {}). +config lines (text between the { and }) are evaluated by the kernel asis +except the final line (the line within final {}). -The final } is optional which results in the memdisk options initrd= and +The final } is optional which results in the memdisk options initrd= and BOOT_IMAGE= to appear as part of the config.sys line. To avoid issues -several memdisk options are ignored if after the last opening brace {. +several memdisk options are ignored if after the last opening brace {. Note that the syslinux/memdisk options are case sensitive. Currently ignored options are: initrd, BOOT_IMAGE, floppy, harddisk, and iso. Additionally, to simplify passing and overriding arguments when syslinux is booting, any key=value pairs seen after any memdisk options will cause all corresponding key=??? prior to any memdisk options to be cleared on -the resulting config line. +the resulting config line. For example if the final assembled memdisk line appears to the kernel as: {ECHO HI{ECHO X=1 X=2 Y=1 Z=1 initrd=FDSTD10.img BOOT_IMAGE=memdisk X=386 then the following two lines will evaluated by the kernel after processing diff --git a/docs/sys.txt b/docs/sys.txt index 38b808e2..6624ad65 100644 --- a/docs/sys.txt +++ b/docs/sys.txt @@ -73,7 +73,7 @@ KERNEL.SYS & COMMAND.COM and if not found then the root directory of the specified drive is tried. Alternatively, you may specify a path (either fully qualified or relative) to where KERNEL.SYS and -COMMAND.COM may be found; note that this should +COMMAND.COM may be found; note that this should only search this directory and will fail if they are not found, ie it will not check for them on the root directory of the drive specified when @@ -160,8 +160,8 @@ This option is for specifying whether Drive Letter Assignment should follow the normal MSDOS way of all primary partitions across drives and then extended partitions, or the more logical -all partitions (primary & extended) on the 1st -drive, then repeat for all following drives +all partitions (primary & extended) on the 1st +drive, then repeat for all following drives (all primary & extended, then try next drive). 0 corresponds to MS way and 1 corresponds to first drive completely, then next ... @@ -191,7 +191,7 @@ techniques to address all partitions if possible, even if these have a non-LBA partition type and are completely below cylinder 1023 (usually the 8GB boundary). This is 0 by default, for compatibility -reasons. Setting this to 1 may bypass some buggy +reasons. Setting this to 1 may bypass some buggy BIOSes and gives slightly better performance. GLOBALENABLELBASUPPORT which maybe 0 or 1 diff --git a/drivers/floppy.asm b/drivers/floppy.asm index e9550f04..acd00179 100644 --- a/drivers/floppy.asm +++ b/drivers/floppy.asm @@ -98,23 +98,23 @@ FL_FORMAT: FL_READ: mov ah,2 ; read sector(s) jmp short fl_common - + global FL_VERIFY FL_VERIFY: mov ah,4 ; verify sector(s) jmp short fl_common - + global FL_WRITE FL_WRITE: mov ah,3 ; write sector(s) -fl_common: +fl_common: push bp ; setup stack frame mov bp,sp mov cx,[bp+0Ch] ; cylinder number - mov al,1 ; this should be an error code + mov al,1 ; this should be an error code cmp ch,3 ; this code can't write above 3FFh=1023 ja fl_error ; as cylinder # is limited to 10 bits. @@ -148,7 +148,7 @@ fl_error: FL_LBA_READWRITE: push bp ; setup stack frame mov bp,sp - + push ds push si ; wasn't in kernel < KE2024Bo6!! @@ -156,14 +156,14 @@ FL_LBA_READWRITE: mov ax,[bp+8] ; get the command lds si,[bp+4] ; get far dap pointer int 13h ; read from/write to drive - + pop si pop ds pop bp mov al,ah ; place any error code into al - mov ah,0 ; zero out ah + mov ah,0 ; zero out ah ret 8 ; @@ -189,9 +189,9 @@ FL_SETDISKTYPE: int 13h ret_AH: mov al,ah ; place any error code into al - mov ah,0 ; zero out ah + mov ah,0 ; zero out ah ret - + ; ; COUNT ASMPASCAL fl_setmediatype (WORD drive, WORD tracks, WORD sectors); ; @@ -206,10 +206,10 @@ FL_SETMEDIATYPE: dec cx ; number of cylinders - 1 (last cyl number) xchg ch,cl ; CH=low 8 bits of last cyl number - + ror cl,1 ; extract bits 8-9 of cylinder number... ror cl,1 ; ...into cl bit 6-7 - + or cl,bl ; sectors/track (bits 0-5) or'd with high cyl bits 7-6 mov ah,18h ; disk set media type for format @@ -223,7 +223,7 @@ FL_SETMEDIATYPE: pop word [es:0x1e*4+2] ; set int 0x1e table to es:di mov [es:0x1e*4 ], di sti -skipint1e: +skipint1e: pop di jmp short ret_AH - + diff --git a/hdr/cds.h b/hdr/cds.h index 1618b4a9..009e783d 100644 --- a/hdr/cds.h +++ b/hdr/cds.h @@ -37,7 +37,7 @@ struct cds { union { BYTE FAR *_cdsRedirRec; /* IFS record */ struct { - UWORD _cdsStrtClst; /* if local path (Flags & CDSPHYSDRV): + UWORD _cdsStrtClst; /* if local path (Flags & CDSPHYSDRV): start cluster of CWD; root == 0, never access == 0xFFFF */ UWORD _cdsParam; @@ -79,7 +79,7 @@ struct cds { 1 1 installable file system (IFS) */ #define CDSMODEMASK (CDSNETWDRV | CDSPHYSDRV) - + /* #define CDSVALID (CDSNETWDRV | CDSPHYSDRV) */ #define CDSVALID CDSMODEMASK diff --git a/hdr/fnode.h b/hdr/fnode.h index 1e2face8..2171e592 100644 --- a/hdr/fnode.h +++ b/hdr/fnode.h @@ -61,5 +61,5 @@ struct lfn_inode { struct dirent l_dir; /* Directory entry image */ UWORD l_diroff; /* Current directory entry offset */ }; - + typedef struct lfn_inode FAR * lfn_inode_ptr; diff --git a/hdr/kconfig.h b/hdr/kconfig.h index 74ac6834..cd026ff1 100644 --- a/hdr/kconfig.h +++ b/hdr/kconfig.h @@ -1,23 +1,23 @@ /* - KConfig.h - + KConfig.h + DLASortByDriveNo 0 : Drive Letter Assignement ike MSDOS - 1 : DLA - first drive completely first, then to next drive + 1 : DLA - first drive completely first, then to next drive InitDiskShowDriveAssignment 0 : don't show what drive/partition assigned to what drive letter - 1 : show info - + 1 : show info + SkipConfigSeconds: < 0 : not possible to skip config.sys = 0 : only possible if already pressed before, no message - > 0 : wait so long for F5/F8 - + > 0 : wait so long for F5/F8 + BootHarddiskSeconds: boots by default - and without user interaction - from HD <= 0: normal - > 0: - display message + > 0: + display message ' hit any key to continue to boot from 'diskette or CD' wait ## seconds if no key hit, boot from HD @@ -27,7 +27,7 @@ Major: actual kernel version (not MS-DOS compatibility version), e.g. 2 Revision: revision sequence, e.g. 42 for kernel 2042 Release: 0 if released version, >0 for svn builds (e.g. svn revision #) - + */ typedef struct _KernelConfig { char CONFIG[6]; /* "CONFIG" */ diff --git a/hdr/lol.h b/hdr/lol.h index b18fa6f0..f163018a 100644 --- a/hdr/lol.h +++ b/hdr/lol.h @@ -56,7 +56,7 @@ struct lol { unsigned short nlookahead; /* 41 Number of lookahead buffers */ unsigned char BootDrive; /* 43 bootdrive (1=A:) */ unsigned char cpu; /* 44 CPU family [was unused dword moves] */ - unsigned short xmssize; /* 45 extended memory size in KB */ + unsigned short xmssize; /* 45 extended memory size in KB */ struct buffer far *firstbuf; /* 47 head of buffers linked list */ unsigned short dirtybuf; /* 4b number of dirty buffers */ struct buffer far *lookahead;/* 4d pointer to lookahead buffer */ diff --git a/hdr/nls.h b/hdr/nls.h index fda33360..0af3c7cd 100644 --- a/hdr/nls.h +++ b/hdr/nls.h @@ -347,12 +347,12 @@ struct CountrySpecificInfo { char DecimalPoint[2]; /* '.' # Decimal point */ char DateSeparator[2]; /* '-' */ char TimeSeparator[2]; /* ':' */ - char CurrencyFormat; /* = 0 # Currency format (bit array) + char CurrencyFormat; /* = 0 # Currency format (bit array) 0Fh BYTE currency format bit 2 = set if currency symbol replaces decimal point bit 1 = number of spaces between value and currency symbol bit 0 = 0 if currency symbol precedes value - 1 if currency symbol follows value + 1 if currency symbol follows value */ char CurrencyPrecision; /* = 2 # Currency precision */ char TimeFormat; /* = 0 # time format: 0/1: 12/24 houres */ diff --git a/hdr/portab.h b/hdr/portab.h index 1a34d903..0d735f88 100644 --- a/hdr/portab.h +++ b/hdr/portab.h @@ -192,7 +192,7 @@ typedef unsigned size_t; #define PARASIZE 16 /* "paragraph" size */ typedef unsigned size_t; #endif - /* functions, that are shared between C and ASM _must_ + /* functions, that are shared between C and ASM _must_ have a certain calling standard. These are declared as 'ASMCFUNC', and is (and will be ?-) cdecl */ #define ASMCFUNC CDECL diff --git a/hdr/stacks.inc b/hdr/stacks.inc index 95df7042..f5358ddb 100644 --- a/hdr/stacks.inc +++ b/hdr/stacks.inc @@ -113,7 +113,7 @@ irp_hi equ 26 ; I386.inc - 10/25/01 by tom ehlert ; ; compiling the kernel for 386 will (sometimes) change the -; high part of (some) registers, which will be (sometimes) be used +; high part of (some) registers, which will be (sometimes) be used ; later ; ; assumption: @@ -135,15 +135,15 @@ irp_hi equ 26 ; error 1 2 3 %macro Protect386Registers 0 %endmacro - + %macro RestoreSP 0 - mov sp, bp + mov sp, bp %endmacro %macro Restore386Registers 0 %endmacro -%ELSE +%ELSE %ifdef WATCOM %macro Protect386Registers 0 diff --git a/hdr/xstructs.h b/hdr/xstructs.h index f29bbe41..27193f92 100644 --- a/hdr/xstructs.h +++ b/hdr/xstructs.h @@ -52,7 +52,7 @@ struct xdpbforformat { struct { DWORD nfreeclst; /* # free clusters (-1 - unknown, 0 - don't change) */ - DWORD cluster; /* cluster # of first free + DWORD cluster; /* cluster # of first free (-1 - unknown, 0 - don't change) */ UDWORD reserved[2]; } setdpbcounts; diff --git a/kernel/asmsupt.asm b/kernel/asmsupt.asm index faa0a604..b312461f 100644 --- a/kernel/asmsupt.asm +++ b/kernel/asmsupt.asm @@ -28,7 +28,7 @@ ; added some more functions ; changed bcopy, scopy, sncopy,... ; to memcpy, strcpy, strncpy -; Bart Oldeman: optimized a bit: see /usr/include/bits/string.h from +; Bart Oldeman: optimized a bit: see /usr/include/bits/string.h from ; glibc 2.2 ; ; $Id: asmsupt.asm 1568 2011-04-09 02:42:51Z bartoldeman $ @@ -72,7 +72,7 @@ %define MEMCMP INIT_MEMCMP %else - + segment HMA_TEXT %endif @@ -115,7 +115,7 @@ ; pascal_setup: pop ax ; get return address - + push bp ; Standard C entry mov bp,sp %ifdef WATCOM @@ -137,12 +137,12 @@ pascal_setup: mov cx,[4+bp] ; majority (8) wants that (near and far) mov si,[6+bp] ; majority (3) wants that (near) mov di,[8+bp] ; majority (3) wants that (near) - + jmp ax - + ;*********************************************** ; ; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n); @@ -168,12 +168,12 @@ domemcpy: memcpy_return: %if 0 ; only needed for fmemcpyback cld -%endif +%endif ; ; pascal_return - pop saved registers and do return ; - + jmp short pascal_return @@ -217,19 +217,19 @@ FMEMSET: ; Get the fill byte ch mov ax,[bp+6] - + ; Get the far source pointer, s les di,[bp+8] mov bl,8 -domemset: +domemset: mov ah, al shr cx,1 rep stosw jnc pascal_return stosb - + jmp short pascal_return ;*************************************************************** @@ -239,7 +239,7 @@ domemset: global MEMSET MEMSET: call pascal_setup - + ; Get the repitition count, n - preset above ; mov cx,[bp+4] @@ -274,7 +274,7 @@ pascal_return: ret ;***************************************************************** - + ; fstrcpy (void FAR*dest, void FAR *src); %ifndef _INIT @@ -289,7 +289,7 @@ FSTRCPY: les di,[bp+8] mov bl,8 - + jmp short dostrcpy %endif @@ -308,16 +308,16 @@ STRCPY: dostrcpy: -strcpy_loop: +strcpy_loop: lodsb stosb test al,al jne strcpy_loop - + jmp short pascal_return -;****************************************************************** -%ifndef _INIT +;****************************************************************** +%ifndef _INIT global FSTRLEN FSTRLEN: call pascal_setup @@ -337,13 +337,13 @@ STRLEN: mov di,[bp+4] mov bl,2 -dostrlen: +dostrlen: mov al,0 mov cx,0xffff repne scasb mov ax,cx - not ax + not ax dec ax jmp short pascal_return @@ -360,18 +360,18 @@ STRCHR: ; mov si,[bp+6] - preset above mov bl,4 -strchr_loop: +strchr_loop: lodsb cmp al,cl je strchr_found test al,al jne strchr_loop - + strchr_retzero: xor ax, ax ; return NULL if not found mov dx, ax ; for fstrchr() jmp short pascal_return - + strchr_found: mov ax, si mov dx, ds ; for fstrchr() @@ -390,7 +390,7 @@ FSTRCHR: ; Get ch (preset above) ;mov cx, [bp+4] - + ;and the source pointer, src lds si, [bp+6] @@ -431,7 +431,7 @@ FSTRCMP: ; and the destination pointer, d les di,[bp+8] - + mov bl,8 %if 0 @@ -451,7 +451,7 @@ STRCMP: ; mov di,[bp+6] xchg si,di -dostrcmp: +dostrcmp: %endif ; replace strncmp(s1,s2)--> ; strncmp(s1,s2,0xffff) @@ -459,7 +459,7 @@ dostrcmp: %if 0 jmp short dostrncmp - + ;********************************************************************** global FSTRNCMP FSTRNCMP: @@ -472,7 +472,7 @@ FSTRNCMP: les di,[bp+8] mov cx,[bp+12] mov bl,10 - + jmp short dostrncmp ;****** @@ -492,13 +492,13 @@ dostrncmp: %endif jcxz strncmp_retzero -strncmp_loop: +strncmp_loop: lodsb scasb jne strncmp_done test al,al loopne strncmp_loop - jmp short strncmp_retzero + jmp short strncmp_retzero %endif ;********************************************************************** @@ -509,7 +509,7 @@ FMEMCMP: ; the length - preset above ; mov cx, [bp+4] - + ; Get the source pointer, ss les di,[bp+6] @@ -521,7 +521,7 @@ FMEMCMP: jmp short domemcmp ;****** -; memcmp(BYTE *s1 , BYTE *s2, int count); +; memcmp(BYTE *s1 , BYTE *s2, int count); global MEMCMP MEMCMP: call pascal_setup diff --git a/kernel/blockio.c b/kernel/blockio.c index ae2e8198..f74014c1 100644 --- a/kernel/blockio.c +++ b/kernel/blockio.c @@ -51,12 +51,12 @@ STATIC BOOL flush1(struct buffer FAR * bp); /* this searches the buffer list for the given disk/block. - + returns: a far pointer to the buffer. If the buffer is found the UNCACHE bit is not set and else it is set. - + new: upper layer may set UNCACHE attribute UNCACHE buffers are recycled first. @@ -158,7 +158,7 @@ STATIC struct buffer FAR *searchblock(ULONG blkno, COUNT dsk) BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mode) { struct buffer FAR *bp = firstbuf; - + /* Search through buffers to see if the required block */ /* is already in a buffer */ @@ -484,10 +484,10 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, } /* - this removes any (additionally allocated) buffers + this removes any (additionally allocated) buffers from the HMA buffer chain, because they get allocated to the 'user' -*/ - +*/ + void AllocateHMASpace (size_t lowbuffer, size_t highbuffer) { REG struct buffer FAR *bp = firstbuf; diff --git a/kernel/chario.c b/kernel/chario.c index eb95803e..a15d94d4 100644 --- a/kernel/chario.c +++ b/kernel/chario.c @@ -362,7 +362,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) unsigned c; unsigned cu_pos = scr_pos; unsigned count = 0, stored_pos = 0; - unsigned size = kp->kb_size, stored_size = kp->kb_count; + unsigned size = kp->kb_size, stored_size = kp->kb_count; BOOL insert = FALSE, first = TRUE; if (size == 0) @@ -371,11 +371,11 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) /* the stored line is invalid unless it ends with a CR */ if (kp->kb_buf[stored_size] != CR) stored_size = 0; - + do { unsigned new_pos = stored_size; - + c = read_char_check_break(sft_in, sft_out); if (c == 0) c = (unsigned)read_char_check_break(sft_in, sft_out) << 8; @@ -398,7 +398,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) if (stored_pos < stored_size && count < size - 1) local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out); break; - + case F2: case F4: /* insert/delete up to character c */ @@ -426,7 +426,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) } stored_pos = new_pos; break; - + case F5: fmemcpy(kp->kb_buf, local_buffer, count); stored_size = count; @@ -436,7 +436,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) case INS: insert = !insert; break; - + case DEL: stored_pos++; break; @@ -516,7 +516,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) size_t read_line_handle(int sft_idx, size_t n, char FAR * bp) { size_t chars_left; - + if (inputptr == NULL) { /* can we reuse kb_buf or was it overwritten? */ diff --git a/kernel/console.asm b/kernel/console.asm index e4a99440..9f4fefd5 100644 --- a/kernel/console.asm +++ b/kernel/console.asm @@ -55,7 +55,7 @@ segment _LOWTEXT uScanCode db 0 ; Scan code for con: device global _kbdType -_kbdType db 0 ; 00 for 84key, 10h for 102key +_kbdType db 0 ; 00 for 84key, 10h for 102key global ConInit ConInit: @@ -90,7 +90,7 @@ ConRead2: jmp _IOExit -readkey: +readkey: mov ah,[cs:_kbdType] int 16h checke0: cmp al,0xe0 ; must check for 0xe0 scan code @@ -99,7 +99,7 @@ checke0: cmp al,0xe0 ; must check for 0xe0 scan code jz .ret mov al,0 ; otherwise destroy the 0xe0 .ret: retn - + ; ; Name: ; KbdRdChar @@ -109,7 +109,7 @@ checke0: cmp al,0xe0 ; must check for 0xe0 scan code ; ; Description: ; This subroutine reads a character from the keyboard. It also handles -; a couple of special functions. +; a couple of special functions. ; It converts ctrl-printscreen to a control-P. ; It also accounts for extended scan codes by saving off ; the high byte of the return and returning it if it was non-zero on @@ -193,7 +193,7 @@ ConInpFlush: ; *** flush that keyboard queue KbdInpChar: ; *** get ??00 or the last waiting key after flushing the queue xor ax,ax mov byte [cs:uScanCode],al -KbdInpCh1: +KbdInpCh1: mov ah,1 add ah,[cs:_kbdType] int 16h ; get status, if zf=0 al=char diff --git a/kernel/country.asm b/kernel/country.asm index 575e58ff..4d4c93f3 100644 --- a/kernel/country.asm +++ b/kernel/country.asm @@ -4869,7 +4869,7 @@ db 88, 89, 90, 123, 124, 125, 126, 127 db 128, 129, 130, 131, 132, 133, 134, 135 db 136, 137, 138, 138, 139, 140, 140, 141 db 141, 142, 143, 144, 144, 145, 145, 146 -db 147, 148, 149, 36, 36, 36, 36, 36 +db 147, 148, 149, 36, 36, 36, 36, 36 db 65, 73, 79, 85, 78, 78, 166, 167 db 63, 169, 170, 171, 172, 33, 34, 34 db 176, 177, 178, 179, 180, 181, 182, 183 diff --git a/kernel/cpu.asm b/kernel/cpu.asm index 281dfd80..34073c4e 100644 --- a/kernel/cpu.asm +++ b/kernel/cpu.asm @@ -30,7 +30,7 @@ CPU 386 ; ; UWORD query_cpu() based on Eric Auer's public domain cpulevel.asm ; input: none -; output: ax = cpu, 0=8086/8088, 1=186/188, 2=286, 3=386+ +; output: ax = cpu, 0=8086/8088, 1=186/188, 2=286, 3=386+ global _query_cpu _query_cpu: ; save registers, assumes enough space on stack & valid stack frame setup @@ -64,7 +64,7 @@ is286: mov bx, 2 ; at least 286 test ax, 0f000h jz cleanup ; 4 msb stuck to 0: 80286 mov bx, 3 ; at least 386 - + cleanup: mov ax, bx ; return CPU family popf diff --git a/kernel/dosfns.c b/kernel/dosfns.c index d3d07c0f..3eba25cd 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -126,9 +126,9 @@ struct dpb FAR * GetDriveDPB(UBYTE drive, COUNT * rc) { struct dpb FAR *dpb; struct cds FAR *cdsp; - + cdsp = get_cds1(drive); - + if (cdsp == NULL) { *rc = DE_INVLDDRV; @@ -180,7 +180,7 @@ sft FAR * idx_to_sft(int SftIndex) return (sft FAR *) - 1; return lpCurSft; } - + int get_sft_idx(unsigned hndl) { psp FAR *p = MK_FP(cu_psp, 0); @@ -216,7 +216,7 @@ long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode) } if (mode == XFR_FORCE_WRITE) mode = XFR_WRITE; - + /* * Do remote first or return error. * must have been opened from remote. @@ -304,7 +304,7 @@ COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode) sft FAR *s = idx_to_sft(sft_idx); if (FP_OFF(s) == (size_t) -1) return DE_INVLDHNDL; - + /* Test for invalid mode */ if (mode > SEEK_END) return DE_INVLDFUNC; @@ -476,13 +476,13 @@ bits for flags (bits 11-8 are internal FreeDOS bits only) 12 O_LARGEFILE allow files >= 2gb but < 4gb (not implemented yet) 11 O_LEGACY not called from int21/ah=6c: find right fn for redirector 10 O_CREAT if file does not exist, create it -9 O_TRUNC if file exists, truncate and open it \ not both +9 O_TRUNC if file exists, truncate and open it \ not both 8 O_OPEN if file exists, open it / 7 O_NOINHERIT do not inherit handle on exec -6 \ +6 \ 5 - sharing modes -4 / -3 reserved +4 / +3 reserved 2 bits 2,1,0 = 100: RDONLY and do not modify file's last access time (not implemented yet) 1 \ 0=O_RDONLY, 1=O_WRONLY, @@ -604,7 +604,7 @@ long DosOpen(char FAR * fname, unsigned mode, unsigned attrib) { long result; unsigned hndl; - + /* test if mode is in range */ if ((mode & ~O_VALIDMASK) != 0) return DE_INVLDACC; @@ -629,7 +629,7 @@ COUNT CloneHandle(unsigned hndl) if (sftp == (sft FAR *) -1 || (sftp->sft_mode & O_NOINHERIT)) return DE_INVLDHNDL; - + /* now that we have the system file table entry, get the fnode */ /* index, and increment the count, so that we've effectively */ /* cloned the file. */ @@ -862,7 +862,7 @@ COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp) /* DriveString should be in form of "C:", "C:\", "\", "", ., or .\ where missing drive is treated as a request for the current drive, - or network name in form "\\SERVER\share" + or network name in form "\\SERVER\share" however, network names like \\SERVER\C aren't supported yet */ cdsp = NULL; @@ -1047,7 +1047,7 @@ COUNT DosFindNext(void) * test 40h. I used RamView to see location MSD 116:04be and * FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4. * Ralf Brown docs for dos 4eh say bit 7 set == remote so what is - * bit 6 for? + * bit 6 for? * SHSUCDX Mod info say "test redir not network bit". * Just to confuse the rest, MSCDEX sets bit 5 too. * @@ -1117,7 +1117,7 @@ COUNT DosGetFattr(BYTE FAR * name) result = truename(name, PriPathName, CDS_MODE_CHECK_DEV_PATH); if (result < SUCCESS) return result; - + /* /// Added check for "d:\", which returns 0x10 (subdirectory) under DOS. - Ron Cemer */ /* Theoretically: If the redirectory's qualify function @@ -1307,7 +1307,7 @@ struct dhdr FAR *IsDevice(const char FAR * fname) { */ -/* BUGFIX: MSCD000<00> should be handled like MSCD000<20> TE +/* BUGFIX: MSCD000<00> should be handled like MSCD000<20> TE ie the 8 character device name may be padded with spaces ' ' or NULs '\0' Note: fname is assumed an ASCIIZ string (ie not padded, unknown length) @@ -1379,7 +1379,7 @@ COUNT DosTruename(const char FAR *src, char FAR *dest) /* RBIL: The buffer has be unchanged, if the call fails. Therefore, the name is created in an internal buffer and copied into the user buffer only on success. - */ + */ COUNT rc = truename(src, PriPathName, CDS_MODE_ALLOW_WILDCARDS); if (rc >= SUCCESS) { diff --git a/kernel/dsk.c b/kernel/dsk.c index 41f32c48..a465ec94 100644 --- a/kernel/dsk.c +++ b/kernel/dsk.c @@ -374,7 +374,7 @@ STATIC WORD getbpb(ddt * pddt) unsigned secs_per_cyl; WORD ret; - /* pddt->ddt_descflags |= DF_NOACCESS; + /* pddt->ddt_descflags |= DF_NOACCESS; * disabled for now - problems with FORMAT ?? */ /* set drive to not accessible and changed */ @@ -426,7 +426,7 @@ STATIC WORD getbpb(ddt * pddt) #endif extended_BPB_signature = DiskTransferBuffer[0x26]; - /* 0x29 is usual signature value for serial#,vol label,& fstype; + /* 0x29 is usual signature value for serial#,vol label,& fstype; 0x28 older EBPB signature indicating only serial# is valid */ if ((extended_BPB_signature == 0x29) || (extended_BPB_signature == 0x28)) { @@ -716,7 +716,7 @@ STATIC WORD Genblkdev(rqptr rp, ddt * pddt) /* return error if media lacks extended BPB with serial # */ { - register BYTE extended_BPB_signature = + register BYTE extended_BPB_signature = DiskTransferBuffer[(pddt->ddt_bpb.bpb_nfsect != 0 ? 0x26 : 0x42)]; if ((extended_BPB_signature != 0x29) || (extended_BPB_signature != 0x28)) return failure(E_MEDIA); @@ -954,22 +954,22 @@ STATIC unsigned DMA_max_transfer(void FAR * buffer, unsigned count) UWORD *transferred sectors actually transferred Read/Write/Write+verify some sectors, using LBA addressing. - - + + This function handles all the minor details, including: - + retry in case of errors - + crossing the 64K DMA boundary - + translation to CHS addressing if necessary - + crossing track boundaries (necessary for some BIOSes - + High memory doesn't work very well, use internal buffer - + write with verify details for LBA - + */ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, @@ -990,7 +990,7 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, UWORD bytes_sector = pddt->ddt_bpb.bpb_nbyte; /* bytes per sector, usually 512 */ *transferred = 0; - + /* only low-level format floppies for now ! */ if (mode == LBA_FORMAT && hd(pddt->ddt_descflags)) return 0; @@ -1009,8 +1009,8 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, fl_reset(driveno); } } - -/* + +/* if (LBA_address+totaltodo > pddt->total_sectors) { printf("LBA-Transfer error : address overflow = %lu > %lu max\n",LBA_address+totaltodo,driveParam->total_sectors); diff --git a/kernel/dyndata.h b/kernel/dyndata.h index e980a2c4..15462989 100644 --- a/kernel/dyndata.h +++ b/kernel/dyndata.h @@ -1,12 +1,12 @@ /* DynData.h - + declarations for dynamic NEAR data allocations - + the DynBuffer must initially be large enough to hold the PreConfig data. - after the disksystem has been initialized, the kernel is - moveable and Dyn.Buffer resizable, but not before + after the disksystem has been initialized, the kernel is + moveable and Dyn.Buffer resizable, but not before */ void far *DynAlloc(char *what, unsigned num, unsigned size); diff --git a/kernel/dyninit.c b/kernel/dyninit.c index 8bd0d37e..a51c335c 100644 --- a/kernel/dyninit.c +++ b/kernel/dyninit.c @@ -1,6 +1,6 @@ /* DYNINIT.C - + this serves requests from the INIT modules to allocate dynamic data. @@ -13,27 +13,27 @@ kernel layout: 013A0H 019F3H 00654H _DATA DATA 019F4H 0240DH 00A1AH _BSS BSS -additionally: - DYN_DATA DYN +additionally: + DYN_DATA DYN + - 02610H 0F40EH 0CDFFH HMA_TEXT HMA FCBs, f_nodes, buffers,... - drivers - - + drivers + + 0F410H 122DFH 02ED0H INIT_TEXT INIT 122E0H 12AA5H 007C6H ID ID 12AA6H 12CBFH 0021AH IB IB purpose is to move the HMA_TEXT = resident kernel - around, so that below it - after BSS, there is data + around, so that below it - after BSS, there is data addressable near by the kernel, to hold some arrays - like f_nodes - + like f_nodes + making f_nodes near saves ~2.150 code in HMA - + */ #include "portab.h" #include "init-mod.h" diff --git a/kernel/entry.asm b/kernel/entry.asm index d8817514..5d4ba647 100644 --- a/kernel/entry.asm +++ b/kernel/entry.asm @@ -130,7 +130,7 @@ cpm_error: mov al,0 print_hex: mov cl, 12 hex_loop: - mov ax, dx + mov ax, dx shr ax, cl and al, 0fh cmp al, 10 @@ -147,7 +147,7 @@ divide_by_zero_message db 0dh,0ah,'Interrupt divide by zero, stack:',0dh,0ah,0 global reloc_call_int0_handler reloc_call_int0_handler: - + mov si,divide_by_zero_message zero_message_loop: @@ -158,15 +158,15 @@ zero_message_loop: inc si mov bx, 0070h mov ah, 0eh - + int 10h - + jmp short zero_message_loop - + zero_done: - mov bp, sp + mov bp, sp xor si, si ; print 13 words of stack for debugging LUDIV etc. -stack_loop: +stack_loop: mov dx, [bp+si] call print_hex mov al, ' ' @@ -179,8 +179,8 @@ stack_loop: int 10h mov al, 0ah int 10h - - mov ax,04c7fh ; terminate with errorlevel 127 + + mov ax,04c7fh ; terminate with errorlevel 127 int 21h sti thats_it: hlt @@ -192,7 +192,7 @@ invalid_opcode_message db 0dh,0ah,'Invalid Opcode at ',0 reloc_call_int6_handler: mov si,invalid_opcode_message - jmp short zero_message_loop + jmp short zero_message_loop global reloc_call_int19_handler reloc_call_int19_handler: @@ -275,7 +275,7 @@ int21_reentry: cmp ah,62h jne int21_1 -int21_user: +int21_user: call dos_crit_sect push ss @@ -287,7 +287,7 @@ int21_user: ; ; normal entry, use one of our 4 stacks -; +; ; DX=DGROUP ; CX=STACK ; SI=userSS @@ -323,7 +323,7 @@ int21_1: cmp byte [_ErrorMode],0 je int21_2 -int21_onerrorstack: +int21_onerrorstack: mov cx,_error_tos @@ -331,17 +331,17 @@ int21_onerrorstack: mov ss,dx mov sp,cx sti - + push si ; user SS:SP push bp - + call _int21_service jmp short int21_exit_nodec - + int21_2: inc byte [_InDOS] mov cx,_char_api_tos - or ah,ah + or ah,ah jz int21_3 cmp ah,0ch jbe int21_normalentry @@ -361,7 +361,7 @@ int21_normalentry: ; Push the far pointer to the register frame for ; int21_syscall and remainder of kernel. ; - + push si ; user SS:SP push bp call _int21_service @@ -373,7 +373,7 @@ int21_exit: dec byte [_InDOS] ; were modified by the system call. ; - + int21_exit_nodec: pop bp ; get back user stack pop si @@ -439,7 +439,7 @@ reloc_call_low_int25_handler: pushf push ax mov ax,025h -int2526: +int2526: push cx push dx push bx @@ -464,7 +464,7 @@ int2526: sti Protect386Registers - + push dx push cx ; save user stack @@ -578,7 +578,7 @@ CritErr05: mov bp,[es:PSP_USERSP] RestoreSP Restore386Registers - mov bp,cx + mov bp,cx ; ; and call critical error handler ; diff --git a/kernel/execrh.asm b/kernel/execrh.asm index 13198e44..d248c248 100644 --- a/kernel/execrh.asm +++ b/kernel/execrh.asm @@ -56,20 +56,20 @@ segment HMA_TEXT mov ax, [si+6] ; construct strategy address - mov [bp+4], ax + mov [bp+4], ax - push si ; the bloody fucking RTSND.DOS + push si ; the bloody fucking RTSND.DOS push di ; driver destroys SI,DI (tom 14.2.03) call far[bp+4] ; call far the strategy - pop di + pop di pop si - + ; Protect386Registers ; old free-EMM386 versions destroy regs in their INIT method mov ax,[si+8] ; construct 'interrupt' address - mov [bp+4],ax ; construct interrupt address + mov [bp+4],ax ; construct interrupt address call far[bp+4] ; call far the interrupt ; Restore386Registers ; less stack load and better performance... diff --git a/kernel/fatdir.c b/kernel/fatdir.c index fdead1bf..46d5122e 100644 --- a/kernel/fatdir.c +++ b/kernel/fatdir.c @@ -36,7 +36,7 @@ static BYTE *fatdirRcsId = #endif /* Description. - * Initialize a fnode so that it will point to the directory with + * Initialize a fnode so that it will point to the directory with * dirstart starting cluster; in case of passing dirstart == 0 * fnode will point to the start of a root directory */ VOID dir_init_fnode(f_node_ptr fnp, CLUSTER dirstart) @@ -326,11 +326,11 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name) } /* - BUGFIX TE 06/28/01 - + BUGFIX TE 06/28/01 + when using FcbFindXxx, the only information available is the cluster number + entrycount. everything else MUST\ - be recalculated. + be recalculated. a good test for this is MSDOS CHKDSK, which now (seems too) work */ @@ -363,7 +363,7 @@ COUNT dos_findnext(void) /* MSD Command.com uses FCB FN 11 & 12 with attrib set to 0x16. Bits 0x21 seem to get set some where in MSD so Rd and Arc - files are returned. + files are returned. RdOnly + Archive bits are ignored */ @@ -398,13 +398,13 @@ COUNT dos_findnext(void) } #endif /* - this receives a name in 11 char field NAME+EXT and builds + this receives a name in 11 char field NAME+EXT and builds a zeroterminated string - unfortunately, blanks are allowed in filenames. like + unfortunately, blanks are allowed in filenames. like "test e", " test .y z",... - - so we have to work from the last blank backward + + so we have to work from the last blank backward */ void ConvertName83ToNameSZ(BYTE FAR * destSZ, BYTE FAR * srcFCBName) { diff --git a/kernel/fatfs.c b/kernel/fatfs.c index eaaab2be..7de71e3b 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -86,7 +86,7 @@ ULONG clus2phys(CLUSTER cl_no, struct dpb FAR * dpbp) struct dpb FAR *get_dpb(COUNT dsk) { register struct cds FAR *cdsp = get_cds(dsk); - + if (cdsp == NULL || cdsp->cdsFlags & CDSNETWDRV) return NULL; return cdsp->cdsDpb; @@ -296,7 +296,7 @@ STATIC int find_fname(const char *path, int attr, f_node_ptr fnp) /* Description. * Remove entries with D_LFN attribute preceeding the directory entry * pointed by fnp, fnode isn't modified (I hope). - * Return value. + * Return value. * SUCCESS - completed successfully. * DE_ACCESS - error occurred, fnode is released. * input: fnp with valid non-LFN directory entry, not equal to '..' or @@ -432,7 +432,7 @@ COUNT dos_delete(BYTE * path, int attrib) /* Do not delete directories or r/o files */ /* lfn entries and volume labels are only found */ /* by find_fname() if attrib is set to a */ - /* special value */ + /* special value */ if (fnp->f_dir.dir_attrib & (D_RDONLY | D_DIR)) return DE_ACCESS; @@ -1121,65 +1121,65 @@ STATIC COUNT dos_extend(f_node_ptr fnp) /* comments read optimization for large reads: read total clusters in one piece - running a program like - + running a program like + while (1) { - read(fd, header, sizeof(header)); // small read - read(fd, buffer, header.size); // where size is large, up to 63K + read(fd, header, sizeof(header)); // small read + read(fd, buffer, header.size); // where size is large, up to 63K // with average ~32K - } + } - FreeDOS 2025 is really slow. + FreeDOS 2025 is really slow. on a P200 with modern 30GB harddisk, doing above for a 14.5 MB file - + MSDOS 6.22 clustersize 8K ~2.5 sec (accumulates over clusters, reads for 63 sectors seen), - IBM PCDOS 7.0 8K ~4.3 - IBM PCDOS 7.0 16K ~2.8 + IBM PCDOS 7.0 8K ~4.3 + IBM PCDOS 7.0 16K ~2.8 FreeDOS ke2025 ~17.5 - with the read optimization (ke2025a), - + with the read optimization (ke2025a), + clustersize 8K ~6.5 sec clustersize 16K ~4.2 sec - + it was verified with IBM feature tool, that the drive read ahead cache (says it) is on. still this huge difference ;-) - - it's coded pretty conservative to avoid all special cases, + + it's coded pretty conservative to avoid all special cases, so it shouldn't break anything :-) possible further optimization: - + collect read across clusters (if file is not fragmented). MSDOS does this (as readcounts up to 63 sectors where seen) - specially important for diskettes, where clustersize is 1 sector - + specially important for diskettes, where clustersize is 1 sector + the same should be done for writes as well - the time to compile the complete kernel (on some P200) is + the time to compile the complete kernel (on some P200) is reduced from 67 to 56 seconds - in an otherwise identical configuration. it's not clear if this improvement shows up elsewhere, but it shouldn't harm either - + TE 10/18/01 14:00 - + collect read across clusters (if file is not fragmented) done. - + seems still to work :-)) - + no large performance gains visible, but should now work _much_ better for the people, that complain about slow floppy access - the - fnp->f_offset +to_xfer < fnp->f_dir.dir_size && avoid EOF problems + the + fnp->f_offset +to_xfer < fnp->f_dir.dir_size && avoid EOF problems + + condition can probably _carefully_ be dropped + - condition can probably _carefully_ be dropped - - TE 10/18/01 19:00 - + */ /* Read/write block from disk */ @@ -1209,15 +1209,15 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) { fnp->f_dir.dir_attrib |= D_ARCHIVE; /* mark file as modified and set date not valid any more */ - fnp->f_flags &= ~(SFT_FCLEAN|SFT_FDATE); - + fnp->f_flags &= ~(SFT_FCLEAN|SFT_FDATE); + if (dos_extend(fnp) != SUCCESS) { fnode_to_sft(fnp); return 0; } } - + /* Test that we are really about to do a data transfer. If the */ /* count is zero and the mode is XFR_READ, just exit. (Any */ /* read with a count of zero is a nop). */ @@ -1318,7 +1318,7 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) /* avoid EOF problems */ if (mode == XFR_READ && to_xfer > fnp->f_dir.dir_size - fnp->f_offset) sectors_wanted = (UCOUNT)(fnp->f_dir.dir_size - fnp->f_offset); - + sectors_wanted /= secsize; if (sectors_wanted == 0) @@ -1380,7 +1380,7 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) bp = getblock(currentblock /*clus2phys(fnp->f_cluster, fnp->f_dpb) + fnp->f_sector */ , fnp->f_dpb->dpb_unit); - + #ifdef DISPLAY_GETBLOCK printf("DATA (rwblock)\n"); #endif @@ -1414,7 +1414,7 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) fmemcpy(buffer, &bp->b_buffer[boff], xfr_cnt); } - /* complete buffer transferred ? + /* complete buffer transferred ? probably not reused later */ if (xfr_cnt == sizeof(bp->b_buffer) || @@ -1791,12 +1791,12 @@ STATIC void fnode_to_sft(f_node_ptr fnp) the BUG was: copy COMMAND.COM xxx echo >xxx - - then, the dirsize of xxx was set to ~20, but the allocated + + then, the dirsize of xxx was set to ~20, but the allocated FAT entries not returned. this code corrects this - - Unfortunately, this code _nearly_ works, but fails one of the + + Unfortunately, this code _nearly_ works, but fails one of the Apps tested (VB ISAM); BO: confirmation??? */ @@ -1867,5 +1867,5 @@ STATIC int shrink_file(f_node_ptr fnp) * FreeDOS will write all possible bytes, then close file(BUG) * * the dos_mkdir/extenddir (with getblock() instead of getblockOver) was a real - * performance killer on large drives. (~0.5 sec /dos_mkdir) TE + * performance killer on large drives. (~0.5 sec /dos_mkdir) TE */ diff --git a/kernel/fattab.c b/kernel/fattab.c index 0088a4a5..b84328f2 100644 --- a/kernel/fattab.c +++ b/kernel/fattab.c @@ -172,7 +172,7 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, if (ISFAT32(dpbp)) max_cluster = dpbp->dpb_xsize; #endif - + if (clussec <= 1 || clussec > max_cluster) /* try to read out of range? */ { clusterMessage("index: 0x",clussec); /* bad array offset */ @@ -249,10 +249,10 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, bp1 = getFATblock(dpbp, (unsigned)clussec + 1); if (bp1 == 0) return 1; /* the only error code possible here */ - + if (Cluster2 != READ_CLUSTER) bp1->b_flag |= BFR_DIRTY | BFR_VALID; - + fbp1 = &bp1->b_buffer[0]; } @@ -301,7 +301,7 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, *fbp0 = (UBYTE)cluster; *fbp1 = (UBYTE)(cluster >> 8); } - else if (ISFAT16(dpbp)) + else if (ISFAT16(dpbp)) { /* form an index so that we can read the block as a */ /* byte array */ diff --git a/kernel/fcbfns.c b/kernel/fcbfns.c index 180ef95b..02141499 100644 --- a/kernel/fcbfns.c +++ b/kernel/fcbfns.c @@ -93,7 +93,7 @@ UWORD FcbParseFname(UBYTE *wTestMode, const BYTE FAR * lpFileName, fcb FAR * lpF WORD wRetCodeName = FALSE, wRetCodeExt = FALSE; /* pjv -- ExtFcbToFcb? */ - + /* skip leading separators if requested */ if (*wTestMode & PARSE_SKIP_LEAD_SEP) { @@ -195,7 +195,7 @@ const BYTE FAR * GetNameField(const BYTE FAR * lpFileName, BYTE FAR * lpDestFiel /* include ? as-is but flag for return purposes wildcard used */ if (*lpFileName == '?') *pbWildCard = TRUE; - + /* store uppercased character, and advance to next char */ *lpDestField++ = DosUpFChar(*lpFileName++); ++nIndex; @@ -415,7 +415,7 @@ UBYTE FcbOpen(xfcb FAR * lpXfcb, unsigned flags) lpFcb->fcb_curec = 0; lpFcb->fcb_rndm = 0; */ - + lpFcb->fcb_recsiz = 0; /* true for devices */ if (!(sftp->sft_flags & SFT_FDEVICE)) /* check for a device */ { @@ -493,7 +493,7 @@ UBYTE FcbDelete(xfcb FAR * lpXfcb) } else do { - SecPathName[0] = 'A' + FcbDrive - 1; + SecPathName[0] = 'A' + FcbDrive - 1; SecPathName[1] = ':'; strcpy(&SecPathName[2], Dmatch.dm_name); if (DosDelete(SecPathName, attr) != SUCCESS) @@ -648,13 +648,13 @@ UBYTE FcbFindFirstNext(xfcb FAR * lpXfcb, BOOL First) fmemcpy(Dmatch.dm_name_pat, lpFcb->fcb_fname, FNAME_SIZE + FEXT_SIZE); DosUpFMem((BYTE FAR *) Dmatch.dm_name_pat, FNAME_SIZE + FEXT_SIZE); - + Dmatch.dm_attr_srch = wAttr; Dmatch.dm_entry = lpFcb->fcb_strtclst; Dmatch.dm_dircluster = lpFcb->fcb_dirclst; wAttr = D_ALL; - + if ((xfcb FAR *) lpFcb != lpXfcb) { wAttr = lpXfcb->xfcb_attrib; @@ -671,10 +671,10 @@ UBYTE FcbFindFirstNext(xfcb FAR * lpXfcb, BOOL First) *lpDir++ = FcbDrive; fmemcpy(lpDir, &SearchDir, sizeof(struct dirent)); - + lpFcb->fcb_dirclst = (UWORD) Dmatch.dm_dircluster; lpFcb->fcb_strtclst = Dmatch.dm_entry; - + /* This is undocumented and seen using Pcwatch and Ramview. The First byte is the current directory count and the second seems diff --git a/kernel/globals.h b/kernel/globals.h index 549043f7..f6616543 100644 --- a/kernel/globals.h +++ b/kernel/globals.h @@ -234,7 +234,7 @@ extern BYTE ASM NetDelay, ASM NetRetry; extern UWORD ASM first_mcb, /* Start of user memory */ ASM uppermem_root; /* Start of umb chain (usually 9fff) */ -extern char * ASM inputptr; /* pointer to unread CON input */ +extern char * ASM inputptr; /* pointer to unread CON input */ extern sfttbl FAR * ASM sfthead; /* System File Table head */ extern struct dhdr FAR * ASM clock, /* CLOCK$ device */ @@ -266,8 +266,8 @@ extern BYTE ASM ErrorMode, /* Critical error flag */ ASM InDOS, /* In DOS critical section */ ASM OpenMode, /* File Open Attributes */ ASM SAttr, /* Attrib Mask for Dir Search */ - ASM dosidle_flag, ASM Server_Call, ASM CritErrLocus, ASM CritErrAction, - ASM CritErrClass, ASM VgaSet, + ASM dosidle_flag, ASM Server_Call, ASM CritErrLocus, ASM CritErrAction, + ASM CritErrClass, ASM VgaSet, ASM njoined; /* number of joined devices */ extern UWORD ASM Int21AX; diff --git a/kernel/init-dat.h b/kernel/init-dat.h index cda5e055..79aa5f70 100644 --- a/kernel/init-dat.h +++ b/kernel/init-dat.h @@ -1,7 +1,7 @@ /* Included by initialisation functions */ #if _MSC_VER != 0 -extern __segment DosDataSeg; /* serves for all references to the DOS DATA segment +extern __segment DosDataSeg; /* serves for all references to the DOS DATA segment necessary for MSC+our funny linking model */ diff --git a/kernel/init-mod.h b/kernel/init-mod.h index e39d84d8..fe28cdaf 100644 --- a/kernel/init-mod.h +++ b/kernel/init-mod.h @@ -272,9 +272,9 @@ extern unsigned char FAR ASM kbdType; extern struct { char ThisIsAConstantOne; short TableSize; - + struct CountrySpecificInfo C; - + } FAR ASM nlsCountryInfoHardcoded; /* diff --git a/kernel/initdisk.c b/kernel/initdisk.c index 16a69290..4e51409b 100644 --- a/kernel/initdisk.c +++ b/kernel/initdisk.c @@ -56,8 +56,8 @@ COUNT nUnits BSS_INIT(0); * Implementation note: * this module needs some interfacing to INT 13 * how to implement them - * - * a) using inline assembly + * + * a) using inline assembly * _ASM mov ax,0x1314 * * b) using assembly routines in some external FLOPPY.ASM @@ -71,7 +71,7 @@ COUNT nUnits BSS_INIT(0); * * a) this is my personal favorite, combining the best aof all worlds. * TURBO-C does support inline assembly, but only by using TASM, - * which is not free. + * which is not free. * so - unfortunately- its excluded. * * b) keeping funny memory model in sync with external assembly @@ -79,7 +79,7 @@ COUNT nUnits BSS_INIT(0); * * c) you never know EXACT, what the compiler does, if its a bit * more complicated. does - * _DL = drive & 0xff + * _DL = drive & 0xff * _BL = driveParam.chs.Sector; * destroy any other register? sure? _really_ sure? * at least, it has it's surprises. @@ -345,7 +345,7 @@ void init_LBA_to_CHS(struct CHS *chs, ULONG LBA_address, { unsigned hs = driveparam->chs.Sector * driveparam->chs.Head; unsigned hsrem = (unsigned)(LBA_address % hs); - + LBA_address /= hs; chs->Cylinder = LBA_address >= 0x10000ul ? 0xffffu : (unsigned)LBA_address; @@ -361,8 +361,8 @@ void printCHS(char *title, struct CHS *chs) /* reason for this modules existence: - - we have found a partition, and add them to the global + + we have found a partition, and add them to the global partition structure. */ @@ -598,7 +598,7 @@ void DosDefinePartition(struct DriveParamS *driveParam, push_ddt(pddt); - /* Alain whishes to keep this in later versions, too + /* Alain whishes to keep this in later versions, too Tom likes this too, so he made it configurable by SYS CONFIG ... */ @@ -710,7 +710,7 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam) driveParam->descflags = DF_LBA; if (lba_bios_parameters.information & 8) driveParam->descflags |= DF_WRTVERIFY; - + StandardBios: /* old way to get parameters */ regs.a.b.h = 0x08; @@ -725,8 +725,8 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam) driveParam->chs.Head = (regs.d.x >> 8) + 1; /* DH = max head value = # of heads - 1 (0-255) */ driveParam->chs.Sector = (regs.c.x & 0x3f); /* CL bits 0-5 = max sector value = # (sectors/track) - 1 (1-63) */ /* max cylinder value = # cylinders - 1 (0-1023) = [high two bits]CL7:6=cyls9:8, [low byte]CH=cyls7:0 */ - driveParam->chs.Cylinder = (regs.c.x >> 8) | ((regs.c.x & 0xc0) << 2) + 1; - + driveParam->chs.Cylinder = (regs.c.x >> 8) | ((regs.c.x & 0xc0) << 2) + 1; + if (driveParam->chs.Sector == 0) { /* happens e.g. with Bochs 1.x if no harddisk defined */ driveParam->chs.Sector = 63; /* avoid division by zero...! */ @@ -864,7 +864,7 @@ BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type, LBA_to_CHS(&chs, partitionStart, driveParam); LBA_to_CHS(&end, partitionStart + pEntry->NumSect - 1, driveParam); - /* some FDISKs enter for partitions + /* some FDISKs enter for partitions > 8 GB cyl = 1023, other (cyl&1023) */ @@ -901,7 +901,7 @@ BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type, continue; } - if (!InitKernelConfig.ForceLBA && !ExtLBAForce + if (!InitKernelConfig.ForceLBA && !ExtLBAForce && !IsLBAPartition(pEntry->FileSystem)) { printf @@ -1151,26 +1151,26 @@ void BIOS_drive_reset(unsigned drive) init_call_intr(0x13, ®s); } -/* +/* thats what MSDN says: How Windows 2000 Assigns, Reserves, and Stores Drive Letters - ID: q234048 - + ID: q234048 + BASIC Disk - Drive Letter Assignment Rules -The following are the basic disk drive letter assignment rules for Windows 2000: -Scan all fixed hard disks as they are enumerated, assign drive letters +The following are the basic disk drive letter assignment rules for Windows 2000: +Scan all fixed hard disks as they are enumerated, assign drive letters starting with any active primary partitions (if there is one), otherwise, -scan the first primary partition on each drive. Assign next available +scan the first primary partition on each drive. Assign next available letter starting with C: -Repeat scan for all fixed hard disks and removable (JAZ, MO) disks -and assign drive letters to all logical drives in an extended partition, -or the removable disk(s) as enumerated. Assign next available letter -starting with C: +Repeat scan for all fixed hard disks and removable (JAZ, MO) disks +and assign drive letters to all logical drives in an extended partition, +or the removable disk(s) as enumerated. Assign next available letter +starting with C: -Finally, repeat scan for all fixed hard disk drives, and assign drive -letters to all remaining primary partitions. Assign next available letter +Finally, repeat scan for all fixed hard disk drives, and assign drive +letters to all remaining primary partitions. Assign next available letter starting with C: Floppy drives. Assign letter starting with A: @@ -1179,49 +1179,49 @@ CD-ROM drives. Assign next available letter starting with D: ************************************************************************* Order in Which MS-DOS and Windows Assign Drive Letters -ID: q51978 - +ID: q51978 + MORE INFORMATION -The following occurs at startup: +The following occurs at startup: -MS-DOS checks all installed disk devices, assigning the drive letter A +MS-DOS checks all installed disk devices, assigning the drive letter A to the first physical floppy disk drive that is found. If a second physical floppy disk drive is present, it is assigned drive letter B. If it is not present, a logical drive B is created that uses the first physical floppy disk drive. -Regardless of whether a second floppy disk drive is present, -MS-DOS then assigns the drive letter C to the primary MS-DOS -partition on the first physical hard disk, and then goes on -to check for a second hard disk. +Regardless of whether a second floppy disk drive is present, +MS-DOS then assigns the drive letter C to the primary MS-DOS +partition on the first physical hard disk, and then goes on +to check for a second hard disk. -If a second physical hard disk is found, and a primary partition exists +If a second physical hard disk is found, and a primary partition exists on the second physical drive, the primary MS-DOS partition on the second -physical hard drive is assigned the letter D. MS-DOS version 5.0, which -supports up to eight physical drives, will continue to search for more -physical hard disk drives at this point. For example, if a third physical -hard disk is found, and a primary partition exists on the third physical -drive, the primary MS-DOS partition on the third physical hard drive is +physical hard drive is assigned the letter D. MS-DOS version 5.0, which +supports up to eight physical drives, will continue to search for more +physical hard disk drives at this point. For example, if a third physical +hard disk is found, and a primary partition exists on the third physical +drive, the primary MS-DOS partition on the third physical hard drive is assigned the letter E. -MS-DOS returns to the first physical hard disk drive and assigns drive -letters to any additional logical drives (in extended MS-DOS partitions) +MS-DOS returns to the first physical hard disk drive and assigns drive +letters to any additional logical drives (in extended MS-DOS partitions) on that drive in sequence. -MS-DOS repeats this process for the second physical hard disk drive, -if present. MS-DOS 5.0 will repeat this process for up to eight physical -hard drives, if present. After all logical drives (in extended MS-DOS -partitions) have been assigned drive letters, MS-DOS 5.0 returns to -the first physical drive and assigns drive letters to any other primary -MS-DOS partitions that exist, then searches other physical drives for -additional primary MS-DOS partitions. This support for multiple primary -MS-DOS partitions was added to version 5.0 for backward compatibility +MS-DOS repeats this process for the second physical hard disk drive, +if present. MS-DOS 5.0 will repeat this process for up to eight physical +hard drives, if present. After all logical drives (in extended MS-DOS +partitions) have been assigned drive letters, MS-DOS 5.0 returns to +the first physical drive and assigns drive letters to any other primary +MS-DOS partitions that exist, then searches other physical drives for +additional primary MS-DOS partitions. This support for multiple primary +MS-DOS partitions was added to version 5.0 for backward compatibility with the previous OEM MS-DOS versions that support multiple primary partitions. -After all logical drives on the hard disk(s) have been assigned drive -letters, drive letters are assigned to drives installed using DRIVER.SYS -or created using RAMDRIVE.SYS in the order in which the drivers are loaded -in the CONFIG.SYS file. Which drive letters are assigned to which devices -can be influenced by changing the order of the device drivers or, if necessary, +After all logical drives on the hard disk(s) have been assigned drive +letters, drive letters are assigned to drives installed using DRIVER.SYS +or created using RAMDRIVE.SYS in the order in which the drivers are loaded +in the CONFIG.SYS file. Which drive letters are assigned to which devices +can be influenced by changing the order of the device drivers or, if necessary, by creating "dummy" drive letters with DRIVER.SYS. ******************************************************** diff --git a/kernel/inithma.c b/kernel/inithma.c index 0462e5d0..362f5262 100644 --- a/kernel/inithma.c +++ b/kernel/inithma.c @@ -29,35 +29,35 @@ /* current status: - + load FreeDOS high, if DOS=HIGH detected - + suppress High Loading, if any SHIFT status detected (for debugging) - + if no XMS driver (HIMEM,FDXMS,...) loaded, should work - + cooperation with XMS drivers as follows: - + copy HMA_TEXT segment up. after each loaded DEVICE=SOMETHING.SYS, try to request the HMA - (XMS function 0x01). + (XMS function 0x01). if no XMS driver detected, during ONFIG.SYS processing, create a dummy VDISK entry in high memory - + this works with - + FD FDXMS - no problems detected - - + + MS HIMEM.SYS (from DOS 6.2, 9-30-93) - + works if and only if - - /TESTMEM:OFF - + + /TESTMEM:OFF + is given - + otherwise HIMEM will TEST AND ZERO THE HIGH MEMORY+HMA. so, in CONFIG.C, if "HIMEM.SYS" is detected, a "/TESTMEM:OFF" parameter is forced. @@ -159,7 +159,7 @@ int EnableHMA(VOID) /* move the kernel up to high memory this is very unportable - + if we thin we succeeded, we return TRUE, else FALSE */ @@ -181,8 +181,8 @@ int MoveKernelToHMA() XMSDriverAddress = xms_addr; #ifdef DEBUG - /* A) for debugging purpose, suppress this, - if any shift key is pressed + /* A) for debugging purpose, suppress this, + if any shift key is pressed */ if (KeyboardShiftState() & 0x0f) { @@ -215,11 +215,11 @@ int MoveKernelToHMA() MoveKernel(0xffff); { - /* E) up to now, nothing really bad was done. + /* E) up to now, nothing really bad was done. but now, we reuse the HMA area. bad things will happen - to find bugs early, - cause INT 3 on all accesses to this area + to find bugs early, + cause INT 3 on all accesses to this area */ DosLoadedInHMA = TRUE; @@ -238,8 +238,8 @@ int MoveKernelToHMA() } -/* - now protect against HIMEM/FDXMS/... by simulating a VDISK +/* + now protect against HIMEM/FDXMS/... by simulating a VDISK FDXMS should detect us and not give HMA access to ohers unfortunately this also disables HIMEM completely @@ -310,7 +310,7 @@ void MoveKernel(unsigned NewKernelSegment) UBYTE FAR *HMASource; unsigned len; unsigned jmpseg = CurrentKernelSegment; - + if (CurrentKernelSegment == 0) CurrentKernelSegment = FP_SEG(_HMATextEnd); @@ -342,11 +342,11 @@ void MoveKernel(unsigned NewKernelSegment) /* first free byte after HMA_TEXT on 16 byte boundary */ { - /* D) but it only makes sense, if we can relocate + /* D) but it only makes sense, if we can relocate all our entries to make use of HMA */ - /* this is for a + /* this is for a call near enableA20 jmp far kernelentry style table diff --git a/kernel/int2f.asm b/kernel/int2f.asm index 4f20bd72..fdc1ef0b 100644 --- a/kernel/int2f.asm +++ b/kernel/int2f.asm @@ -132,9 +132,9 @@ DriverSysCal: ;********************************************************************** -; internal dos calls INT2F/12xx and INT2F/4A01,4A02 - handled through C +; internal dos calls INT2F/12xx and INT2F/4A01,4A02 - handled through C ;********************************************************************** -IntDosCal: +IntDosCal: ; set up register frame ;struct int2f12regs ;{ @@ -142,8 +142,8 @@ IntDosCal: ; UWORD es,ds; ; UWORD di,si,bp,bx,dx,cx,ax; ; UWORD ip,cs,flags; -; UWORD callerARG1; -;} +; UWORD callerARG1; +;} push ax push cx push dx @@ -159,11 +159,11 @@ IntDosCal: %if XCPU >= 386 %ifdef WATCOM mov si,fs - mov di,gs - %else - Protect386Registers + mov di,gs + %else + Protect386Registers %endif -%endif +%endif mov ds,[cs:_DGROUP_] extern _int2F_12_handler @@ -174,10 +174,10 @@ IntDosCal: mov fs,si mov gs,di %else - Restore386Registers + Restore386Registers %endif -%endif - +%endif + pop es pop ds pop di @@ -187,7 +187,7 @@ IntDosCal: pop dx pop cx pop ax - + iret global SHARE_CHECK @@ -195,7 +195,7 @@ SHARE_CHECK: mov ax, 0x1000 int 0x2f ret - + ; DOS calls this to see if it's okay to open the file. ; Returns a file_table entry number to use (>= 0) if okay ; to open. Otherwise returns < 0 and may generate a critical @@ -303,7 +303,7 @@ remote_lseek: ; arg is a pointer to the long seek value mov cx, [bx+2] ; "fall through" -remote_getfattr: +remote_getfattr: clc ; set to succeed int 2fh jc ret_neg_ax @@ -413,7 +413,7 @@ remote_rw: ret_min_dx_ax: neg ax cwd jmp short ret_int2f - + qremote_fn: mov bx, cx lds si, [bx] @@ -498,7 +498,7 @@ segment INIT_TEXT ; int ASMPASCAL UMB_get_largest(void FAR * driverAddress, ; UCOUNT * seg, UCOUNT * size); global UMB_GET_LARGEST - + UMB_GET_LARGEST: push bp mov bp,sp diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 8fa1978c..a0751317 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -61,7 +61,7 @@ struct HugeSectorBlock { /* Normal entry. This minimizes user stack usage by avoiding local */ /* variables needed for the rest of the handler. */ -/* this here works on the users stack !! and only very few functions +/* this here works on the users stack !! and only very few functions are allowed */ VOID ASMCFUNC int21_syscall(iregs FAR * irp) { @@ -175,7 +175,7 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp) int int21_fat32(lregs *r) { COUNT rc; - + switch (r->AL) { /* Get extended drive parameter block */ @@ -183,7 +183,7 @@ int int21_fat32(lregs *r) { struct dpb FAR *dpb; struct xdpbdata FAR *xddp; - + if (r->CX < sizeof(struct xdpbdata)) return DE_INVLDBUF; @@ -194,12 +194,12 @@ int int21_fat32(lregs *r) /* hazard: no error checking! */ flush_buffers(dpb->dpb_unit); dpb->dpb_flags = M_CHANGED; /* force reread of drive BPB/DPB */ - + if (media_check(dpb) < 0) return DE_INVLDDRV; - + xddp = MK_FP(r->ES, r->DI); - + fmemcpy(&xddp->xdd_dpb, dpb, sizeof(struct dpb)); xddp->xdd_dpbsize = sizeof(struct dpb); @@ -219,7 +219,7 @@ int int21_fat32(lregs *r) case 0x03: { struct xfreespace FAR *xfsp = MK_FP(r->ES, r->DI); - + if (r->CX < sizeof(struct xfreespace)) return DE_INVLDBUF; @@ -240,10 +240,10 @@ int int21_fat32(lregs *r) dpb = GetDriveDPB(r->DL, &rc); if (rc != SUCCESS) return rc; - + xdffp->xdff_datasize = sizeof(struct xdpbforformat); xdffp->xdff_version.actual = 0; - + switch ((UWORD) xdffp->xdff_function) { case 0x00: @@ -287,7 +287,7 @@ int int21_fat32(lregs *r) /* hazard: no error checking! */ flush_buffers(dpb->dpb_unit); dpb->dpb_flags = M_CHANGED; - + if (media_check(dpb) < 0) return DE_INVLDDRV; break; @@ -331,7 +331,7 @@ int int21_fat32(lregs *r) default: return DE_INVLDFUNC; } - + break; } /* Extended absolute disk read/write */ @@ -343,28 +343,28 @@ int int21_fat32(lregs *r) UBYTE mode; /* bit 0 of SI is 0 read / 1 write, bits 13/14 indicate a type: */ /* 0 any, 1 fat, 2 dir, 3 file. Type is mostly for "write hints" */ - + if (r->CX != 0xffff || (r->SI & ~0x6001)) { return DE_INVLDPARM; } - + if (r->DL > lastdrive || r->DL == 0) return -0x207; - + if ((r->SI & 1) == 0) /* while uncommon, reads CAN have type hints */ mode = DSKREADINT25; else mode = DSKWRITEINT26; - + r->AX = dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf, SectorBlock->nblks, mode); - + if (mode == DSKWRITEINT26) if (r->AX == 0) setinvld(r->DL - 1); - + if (r->AX > 0) return -0x20c; break; @@ -738,10 +738,10 @@ VOID ASMCFUNC int21_service(iregs FAR * r) if (ReturnAnyDosVersionExpected) { - /* TE for testing purpose only and NOT + /* TE for testing purpose only and NOT to be documented: return programs, who ask for version == XX.YY - exactly this XX.YY. + exactly this XX.YY. this makes most MS programs more happy. */ UBYTE FAR *retp = MK_FP(r->cs, r->ip); @@ -781,14 +781,14 @@ VOID ASMCFUNC int21_service(iregs FAR * r) { int drv = (lr.DL == 0 || lr.AH == 0x1f) ? default_drive : lr.DL - 1; struct dpb FAR *dpb = get_dpb(drv); - + if (dpb == NULL) { CritErrCode = -DE_INVLDDRV; lr.AL = 0xFF; break; } - /* hazard: no error checking! */ + /* hazard: no error checking! */ flush_buffers(dpb->dpb_unit); dpb->dpb_flags = M_CHANGED; /* force flush and reread of drive BPB/DPB */ @@ -809,7 +809,7 @@ VOID ASMCFUNC int21_service(iregs FAR * r) break; /* - case 0x33: + case 0x33: see int21_syscall */ /* Get InDOS flag */ @@ -1107,7 +1107,7 @@ VOID ASMCFUNC int21_service(iregs FAR * r) lr.AX = 0; goto short_check; /* - case 0x50: + case 0x50: case 0x51: see int21_syscall */ @@ -1356,7 +1356,7 @@ VOID ASMCFUNC int21_service(iregs FAR * r) break; #endif - /* UNDOCUMENTED: return current psp + /* UNDOCUMENTED: return current psp case 0x62: is in int21_syscall lr.BX = cu_psp; break; @@ -1369,7 +1369,7 @@ VOID ASMCFUNC int21_service(iregs FAR * r) #if 0 /* not really supported, but will pass. */ lr.AL = 0x00; /*jpp: according to interrupt list */ - /*Bart: fails for PQDI and WATCOM utilities: + /*Bart: fails for PQDI and WATCOM utilities: use the above again */ #endif switch (lr.AL) @@ -1622,8 +1622,8 @@ struct int25regs { UWORD flags, ip, cs; }; -/* - this function is called from an assembler wrapper function +/* + this function is called from an assembler wrapper function */ VOID ASMCFUNC int2526_handler(WORD mode, struct int25regs FAR * r) { @@ -1789,18 +1789,18 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) --p->sft_count; } break; - + case 0x0a: /* perform critical error */ /* differs from 0x06 as uses current drive & error on stack */ /* code, drive number, error, device header */ r.AL = CriticalError(0x38, /* ignore/retry/fail - based on RBIL possible return values */ - default_drive, - r.callerARG1, /* error, from RBIL passed on stack */ + default_drive, + r.callerARG1, /* error, from RBIL passed on stack */ CDSp[(WORD)default_drive].cdsDpb->dpb_device); r.FLAGS |= FLG_CARRY; if (r.AL == 1) r.FLAGS &= ~FLG_CARRY; /* carry clear if should retry */ break; - + case 0x0b: /* sharing violation occurred */ { /* ES:DI = SFT for previous open of file */ @@ -1811,8 +1811,8 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) if ((sftp->sft_mode & O_FCB) || !(sftp->sft_mode & (O_SHAREMASK | O_NOINHERIT))) { r.AL = CriticalError(0x38, /* ignore/retry/fail - ??? */ - default_drive, - r.callerARG1, /* error, from RBIL passed on stack */ + default_drive, + r.callerARG1, /* error, from RBIL passed on stack */ CDSp[(WORD)default_drive].cdsDpb->dpb_device); /* clear carry if should retry */ if (r.AL == 1) r.FLAGS &= ~FLG_CARRY; @@ -1872,7 +1872,7 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) break; case 0x13: - /* uppercase character */ + /* uppercase character */ /* for now, ASCII only because nls.c cannot handle DS!=SS */ r.AL = (unsigned char)r.callerARG1; if (r.AL >= 'a' && r.AL <= 'z') @@ -1905,7 +1905,7 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) ; returns ; CF set if error ; DS:SI pointer to CDS for drive - ; + ; ; called like ; push 2 (c-drive) ; mov ax,1217 @@ -2047,10 +2047,10 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) goto error_carry; } break; - + case 0x2c: /* added by James Tabor For Zip Drives Return Null Device Pointer */ - /* by UDOS+RBIL: get header of SECOND device driver in device chain, + /* by UDOS+RBIL: get header of SECOND device driver in device chain, omitting the NUL device TE */ r.BX = FP_SEG(nul_dev.dh_next); r.AX = FP_OFF(nul_dev.dh_next); diff --git a/kernel/intr.asm b/kernel/intr.asm index da14d5bc..46711107 100644 --- a/kernel/intr.asm +++ b/kernel/intr.asm @@ -28,7 +28,7 @@ %include "segs.inc" %macro INTR 0 - + push bp ; Standard C entry mov bp,sp push si @@ -103,7 +103,7 @@ RES_DOSEXEC: pop ax ; mode push es ; ret address mov ah, 4bh - push ds + push ds pop es ; es = ds int 21h jc short no_exec_error @@ -111,7 +111,7 @@ RES_DOSEXEC: no_exec_error: ret -;; UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count); +;; UCOUNT ASMPASCAL res_read(int fd, void *buf, UCOUNT count); global RES_READ RES_READ: pop ax ; ret address @@ -139,7 +139,7 @@ INIT_CALL_INTR: ; ; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX) ; -; this calls HIMEM.SYS +; this calls HIMEM.SYS ; global INIT_CALL_XMSCALL INIT_CALL_XMSCALL: @@ -154,7 +154,7 @@ INIT_CALL_XMSCALL: push es ; driver address ("jmp es:cx") push cx retf - + ; void FAR *DetectXMSDriver(VOID) global DETECTXMSDRIVER DETECTXMSDRIVER: @@ -172,22 +172,22 @@ detected: push bx mov ax, 4310h ; XMS get driver address int 2fh - + mov ax, bx mov dx, es pop bx pop es - ret + ret global KEYCHECK KEYCHECK: mov ah, 1 int 16h - ret + ret -;; int open(const char *pathname, int flags); +;; int open(const char *pathname, int flags); global INIT_DOSOPEN -INIT_DOSOPEN: +INIT_DOSOPEN: ;; init calling DOS through ints: pop bx ; ret address pop ax ; flags @@ -205,16 +205,16 @@ common_no_error: ;; int close(int fd); global CLOSE -CLOSE: +CLOSE: pop ax ; ret address pop bx ; fd push ax ; ret address mov ah, 3eh jmp short common_int21 -;; UCOUNT read(int fd, void *buf, UCOUNT count); +;; UCOUNT read(int fd, void *buf, UCOUNT count); global READ -READ: +READ: pop ax ; ret address pop cx ; count pop dx ; buf @@ -223,7 +223,7 @@ READ: mov ah, 3fh jmp short common_int21 -;; int dup2(int oldfd, int newfd); +;; int dup2(int oldfd, int newfd); global DUP2 DUP2: pop ax ; ret address @@ -232,7 +232,7 @@ DUP2: push ax ; ret address mov ah, 46h jmp short common_int21 - + ; ; ULONG ASMPASCAL lseek(int fd, long position); ; @@ -250,7 +250,7 @@ LSEEK: sbb dx,dx seek_ret: ret - + ;; VOID init_PSPSet(seg psp_seg) global INIT_PSPSET INIT_PSPSET: @@ -270,7 +270,7 @@ INIT_DOSEXEC: pop ax ; mode push es ; ret address mov ah, 4bh - push ds + push ds pop es ; es = ds int 21h jc short exec_no_error @@ -308,8 +308,8 @@ ALLOCMEM: sbb bx, bx ; carry=1 -> ax=-1 or ax, bx ; segment ret - -;; void set_DTA(void far *dta) + +;; void set_DTA(void far *dta) global SET_DTA SET_DTA: pop ax ; ret address diff --git a/kernel/io.asm b/kernel/io.asm index ee8b30ac..34c8f790 100644 --- a/kernel/io.asm +++ b/kernel/io.asm @@ -42,7 +42,7 @@ extern _reloc_call_blk_driver extern _reloc_call_clk_driver - extern _TEXT_DGROUP:wrt LGROUP + extern _TEXT_DGROUP:wrt LGROUP ;--------------------------------------------------- ; @@ -63,13 +63,13 @@ huge equ 26 ; First block (32-bit) to transfer ; ; The following is the "array" of device driver headers for the internal -; devices. There is one header per device including special aux: and prn: -; pseudo devices. These psuedo devices are necessary for printer +; devices. There is one header per device including special aux: and prn: +; pseudo devices. These psuedo devices are necessary for printer ; redirection, i.e., serial or parallel ports, and com port aux selection. ; -; The devices are linked into each other and terminate with a -1 next +; The devices are linked into each other and terminate with a -1 next ; pointer. This saves some time on boot up and also allows us to throw all -; device initialization into a single io_init function that may be placed +; device initialization into a single io_init function that may be placed ; into a discardable code segmemnt. ; segment _IO_FIXED_DATA @@ -207,7 +207,7 @@ uUnitNumber dw 0 ; Store the pointer to the request packet passed in es:bx ; ; Description: -; Generic strategy routine. Unlike the original multitasking versions, +; Generic strategy routine. Unlike the original multitasking versions, ; this version assumes that no more thank one device driver is active ; at any time. The request is stored into memory in the one and only ; location available for that purpose. @@ -227,23 +227,23 @@ GenStrategy: ; Individual Interrupt routines for each device driver ; ; Description: -; This is actually a single routine with entry points for each device. -; The name used for the entry point is the device name with Intr +; This is actually a single routine with entry points for each device. +; The name used for the entry point is the device name with Intr ; appended to it. ; -; Funtionally, each device driver has an entry and an associated -; table. The table is a structure that consists of a control byte -; followed by an array of pointers to C functions or assembly -; subroutines that implement the individual device driver functions. -; This allows the usage of common error dummy filler code to be used. -; It also allows standardization of the calling procedure for these +; Funtionally, each device driver has an entry and an associated +; table. The table is a structure that consists of a control byte +; followed by an array of pointers to C functions or assembly +; subroutines that implement the individual device driver functions. +; This allows the usage of common error dummy filler code to be used. +; It also allows standardization of the calling procedure for these ; internal device driver functions. ; ; Assembler call/return convention: -; Each driver function is entered by a jump into the function and -; exits by a jump to the appropriate success or error exit routine. -; This speeds up the call and return and helps to minimize the stack -; useage. The contents of the request packet are passed to each +; Each driver function is entered by a jump into the function and +; exits by a jump to the appropriate success or error exit routine. +; This speeds up the call and return and helps to minimize the stack +; useage. The contents of the request packet are passed to each ; routine in registers as follows: ; ; Register Function Description @@ -257,25 +257,25 @@ GenStrategy: ; cs kernel code segment ; ds kernel data segment ; -; The exit routines generally set the status based on the individual -; routine. For example, _IOSuccess will clear the count where -; _IOErrCnt will subtract the remaining amount in cx from the original +; The exit routines generally set the status based on the individual +; routine. For example, _IOSuccess will clear the count where +; _IOErrCnt will subtract the remaining amount in cx from the original ; count. See each utility routine for expectations. ; ; C call/return convention: ; The C calling convention simply sets up the C stack and passes the -; request packet pointer as a far pointer to the function. Although -; the utility routine names are such that they are accesible from the -; C name space, they are cannot used. Instead, the common interrupt -; code expects a return status to set in the request packet. It is up -; to the device driver function to set the appropriate fields such as +; request packet pointer as a far pointer to the function. Although +; the utility routine names are such that they are accesible from the +; C name space, they are cannot used. Instead, the common interrupt +; code expects a return status to set in the request packet. It is up +; to the device driver function to set the appropriate fields such as ; count when an error occurs. ; ; How to differntiate between the two calling conventions: -; This code is entirely table driven. The table is a structure that -; is generally in the _IO_FIXED_DATA segment. It consists of a flag -; byte followed by short pointers to the driver functions. Selecting -; a driver type is accomplished by setting the type bit in the flag +; This code is entirely table driven. The table is a structure that +; is generally in the _IO_FIXED_DATA segment. It consists of a flag +; byte followed by short pointers to the driver functions. Selecting +; a driver type is accomplished by setting the type bit in the flag ; (see below). ; ; 7 6 5 4 3 2 1 0 @@ -416,13 +416,13 @@ AsmType: mov al,[bx+unit] ; Exit routines for internal device drivers. ; ; Description: -; These routines are the exit for internal device drivers. _IOSuccess -; is for read/write functions and correctly returns for a successful -; read/write operation by setting the remainng count to zero. _IOExit -; simply sets success bit and returns. _IODone returns complete and -; busy status. _IOCommandError returns and error status for invalid -; commands. _IOErrCnt corrects the remaining bytes for errors that -; occurred during partial read/write operation. _IOErrorExit is a +; These routines are the exit for internal device drivers. _IOSuccess +; is for read/write functions and correctly returns for a successful +; read/write operation by setting the remainng count to zero. _IOExit +; simply sets success bit and returns. _IODone returns complete and +; busy status. _IOCommandError returns and error status for invalid +; commands. _IOErrCnt corrects the remaining bytes for errors that +; occurred during partial read/write operation. _IOErrorExit is a ; generic error exit that sets done and error. ; global _IOSuccess @@ -460,7 +460,7 @@ _IOCommandError: mov al,3 global _IOErrCnt -_IOErrCnt: +_IOErrCnt: lds bx,[cs:_ReqPktPtr] sub [bx+count],cx global _IOErrorExit @@ -476,8 +476,8 @@ _IOErrorExit: ; Return the internally set unit number. ; ; Description: -; Simply return the contents of uUnitNumber. This version relies on -; no segment registers and makes a safe call regardless of driver +; Simply return the contents of uUnitNumber. This version relies on +; no segment registers and makes a safe call regardless of driver ; state. ; global GetUnitNum @@ -486,7 +486,7 @@ GetUnitNum: ret ; - ; These are still old style DOS-C drivers. I'll replace + ; These are still old style DOS-C drivers. I'll replace ; them in the next release ; @@ -512,9 +512,9 @@ clk_driver_params: clk_entry: pushf push bx - + mov bx, clk_driver_params - + jmp short clk_and_blk_common @@ -522,16 +522,16 @@ clk_entry: blk_entry: pushf push bx - + mov bx, blk_driver_params - -clk_and_blk_common: - + +clk_and_blk_common: + push ax push cx push dx - + ; small model mov ax,sp ; use internal stack mov dx,ss @@ -540,15 +540,15 @@ clk_and_blk_common: cli ; no interrupts mov ss,[cs:_TEXT_DGROUP] mov sp,[cs:bx] - + push cx popf ; restore interrupt flag - - + + push ax ; save old SS/SP push dx - + ; push these registers on push ds ; BLK_STACK push bp ; to save stack space @@ -557,30 +557,30 @@ clk_and_blk_common: push es Protect386Registers - mov ds,[cs:_TEXT_DGROUP] ; - - + mov ds,[cs:_TEXT_DGROUP] ; + + push word [cs:_ReqPktPtr+2] push word [cs:_ReqPktPtr] call far [cs:bx+2] pop cx pop cx - + les bx,[cs:_ReqPktPtr] ; now return completion code mov word [es:bx+status],ax ; mark operation complete - - + + Restore386Registers pop es pop di pop si pop bp pop ds - + pop dx ; get back old SS/SP pop ax - + cli ; no interrupts mov ss,dx ; use dos stack mov sp,ax diff --git a/kernel/ioctl.c b/kernel/ioctl.c index 9ea4d7a1..721d84bf 100644 --- a/kernel/ioctl.c +++ b/kernel/ioctl.c @@ -44,11 +44,11 @@ static BYTE *RcsId = MS NET plays by its own rules at least TE's network card driver DM9PCI (some 10$ NE2000 clone) does: - with SP=8DC before calling down to execrh, and SP=8CC when - callf [interrupt], DM9PCI touches DOSDS:792, + with SP=8DC before calling down to execrh, and SP=8CC when + callf [interrupt], DM9PCI touches DOSDS:792, 14 bytes into error stack :-((( - - so some optimizations were made. + + so some optimizations were made. this uses the fact, that only CharReq device buffer is ever used. fortunately, this saves some code as well :-) diff --git a/kernel/irqstack.asm b/kernel/irqstack.asm index a283a012..ff6e8568 100644 --- a/kernel/irqstack.asm +++ b/kernel/irqstack.asm @@ -30,7 +30,7 @@ ; Code for stack switching during hardware interrupts. -; Format of interrupt sharing protocol interrupt handler entry point: +; Format of interrupt sharing protocol interrupt handler entry point: ; Offset Size Description (Table 02568) ; 00h 2 BYTEs short jump to actual start of interrupt handler, immediately ; following this data block (EBh 10h) @@ -106,7 +106,7 @@ general_irq_service: mov bx, sp mov bx, [ss:bx+2] ; return address->old ivec jmp short common_irq - + general_irq_service_share: push bx mov bx, sp @@ -167,7 +167,7 @@ global _init_stacks int_numbers: db 2,8,9,70h,75h int_numbers_share: db 0ah,0bh,0ch,0dh,0eh,72h,73h,74h,76h,77h - + _init_stacks: push bp mov bp, sp @@ -192,7 +192,7 @@ _init_stacks: mul cx add ax, bx ; stack_top = stack_size * nStacks + stack_seg:stack_offs - mov [stack_top], ax + mov [stack_top], ax xor ax, ax mov ds, ax diff --git a/kernel/kernel.asm b/kernel/kernel.asm index 98928441..5b8581b7 100644 --- a/kernel/kernel.asm +++ b/kernel/kernel.asm @@ -38,20 +38,20 @@ segment PSP STACK_SIZE equ 384/2 ; stack allocated in words -;************************************************************ +;************************************************************ ; KERNEL BEGINS HERE, i.e. this is byte 0 of KERNEL.SYS -;************************************************************ +;************************************************************ ..start: -entry: +entry: jmp short realentry -;************************************************************ +;************************************************************ ; KERNEL CONFIGURATION AREA ; this is copied up on the very beginning ; it's a good idea to keep this in sync with KConfig.h -;************************************************************ - global _LowKernelConfig +;************************************************************ + global _LowKernelConfig _LowKernelConfig: db 'CONFIG' ; constant dw configend-configstart; size of config area @@ -74,20 +74,20 @@ Version_Release dw 1 ; 0=release build, >0=svn# configend: -;************************************************************ +;************************************************************ ; KERNEL CONFIGURATION AREA END -;************************************************************ +;************************************************************ -;************************************************************ +;************************************************************ ; KERNEL real entry (at ~60:20) -; +; ; moves the INIT part of kernel.sys to high memory (~9000:0) ; then jumps there ; to aid debugging, some '123' messages are output ; this area is discardable and used as temporary PSP for the ; init sequence -;************************************************************ +;************************************************************ cpu 8086 ; (keep initial entry compatible) @@ -95,9 +95,9 @@ realentry: ; execution continues here push ax push bx - pushf + pushf mov ax, 0e31h ; '1' Tracecode - kernel entered - mov bx, 00f0h + mov bx, 00f0h int 010h popf pop bx @@ -111,16 +111,16 @@ segment INIT_TEXT extern _FreeDOSmain extern _query_cpu - + ; ; kernel start-up ; kernel_start: push bx - pushf + pushf mov ax, 0e32h ; '2' Tracecode - kernel entered - mov bx, 00f0h + mov bx, 00f0h int 010h popf pop bx @@ -168,7 +168,7 @@ kernel_start: mov di,si shr cx,1 rep movsw - + cld %ifndef WATCOM ; for WATCOM: CS equal for HMA and INIT add ax,dx @@ -183,9 +183,9 @@ cont: ; Now set up call frame mov bp,sp ; and set up stack frame for c push bx - pushf + pushf mov ax, 0e33h ; '3' Tracecode - kernel entered - mov bx, 00f0h + mov bx, 00f0h int 010h popf pop bx @@ -209,7 +209,7 @@ cont: ; Now set up call frame cpu XCPU %endif mov [_CPULevel], al - + mov ax,ss mov ds,ax mov es,ax @@ -240,7 +240,7 @@ cpu_abort: mov bl, 07h ; page in bh, bl = colour for some modes int 10h ; write character (may change bp!) - db 0A8h ; [test al,imm8] skip "pop si" [=imm8] after the first iteration + db 0A8h ; [test al,imm8] skip "pop si" [=imm8] after the first iteration .first: pop si ; (first iteration only) get message address from stack cs lodsb ; get character @@ -276,10 +276,10 @@ cpu_abort: segment INIT_TEXT_END -;************************************************************ +;************************************************************ ; KERNEL CODE AREA END ; the NUL device -;************************************************************ +;************************************************************ segment CONST @@ -330,9 +330,9 @@ _intvec_table: db 10h global _int1e_table _int1e_table: times 0eh db 0 -;************************************************************ -; KERNEL FIXED DATA AREA -;************************************************************ +;************************************************************ +; KERNEL FIXED DATA AREA +;************************************************************ segment _FIXED_DATA @@ -396,7 +396,7 @@ _lastdrive db 0 ; 0021 value of last drive _nul_dev: ; 0022 device chain root extern _con_dev:wrt LGROUP dw _con_dev, seg _con_dev - ; next is con_dev at init time. + ; next is con_dev at init time. dw 8004h ; attributes = char device, NUL bit set dw _nul_strtgy dw _nul_intr @@ -411,7 +411,7 @@ setverPtr dw 0,0 ; 0037 setver list _LoL_nbuffers dw 1 ; 003F number of buffers dw 1 ; 0041 size of pre-read buffer global _BootDrive -_BootDrive db 1 ; 0043 drive we booted from +_BootDrive db 1 ; 0043 drive we booted from global _CPULevel _CPULevel db 0 ; 0044 cpu type (MSDOS >0 indicates dword moves ok, ie 386+) @@ -420,7 +420,7 @@ _CPULevel db 0 ; 0044 cpu type (MSDOS >0 indicates dwor ; see cpu.asm, use >= as may add checks for 486 ... dw 0 ; 0045 Extended memory in KBytes -buf_info: +buf_info: global _firstbuf _firstbuf dd 0 ; 0047 disk buffer chain dw 0 ; 004B Number of dirty buffers @@ -438,7 +438,7 @@ _VgaSet db 0 ; 0060 unknown dw 0 ; 0061 unknown global _uppermem_link _uppermem_link db 0 ; 0063 upper memory link flag -_min_pars dw 0 ; 0064 minimum paragraphs of memory +_min_pars dw 0 ; 0064 minimum paragraphs of memory ; required by program being EXECed global _uppermem_root _uppermem_root dw 0ffffh ; 0066 dmd_upper_root (usually 9fff) @@ -455,10 +455,10 @@ _os_setver_minor db 0 _os_setver_major db 5 global _os_minor _os_minor db 0 - global _os_major + global _os_major _os_major db 5 _rev_number db 0 - global _version_flags + global _version_flags _version_flags db 0 global os_release @@ -495,17 +495,17 @@ _winPatchTable: ; returns offsets to various internal variables ; an empty table, purposely not _CritPatch ; ie we just point to a 0 word to mark end dw _uppermem_root ; seg of last arena header in conv memory - ; this matches MS DOS's location, but + ; this matches MS DOS's location, but ; do we have the same meaning? %ENDIF ; WIN31SUPPORT ;; The first 5 sft entries appear to have to be at DS:00cc times (0cch - ($ - DATASTART)) db 0 global _firstsftt -_firstsftt: +_firstsftt: dd -1 ; link to next - dw 5 ; count - + dw 5 ; count + ; Some references seem to indicate that this data should start at 01fbh in ; order to maintain 100% MS-DOS compatibility. times (01fbh - ($ - DATASTART)) db 0 @@ -629,7 +629,7 @@ daysSince1980 dw 0FFFFh ; 34 - number of days since epoch global _DayOfWeek _DayOfWeek db 2 ; 36 - day of week _console_swap db 0 ; 37 console swapped during read from dev - global _dosidle_flag + global _dosidle_flag _dosidle_flag db 1 ; 38 - safe to call int28 if nonzero _abort_progress db 0 ; 39 - abort in progress global _CharReqHdr @@ -796,7 +796,7 @@ init_tos: resb 16 global __init_end __init_end: -init_end: +init_end: segment _DATA ; blockdev private stack @@ -835,7 +835,7 @@ _Dyn: markEndInstanceData: ; mark end of DOS data seg we say needs instancing - + segment ID_B global __INIT_DATA_START __INIT_DATA_START: @@ -859,14 +859,14 @@ segment HMA_TEXT_START global __HMATextAvailable __HMATextAvailable: global __HMATextStart -__HMATextStart: - -; +__HMATextStart: + +; ; the HMA area is filled with 1eh+3(=sizeof VDISK) = 33 byte dummy data, ; so nothing will ever be below 0xffff:0031 ; segment HMA_TEXT -begin_hma: +begin_hma: times 10h db 0 ; filler [ffff:0..ffff:10] times 20h db 0 db 0 @@ -889,7 +889,7 @@ __U4D: ; reserve space for far jump to cp/m routine resb 5 -;End of HMA segment +;End of HMA segment segment HMA_TEXT_END global __HMATextEnd __HMATextEnd: ; and c version @@ -903,7 +903,7 @@ segment _STACK class=STACK stack - + segment CONST ; dummy interrupt return handlers @@ -912,20 +912,20 @@ segment CONST global _int28_handler global _int2a_handler global _empty_handler -_int22_handler: +_int22_handler: _int28_handler: _int2a_handler: _empty_handler: iret - + global _initforceEnableA20 initforceEnableA20: call near forceEnableA20 - retf + retf global __HMARelocationTableStart -__HMARelocationTableStart: +__HMARelocationTableStart: global _int2f_handler extern reloc_call_int2f_handler @@ -1002,7 +1002,7 @@ _init_call_p_0: jmp 0:reloc_call_p_0 global __HMARelocationTableEnd -__HMARelocationTableEnd: +__HMARelocationTableEnd: ; ; if we were lucky, we found all entries from the outside to the kernel. @@ -1015,14 +1015,14 @@ __HMARelocationTableEnd: ; for obvious reasons it should be located at the relocation table ; global _XMSDriverAddress -_XMSDriverAddress: +_XMSDriverAddress: dw 0 ; XMS driver, if detected dw 0 global _ENABLEA20 _ENABLEA20: mov ah,5 -UsingXMSdriver: +UsingXMSdriver: push bx call far [cs:_XMSDriverAddress] pop bx @@ -1042,25 +1042,25 @@ forceEnableA20: push ds push es push ax - -forceEnableA20retry: + +forceEnableA20retry: mov ds, [cs:dslowmem] mov es, [cs:eshighmem] - - mov ax, [ds:00000h] - cmp ax, [es:00010h] + + mov ax, [ds:00000h] + cmp ax, [es:00010h] jne forceEnableA20success - mov ax, [ds:00002h] - cmp ax, [es:00012h] + mov ax, [ds:00002h] + cmp ax, [es:00012h] jne forceEnableA20success - mov ax, [ds:00004h] - cmp ax, [es:00014h] + mov ax, [ds:00004h] + cmp ax, [es:00014h] jne forceEnableA20success - mov ax, [ds:00006h] - cmp ax, [es:00016h] + mov ax, [ds:00006h] + cmp ax, [es:00016h] jne forceEnableA20success ; @@ -1068,17 +1068,17 @@ forceEnableA20retry: ; call far _ENABLEA20 - + jmp short forceEnableA20retry - - - -forceEnableA20success: + + + +forceEnableA20success: pop ax pop es pop ds ret - + ; ; global f*cking compatibility issues: ; @@ -1094,12 +1094,12 @@ _ExecUserDisableA20: jne NeedToDisable cmp word [cs:_XMSDriverAddress+2], byte 0 je noNeedToDisable -NeedToDisable: - push ax +NeedToDisable: + push ax call far _DISABLEA20 pop ax noNeedToDisable: - iret + iret ; diff --git a/kernel/lfnapi.c b/kernel/lfnapi.c index b725d19f..0527a81a 100644 --- a/kernel/lfnapi.c +++ b/kernel/lfnapi.c @@ -136,7 +136,7 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip) entries_needed = (ufstrlen(lfn_name) + CHARS_IN_LFN_ENTRY - 1) / CHARS_IN_LFN_ENTRY + 1; /* We want to create SFN entry too */ - + /* Scan the directory from the very begining for the free directory entries */ lfn_setup_inode(handle, fnp->f_dirstart, 0); @@ -170,7 +170,7 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip) /* Write SFN entry */ fmemcpy(&fnp->f_dir, &lip->l_dir, sizeof(struct dirent)); dir_write(fnp); - + fnp->f_diroff--; /* Go in the reverse direction and create LFN entries */ for (i = 0; i < entries_needed - 1; i++, id++) @@ -186,7 +186,7 @@ COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip) fnp->f_diroff--; } fnp->f_flags.f_dmod = FALSE; - + fnp->f_diroff = sfn_offset; return SUCCESS; @@ -223,8 +223,8 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip) sfn_diroff = fnp->f_diroff; break; } - } - + } + /* Go in the reverse direction and find the LFN entries corresponding to * the found SFN entry */ while (TRUE) @@ -315,7 +315,7 @@ BOOL transfer_unicode(UNICODE FAR **dptr, UNICODE FAR **sptr, COUNT count) BOOL lfn_to_unicode(UNICODE FAR **name, struct lfn_entry FAR *lep) { UNICODE FAR *ptr; - + ptr = lep->lfn_name0_4; if (transfer_unicode(name, &ptr, 5)) return TRUE; ptr = lep->lfn_name5_10; @@ -331,7 +331,7 @@ BOOL lfn_to_unicode(UNICODE FAR **name, struct lfn_entry FAR *lep) VOID unicode_to_lfn(UNICODE FAR **name, struct lfn_entry FAR *lep) { UNICODE FAR *ptr; - + ptr = lep->lfn_name0_4; transfer_unicode(&ptr, name, 5); ptr = lep->lfn_name5_10; diff --git a/kernel/ludivmul.inc b/kernel/ludivmul.inc index 1b2a80db..39f3dbaa 100644 --- a/kernel/ludivmul.inc +++ b/kernel/ludivmul.inc @@ -1,5 +1,5 @@ ; this one adapted from elks, http://elks.sourceforge.net -; multiply cx:bx * dx:ax, result in dx:ax +; multiply cx:bx * dx:ax, result in dx:ax %macro LMULU 0 @@ -28,11 +28,11 @@ ; Dividing 64-bit unsigned integers Assembler / 80386 -; Here is a division routine for dividing two 64-bit unsigned integers. +; Here is a division routine for dividing two 64-bit unsigned integers. ; I derived it by modifying some old -; 16-bit code for dividing 32-bit integers that I did several years ago for a +; 16-bit code for dividing 32-bit integers that I did several years ago for a ; Turbo-Pascal replacement library. -; If a 64-bit signed integer division is needed, appropriate shell code for +; If a 64-bit signed integer division is needed, appropriate shell code for ; this routine can easily be written. ; ; (adapted back to 32-bit by Bart Oldeman ;-)) @@ -63,7 +63,7 @@ div bx ; quotient-hi in eax xchg ax, cx ; cx = quotient-hi, ax =dividend-lo -%%one_div: +%%one_div: div bx ; ax = quotient-lo mov bx, dx ; bx = remainder-lo mov dx, cx ; dx = quotient-hi(quotient in dx:ax) @@ -105,8 +105,8 @@ adc cx, di ; and quotient if add ax, dx ; necessary xor dx, dx ; clear hi-word of quot (ax<=FFFFFFFFh) - pop di ; restore temp + pop di ; restore temp pop si ; variables ret -%endmacro \ No newline at end of file +%endmacro \ No newline at end of file diff --git a/kernel/main.c b/kernel/main.c index c9a52c8a..6f197216 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -61,7 +61,7 @@ STATIC void setup_int_vectors(void); #ifdef _MSC_VER BYTE _acrtused = 0; -__segment DosDataSeg = 0; /* serves for all references to the DOS DATA segment +__segment DosDataSeg = 0; /* serves for all references to the DOS DATA segment necessary for MSC+our funny linking model */ __segment DosTextSeg = 0; @@ -132,7 +132,7 @@ VOID ASMCFUNC FreeDOSmain(void) /* InitializeAllBPBs() - + or MakeNortonDiskEditorHappy() it has been determined, that FDOS's BPB tables are initialized, @@ -343,7 +343,7 @@ STATIC void init_kernel(void) /* Init the file system one more time */ FsConfig(); - + configDone(); InitializeAllBPBs(); @@ -647,7 +647,7 @@ VOID init_fatal(BYTE * err_msg) /* Initialize all printers - + this should work. IMHO, this might also be done on first use of printer, as I never liked the noise by a resetting printer, and I usually much more often reset my system, then I print :-) @@ -692,9 +692,9 @@ STATIC VOID InitSerialPorts(VOID) the default is to boot from harddisk, because the user is assumed to just have forgotten to remove the floppy/bootable CD from the drive. - + user has some seconds to hit ANY key to continue - to boot from floppy/cd, else the system is + to boot from floppy/cd, else the system is booted from HD */ @@ -706,14 +706,14 @@ STATIC int EmulatedDriveStatus(int drive,char statusOnly) r.a.b.h = 0x4b; /* bootable CDROM - get status */ r.a.b.l = statusOnly; - r.d.b.l = (char)drive; + r.d.b.l = (char)drive; r.si = (int)buffer; - init_call_intr(0x13, &r); - + init_call_intr(0x13, &r); + if (r.flags & 1) return FALSE; - - return TRUE; + + return TRUE; } STATIC void CheckContinueBootFromHarddisk(void) @@ -753,7 +753,7 @@ STATIC void CheckContinueBootFromHarddisk(void) ); key = GetBiosKey(InitKernelConfig.BootHarddiskSeconds); - + if (key != -1 && (key & 0xff) != 'h' && (key & 0xff) != 'H') { /* user has hit a key, continue to boot from floppy/CD */ diff --git a/kernel/makefile b/kernel/makefile index 029ca93f..54502d6e 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -97,24 +97,24 @@ HDRS=\ HEADERS=$(HDRS) globals.h proto.h INITHEADERS=$(HDRS) init-mod.h init-dat.h -blockio.obj: blockio.c $(HEADERS) $(TARGET).lnk -break.obj: break.c $(HEADERS) $(TARGET).lnk -chario.obj: chario.c $(HEADERS) $(TARGET).lnk -dosfns.obj: dosfns.c $(HEADERS) $(TARGET).lnk -dsk.obj: dsk.c $(HEADERS) $(TARGET).lnk -error.obj: error.c $(HEADERS) $(TARGET).lnk -fatdir.obj: fatdir.c $(HEADERS) $(TARGET).lnk -fatfs.obj: fatfs.c $(HEADERS) $(TARGET).lnk -fattab.obj: fattab.c $(HEADERS) $(TARGET).lnk -fcbfns.obj: fcbfns.c $(HEADERS) $(TARGET).lnk -inthndlr.obj: inthndlr.c $(HEADERS) $(TARGET).lnk -ioctl.obj: ioctl.c $(HEADERS) $(TARGET).lnk -memmgr.obj: memmgr.c $(HEADERS) $(TARGET).lnk -misc.obj: misc.c $(HEADERS) $(TARGET).lnk +blockio.obj: blockio.c $(HEADERS) $(TARGET).lnk +break.obj: break.c $(HEADERS) $(TARGET).lnk +chario.obj: chario.c $(HEADERS) $(TARGET).lnk +dosfns.obj: dosfns.c $(HEADERS) $(TARGET).lnk +dsk.obj: dsk.c $(HEADERS) $(TARGET).lnk +error.obj: error.c $(HEADERS) $(TARGET).lnk +fatdir.obj: fatdir.c $(HEADERS) $(TARGET).lnk +fatfs.obj: fatfs.c $(HEADERS) $(TARGET).lnk +fattab.obj: fattab.c $(HEADERS) $(TARGET).lnk +fcbfns.obj: fcbfns.c $(HEADERS) $(TARGET).lnk +inthndlr.obj: inthndlr.c $(HEADERS) $(TARGET).lnk +ioctl.obj: ioctl.c $(HEADERS) $(TARGET).lnk +memmgr.obj: memmgr.c $(HEADERS) $(TARGET).lnk +misc.obj: misc.c $(HEADERS) $(TARGET).lnk lfnapi.obj: lfnapi.c $(HEADERS) $(TARGET).lnk -newstuff.obj: newstuff.c $(HEADERS) $(TARGET).lnk -network.obj: network.c $(HEADERS) $(TARGET).lnk -nls.obj: nls.c $(HEADERS) $(TARGET).lnk +newstuff.obj: newstuff.c $(HEADERS) $(TARGET).lnk +network.obj: network.c $(HEADERS) $(TARGET).lnk +nls.obj: nls.c $(HEADERS) $(TARGET).lnk prf.obj: prf.c $(HDR)portab.h $(TARGET).lnk strings.obj: strings.c $(TARGET).lnk sysclk.obj: sysclk.c $(HEADERS) $(TARGET).lnk @@ -128,31 +128,31 @@ task.obj: task.c $(HEADERS) $(TARGET).lnk # XXX: Special handling for initialization modules -- this is required because # TC 2.01 cannot handle `#pragma option' like TC 3 can. -- ror4 -config.obj: config.c $(INITHEADERS) $(TARGET).lnk +config.obj: config.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -initoem.obj: initoem.c $(INITHEADERS) $(TARGET).lnk +initoem.obj: initoem.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -main.obj: main.c $(INITHEADERS) $(TARGET).lnk +main.obj: main.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -inithma.obj: inithma.c $(INITHEADERS) $(TARGET).lnk +inithma.obj: inithma.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -dyninit.obj: dyninit.c $(INITHEADERS) $(TARGET).lnk +dyninit.obj: dyninit.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -initdisk.obj: initdisk.c $(INITHEADERS) $(TARGET).lnk +initdisk.obj: initdisk.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj -initclk.obj: initclk.c $(INITHEADERS) $(TARGET).lnk +initclk.obj: initclk.c $(INITHEADERS) $(TARGET).lnk $(CC) $(INITCFLAGS) $*.c $(INITPATCH) $*.obj diff --git a/kernel/memdisk.asm b/kernel/memdisk.asm index fb76e643..2997b58f 100644 --- a/kernel/memdisk.asm +++ b/kernel/memdisk.asm @@ -32,7 +32,7 @@ CPU 386 ; ; query_memdisk() based on similar subroutine in Eric Auer's public domain getargs.asm which is based on IFMEMDSK ; input: drive (in AL) to query if memdisk provided disk -; output: a far * to a memdiskinfo structure as defined by memdisk (see config.c) +; output: a far * to a memdiskinfo structure as defined by memdisk (see config.c) ; struct memdiskinfo FAR * query_memdisk(UBYTE drive); global _query_memdisk _query_memdisk: @@ -66,7 +66,7 @@ CPU 386 nomemdisk: xor di, di ; return NULL; mov es, di - + cleanup: pop eax pop edx diff --git a/kernel/misc.c b/kernel/misc.c index 58007c50..4b0bb4e9 100644 --- a/kernel/misc.c +++ b/kernel/misc.c @@ -39,7 +39,7 @@ static BYTE *miscRcsId = char *strcpy(REG BYTE * d, REG CONST BYTE * s) { char *tmp = d; - + while ((*d++ = *s++) != '\0') ; @@ -57,7 +57,7 @@ VOID * memcpy(REG VOID * d, REG CONST VOID * s, REG size_t n) { char *cd = d; CONST char *cs = s; - + while (n--) *cd++ = *cs++; return d; diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 7c1e70a7..67b1ee86 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -34,7 +34,7 @@ static BYTE *mainRcsId = #include "globals.h" /* - TE-TODO: if called repeatedly by same process, + TE-TODO: if called repeatedly by same process, last allocation must be freed. if handle count < 20, copy back to PSP */ int SetJFTSize(UWORD nHandles) @@ -117,7 +117,7 @@ long DosMkTmp(BYTE FAR * pathname, UWORD attr) is always a logical drive letter associated with a path spec. This letter is also the index into the CDS */ -/* +/* Definition of functions for the handling of the Current Directory Structure. @@ -221,10 +221,10 @@ long DosMkTmp(BYTE FAR * pathname, UWORD attr) /*TE TODO: experimenting with NUL on MSDOS 7.0 (win95) - + WIN95 FREEDOS TRUENAME NUL C:/NUL OK - TRUENAME .\NUL C:\DOS\NUL + TRUENAME .\NUL C:\DOS\NUL TRUENAME ..\NUL C:\NUL TRUENAME ..\..\NUL path not found TRUENAME Z:NUL invalid drive (not lastdrive!!) @@ -292,7 +292,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) /* referenced for network with empty current_ldt. */ return IS_NETWORK; } - + /* Do we have a drive? */ if (src[1] == ':') result = drLetterToNr(DosUpFChar(src0)); @@ -325,7 +325,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) current_ldt = cdsEntry; if (TempCDS.cdsFlags & CDSNETWDRV) result |= IS_NETWORK; - + if (dhp) result |= IS_DEVICE; @@ -389,7 +389,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) } } } - + /* Make fully-qualified logical path */ /* register these two used characters and the \0 terminator byte */ /* we always append the current dir to stat the drive; @@ -431,7 +431,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) if (dest[1] == ':') { /* sanity check if this really is a local drive still */ unsigned i = drLetterToNr(dest[0]); - + /* truename returns the "real", not the "virtual" drive letter! */ if (i < lastdrive) /* sanity check #2 */ result = (result & 0xffe0) | i; @@ -562,17 +562,17 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) /* we must always add a seperator if dest = "c:" */ addChar('\\'); } - + *p = '\0'; /* add the string terminator */ DosUpFString(rootPos); /* upcase the file/path name */ - + /** Note: Only the portions passed in by the user are upcased, because it is assumed that the CDS is configured correctly and if it contains lower case letters, it is required so **/ - + tn_printf(("Absolute logical path: \"%s\"\n", dest)); - + /* Now, all the steps 1) .. 7) are fullfilled. Join now */ /* search, if this path is a joined drive */ diff --git a/kernel/nls.c b/kernel/nls.c index e885bdc7..f4ab8714 100644 --- a/kernel/nls.c +++ b/kernel/nls.c @@ -317,7 +317,7 @@ STATIC int nlsGetData(struct nlsPackage FAR * nls, int subfct, ((struct nlsExtCntryInfo FAR *)poi)->size + 3); case NLS_DOS_38: /* Normal Country Information */ return cpyBuf(buf, bufsize, &(((struct nlsExtCntryInfo FAR *)poi)->dateFmt), 24); /* standard cinfo has no more 34 _used_ bytes */ - /* don't copy 34, copy only 0x18 instead, + /* don't copy 34, copy only 0x18 instead, see comment at DosGetCountryInformation TE */ default: /* All other subfunctions just return the found nlsPoinerInf diff --git a/kernel/prf.c b/kernel/prf.c index fe585be4..9c63dc0c 100644 --- a/kernel/prf.c +++ b/kernel/prf.c @@ -387,7 +387,7 @@ void hexd(char *title, UBYTE FAR * p, COUNT numBytes) { put_unsigned(p[loop], 16, 2); put_console(' '); - } + } for (loop = start; loop < numBytes && loop < start+16;loop++) put_console(p[loop] < 0x20 ? '.' : p[loop]); put_console('\n'); @@ -424,11 +424,11 @@ void put_string(const char *s) /* this testprogram verifies that the strings are printed correctly ( or the way, I expect them to print) - + compile like (note -DTEST !) c:\tc\tcc -DTEST -DI86 -I..\hdr prf.c - + and run. if strings are wrong, the program will wait for the ANYKEY */ diff --git a/kernel/printer.asm b/kernel/printer.asm index 142a8b24..7152be71 100644 --- a/kernel/printer.asm +++ b/kernel/printer.asm @@ -83,7 +83,7 @@ PrtWrite: jcxz PrtWr3 ; Exit if nothing to write PrtCharLoop: ; next character loop - + mov bx, 2 ; number of retries PrtRetryTwice: mov ah, PRT_GETSTATUS ; get status, ah=2 @@ -138,12 +138,12 @@ PrtIOCall: mov al, E_NOTRDY jz ret_error_code - test ah, PRT_OUTOFPAPER ; 20h + test ah, PRT_OUTOFPAPER ; 20h mov al, E_WRITE jz ret_error_code ; not out of paper -> E_WRITE ret_error_code_9: - mov al, E_PAPER + mov al, E_PAPER ret_error_code: cmp al, E_NOTRDY ; 2 = no error @@ -224,7 +224,7 @@ PrtGnIoctl3: ; but should print a little bit ; ; the status bits = AH -; +; ; 1 0 ; 80 - BUSY not busy busy ; 40 - ACK transfer finished not yet finished diff --git a/kernel/procsupt.asm b/kernel/procsupt.asm index 60ece375..cb38acdf 100644 --- a/kernel/procsupt.asm +++ b/kernel/procsupt.asm @@ -134,16 +134,16 @@ _spawn_int23: ; restore to user stack cli ;; Pre-8086 don't disable INT autom. -;*TE PATCH -; CtrlC at DosInput (like C:>DATE does) +;*TE PATCH +; CtrlC at DosInput (like C:>DATE does) ; Nukes the Kernel. -; +; ; it looks like ENTRY.ASM+PROCSUPT.ASM ; got out of sync. -; +; ; spawn_int() assumes a stack layout at ; usr_ss:usr:sp. but usr:ss currently contains 0 -; +; ; this patch helps FreeDos to survive CtrlC, ; but should clearly be done somehow else. mov ss, [_user_r+2] diff --git a/kernel/proto.h b/kernel/proto.h index b45a9fb7..5752ee85 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -389,9 +389,9 @@ VOID ASMCFUNC exec_user(iregs FAR * irp, int disable_a20); /* assert at compile time, that something is true. - - use like - ASSERT_CONST( SECSIZE == 512) + + use like + ASSERT_CONST( SECSIZE == 512) ASSERT_CONST( (BYTE FAR *)x->fcb_ext - (BYTE FAR *)x->fcbname == 8) */ diff --git a/kernel/segs.inc b/kernel/segs.inc index e0a31c34..3450d2b1 100644 --- a/kernel/segs.inc +++ b/kernel/segs.inc @@ -69,7 +69,7 @@ segment _DATAEND class=DATA align=1 segment CONST class=DATA align=2 segment CONST2 class=DATA align=2 ;for MSC -segment DCONST class=DCONST align=2 +segment DCONST class=DCONST align=2 segment DYN_DATA class=DYN_DATA segment HMA_TEXT_START class=CODE align=16 segment HMA_TEXT class=CODE @@ -94,6 +94,6 @@ segment IDATA class=ID align=2 segment ID_E class=ID align=2 segment IC class=IC align=2 segment IB_B class=IB align=2 -segment IB class=IB align=2 +segment IB class=IB align=2 segment IB_E class=IB align=2 %endif diff --git a/kernel/serial.asm b/kernel/serial.asm index d7fb3b64..f06920f9 100644 --- a/kernel/serial.asm +++ b/kernel/serial.asm @@ -95,7 +95,7 @@ ComInStat: ; similar to ComNdRead but returns no char, only flags ; test al,20h ; DSR (why do we test this?) ; jz ComNdRtn ComInAvail: jmp _IOExit ; return "ready" - + ComNdRead: call GetComStat diff --git a/kernel/systime.c b/kernel/systime.c index a8b98b9a..27e07ccf 100644 --- a/kernel/systime.c +++ b/kernel/systime.c @@ -49,7 +49,7 @@ extern request ASM ClkReqHdr; const UWORD *is_leap_year_monthdays(UWORD y) { - /* this is correct in a strict mathematical sense + /* this is correct in a strict mathematical sense return ((y) & 3 ? days[0] : (y) % 100 ? days[1] : (y) % 400 ? days[0] : days[1]); */ /* this will work until 2200 - long enough for me - and saves 0x1f bytes */ @@ -95,7 +95,7 @@ int DosSetTime(const struct dostime *dt) if (dt->hour > 23 || dt->minute > 59 || dt->second > 59 || dt->hundredth > 99) return DE_INVLDDATA; - + /* for ClkRecord.clkDays */ ExecuteClockDriverRequest(C_INPUT); diff --git a/kernel/task.c b/kernel/task.c index deda7781..34e0cd7c 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -294,24 +294,24 @@ STATIC int load_transfer(UWORD ds, exec_blk *exp, UWORD fcbcode, COUNT mode) { psp FAR *p = MK_FP(ds, 0); psp FAR *q = MK_FP(cu_psp, 0); - + /* Transfer control to the executable */ p->ps_parent = cu_psp; p->ps_prevpsp = q; q->ps_stack = (BYTE FAR *)user_r; user_r->FLAGS &= ~FLG_CARRY; - + cu_psp = ds; /* process dta */ dta = &p->ps_cmd; - + if (mode == LOADNGO) { iregs FAR *irp; - + /* build the user area on the stack */ irp = (iregs FAR *)(exp->exec.stack - sizeof(iregs)); - + /* start allocating REGs (as in MS-DOS - some demos expect them so --LG) */ /* see http://www.beroset.com/asm/showregs.asm */ irp->DX = irp->ES = irp->DS = ds; @@ -323,12 +323,12 @@ STATIC int load_transfer(UWORD ds, exec_blk *exp, UWORD fcbcode, COUNT mode) irp->AX = irp->BX = fcbcode; irp->CX = 0xFF; irp->FLAGS = 0x200; - + if (InDOS) --InDOS; exec_user(irp, 1); - - /* We should never be here + + /* We should never be here fatal("KERNEL RETURNED!!!"); */ } /* mode == LOAD */ @@ -398,7 +398,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) { UWORD mem; UWORD env, asize = 0; - + { UWORD com_size; { @@ -413,21 +413,21 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) COUNT rc; UBYTE UMBstate = uppermem_link; UBYTE orig_mem_access = mem_access_mode; - + if (mode & 0x80) { mem_access_mode |= 0x80; DosUmbLink(1); /* link in UMBs */ } - + rc = ChildEnv(exp, &env, namep); - + /* COMFILES will always be loaded in largest area. is that true TE */ /* yes, see RBIL, int21/ah=48 -- Bart */ if (rc == SUCCESS) rc = ExecMemLargest(&asize, com_size); - + if (rc == SUCCESS) /* Allocate our memory and pass back any errors */ rc = ExecMemAlloc(asize, &mem, &asize); @@ -476,7 +476,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) if (mode == OVERLAY) return SUCCESS; - + { UWORD fcbcode; psp FAR *p; @@ -576,51 +576,51 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) memory if we are overlaying the current process, because the new process will simply re-use the block we already have allocated. Jun 11, 2000 - rbc */ - + if ((mode & 0x7f) != OVERLAY) { UBYTE UMBstate = uppermem_link; UBYTE orig_mem_access = mem_access_mode; COUNT rc; - + /* and finally add in the psp size */ image_size += sizeof(psp) / 16; /* TE 03/20/01 */ exe_size = image_size + ExeHeader.exMinAlloc; - + /* Clone the environement and create a memory arena */ if (mode & 0x80) { DosUmbLink(1); /* link in UMBs */ mem_access_mode |= 0x80; } - + rc = ChildEnv(exp, &env, namep); - + if (rc == SUCCESS) /* Now find out how many paragraphs are available */ rc = ExecMemLargest(&asize, exe_size); - + exe_size = image_size + ExeHeader.exMaxAlloc; /* second test is for overflow (avoiding longs) -- exMaxAlloc can be high */ if (exe_size > asize || exe_size < image_size) exe_size = asize; - + /* TE if ExeHeader.exMinAlloc == ExeHeader.exMaxAlloc == 0, DOS will allocate the largest possible memory area and load the image as high as possible into it. discovered (and after that found in RBIL), when testing NET */ - + if ((ExeHeader.exMinAlloc | ExeHeader.exMaxAlloc) == 0) exe_size = asize; - + /* Allocate our memory and pass back any errors */ if (rc == SUCCESS) rc = ExecMemAlloc(exe_size, &mem, &asize); - + if (rc != SUCCESS) DosMemFree(env); - + if (mode & 0x80) { mem_access_mode = orig_mem_access; /* restore old situation */ @@ -628,16 +628,16 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) } if (rc != SUCCESS) return rc; - + mode &= 0x7f; /* forget about high loading from now on */ - + #ifdef DEBUG printf("DosExeLoader. Loading '%S' at %04x\n", namep, mem); #endif - + /* memory found large enough - continue processing */ ++mem; - + /* /// Added open curly brace and "else" clause. We should not attempt to allocate memory if we are overlaying the current process, because the new process will simply re-use the block we already have allocated. @@ -661,7 +661,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) } return DE_INVLDDATA; } - + /* create the start seg for later computations */ start_seg = mem; exe_size = image_size; @@ -672,7 +672,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk * exp, COUNT mode, COUNT fd) if (exe_size > 0 && (ExeHeader.exMinAlloc | ExeHeader.exMaxAlloc) == 0) { mcb FAR *mp = MK_FP(mem - 1, 0); - + /* then the image should be placed as high as possible */ start_seg += mp->m_size - image_size; } @@ -766,7 +766,7 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp) COUNT fd; if ((mode & 0x7f) > 3 || (mode & 0x7f) == 2) - return DE_INVLDFMT; + return DE_INVLDFMT; fmemcpy(&TempExeBlock, ep, sizeof(exec_blk)); /* If file not found - free ram and return error */ @@ -776,7 +776,7 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp) { return DE_FILENOTFND; } - + rc = (int)DosRWSft(fd, sizeof(exe_header), (BYTE FAR *)&ExeHeader, XFR_READ); if (rc == sizeof(exe_header) && diff --git a/makefile b/makefile index 8efd92ba..6fb2579a 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ -# What you WANT on DOS is: +# What you WANT on DOS is: # EDIT CONFIG.B, COPY CONFIG.B to CONFIG.BAT, RUN BUILD.BAT # On Linux, use config.mak, and "make all", "make clean", or "make clobber" -# On Windows, use config.mak, and +# On Windows, use config.mak, and # "mingw32-make all", "mingw32-make clean", or "mingw32-make clobber" default: diff --git a/mkfiles/bc5.mak b/mkfiles/bc5.mak index 64408fd6..87a2579c 100644 --- a/mkfiles/bc5.mak +++ b/mkfiles/bc5.mak @@ -11,7 +11,7 @@ CL=$(COMPILERBIN)\bcc INCLUDEPATH=$(COMPILERPATH)\include LIBUTIL=$(COMPILERBIN)\tlib LIBPATH=$(COMPILERPATH)\lib -LIBTERM= +LIBTERM= LIBPLUS=+ TINY=-lt diff --git a/mkfiles/mscl8.mak b/mkfiles/mscl8.mak index cd5c53b2..30443930 100644 --- a/mkfiles/mscl8.mak +++ b/mkfiles/mscl8.mak @@ -27,7 +27,7 @@ MATH_EXTRACT=*aflmul *aFlshl *aFNauldi *aFulrem *aFulshr *aFuldiv *aFlrem *aFldi MATH_INSERT= +aflmul +aFlshl +aFNauldi +aFulrem +aFulshr +aFuldiv +aFlrem +aFldiv TARGETOPT= -!if $(XCPU) == 186 +!if $(XCPU) == 186 TARGETOPT=-G1 !endif !if $(XCPU) == 386 diff --git a/mkfiles/owlinux.mak b/mkfiles/owlinux.mak index 5172c150..ae51c8c3 100644 --- a/mkfiles/owlinux.mak +++ b/mkfiles/owlinux.mak @@ -15,5 +15,5 @@ CLDEF=1 CLT=gcc -DDOSC_TIME_H -I../hdr -o $@ CLC=$(CLT) CFLAGST=-fo=.obj $(CFLAGST) -ALLCFLAGS=-fo=.obj $(ALLCFLAGS) +ALLCFLAGS=-fo=.obj $(ALLCFLAGS) XLINK=$(XLINK) debug all op symfile format dos option map,statics,verbose F { $(OBJS) } L ../lib/device.lib N kernel.exe $# diff --git a/mkfiles/owwin.mak b/mkfiles/owwin.mak index 9d0e9e50..efb8c640 100644 --- a/mkfiles/owwin.mak +++ b/mkfiles/owwin.mak @@ -5,7 +5,7 @@ # Get definitions from watcom.mak, then override include "../mkfiles/watcom.mak" -DIRSEP=\ +DIRSEP=\ INCLUDEPATH=$(COMPILERPATH)$(DIRSEP)h #RM=del 2>nul @@ -16,6 +16,6 @@ CLDEF=1 CLT=owcc -DDOSC_TIME_H -DBUILD_UTILS -I../hdr -o $@ CLC=$(CLT) CFLAGST=-fo=.obj $(CFLAGST) -ALLCFLAGS=-fo=.obj $(ALLCFLAGS) +ALLCFLAGS=-fo=.obj $(ALLCFLAGS) NASMFLAGS=-Dowlinux $(NASMFLAGS) XLINK=$(XLINK) debug all op symfile format dos option map,statics,verbose F { $(OBJS) } L ..$(DIRSEP)lib$(DIRSEP)device.lib N kernel.exe $# diff --git a/mkfiles/tc2.mak b/mkfiles/tc2.mak index c5e52130..9a456303 100644 --- a/mkfiles/tc2.mak +++ b/mkfiles/tc2.mak @@ -11,7 +11,7 @@ CL=$(COMPILERBIN)\tcc INCLUDEPATH=$(COMPILERPATH)\include LIBUTIL=$(COMPILERBIN)\tlib LIBPATH=$(COMPILERPATH)\lib -LIBTERM= +LIBTERM= LIBPLUS=+ TINY=-lt diff --git a/mkfiles/tc3.mak b/mkfiles/tc3.mak index 1ac6986e..f3c1f942 100644 --- a/mkfiles/tc3.mak +++ b/mkfiles/tc3.mak @@ -11,7 +11,7 @@ CL=$(COMPILERBIN)\tcc INCLUDEPATH=$(COMPILERPATH)\include LIBUTIL=$(COMPILERBIN)\tlib LIBPATH=$(COMPILERPATH)\lib -LIBTERM= +LIBTERM= LIBPLUS=+ TINY=-lt diff --git a/mkfiles/turbocpp.mak b/mkfiles/turbocpp.mak index db331184..efc64811 100644 --- a/mkfiles/turbocpp.mak +++ b/mkfiles/turbocpp.mak @@ -11,7 +11,7 @@ CL=$(COMPILERBIN)\tcc INCLUDEPATH=$(COMPILERPATH)\include LIBUTIL=$(COMPILERBIN)\tlib LIBPATH=$(COMPILERPATH)\lib -LIBTERM= +LIBTERM= LIBPLUS=+ TINY=-lt diff --git a/mkfiles/watcom.mak b/mkfiles/watcom.mak index e461688e..50d433f8 100644 --- a/mkfiles/watcom.mak +++ b/mkfiles/watcom.mak @@ -7,7 +7,7 @@ COMPILERPATH=$(WATCOM) CC=*wcc CL=wcl INCLUDEPATH=$(COMPILERPATH)\H -INCLUDE=$(COMPILERPATH)\h +INCLUDE=$(COMPILERPATH)\h EDPATH=$(COMPILERPATH)\EDDAT !if $(XCPU) != 186 @@ -17,7 +17,7 @@ TARGETOPT=-0 !endif LIBPATH=$(COMPILERPATH)\lib286 -LIBUTIL=wlib -q +LIBUTIL=wlib -q LIBPLUS= LIBTERM= @@ -32,27 +32,27 @@ TARGET=KWC CLIB=$(COMPILERPATH)\lib286\dos\clibm.lib # we use our own ones, which override these ones when linking. -# +# MATH_EXTRACT=*i4m MATH_INSERT=+i4m # -# heavy stuff - building +# heavy stuff - building # # -e= set limit on number of error messages # -ms small memory model (small code/small data) -# -j change char default from unsigned to signed +# -j change char default from unsigned to signed #-nc= set code class name #-nd= set data segment name #-nm= set module name -#-nt= set name of text segment +#-nt= set name of text segment # -g= set code group name # -os -> favor code size over execution time in optimizations -# -s remove stack overflow checks -# -w= set warning level number -# -we treat all warnings as errors +# -s remove stack overflow checks +# -w= set warning level number +# -we treat all warnings as errors # -ze enable extensions (i.e., near, far, export, etc.) # -zl remove default library information # -zp= pack structure members with alignment {1,2,4,8,16} diff --git a/share/makefile b/share/makefile index f8dbbdea..44f88c6f 100644 --- a/share/makefile +++ b/share/makefile @@ -28,6 +28,6 @@ LOPT=-m -s -c SHARE.COM: SHARE.OBJ $(TLINK) $(LOPT) $(LIBS)\c0t.obj share.obj,share.com,,$(LIBS)\cs.lib -SHARE.OBJ: SHARE.C +SHARE.OBJ: SHARE.C $(TCC) $(COPT) share.c diff --git a/sys/fdkrncfg.c b/sys/fdkrncfg.c index 9ef084a0..406ca148 100644 --- a/sys/fdkrncfg.c +++ b/sys/fdkrncfg.c @@ -154,7 +154,7 @@ void displayConfigSettings(KernelConfig * cfg) if (cfg->ConfigSize >= 20) { printf - ("%s kernel %s (build %d.%d OEM:%02X)\n", + ("%s kernel %s (build %d.%d OEM:%02X)\n", (cfg->Version_OemID == 0xFD)?"FreeDOS":"DOS-C", cfg->Version_Release?"SVN":"Release", cfg->Version_Major, diff --git a/sys/sys.c b/sys/sys.c index f8758bf5..57fab157 100644 --- a/sys/sys.c +++ b/sys/sys.c @@ -331,7 +331,7 @@ DOSBootFiles bootFiles[] = { #define OEM_DR 1 /* FD boot sector,(Enhanced) DR-DOS names */ #endif #ifdef WITHOEMCOMPATBS -#define OEM_PC 3 /* use PC-DOS compatible boot sector and names */ +#define OEM_PC 3 /* use PC-DOS compatible boot sector and names */ #define OEM_MS 4 /* use PC-DOS compatible BS with MS names */ #define OEM_W9x 5 /* use PC-DOS compatible BS with MS names */ #define OEM_RX 6 /* use PC-DOS compatible BS with Rx names */ @@ -683,7 +683,7 @@ void initOptions(int argc, char *argv[], SYSOptions *opts) { int slen; /* set source path, reserving room to append filename */ - if ( (argv[srcarg][1] == ':') || ((argv[srcarg][0]=='\\') && (argv[srcarg][1] == '\\')) ) + if ( (argv[srcarg][1] == ':') || ((argv[srcarg][0]=='\\') && (argv[srcarg][1] == '\\')) ) strncpy(opts->srcDrive, argv[srcarg], SYS_MAXPATH-13); else if (argv[srcarg][1] == '\0') /* assume 1 char is drive not path specifier */ sprintf(opts->srcDrive, "%c:", toupper(*(argv[srcarg]))); @@ -694,14 +694,14 @@ void initOptions(int argc, char *argv[], SYSOptions *opts) if ((slen>2) && (opts->srcDrive[slen-1] != '\\') && (opts->srcDrive[slen-1] != '/')) strcat(opts->srcDrive, "\\"); } - /* source path is now in form of just a drive, "X:" + /* source path is now in form of just a drive, "X:" or form of drive + path + directory separator, "X:\path\" or "\\path\" If just drive we try current path then root, else just indicated path. */ /* if source and dest are same drive, then source should not be root, - so if is same drive and not explicit path, force only current + so if is same drive and not explicit path, force only current Note: actual copy routine prevents overwriting self when src=dst */ if ( (opts->dstDrive == (toupper(*(opts->srcDrive))-'A')) && (!opts->srcDrive[2]) ) @@ -759,7 +759,7 @@ void initOptions(int argc, char *argv[], SYSOptions *opts) } /* if unable to determine DOS, assume FreeDOS */ - if (opts->flavor == OEM_AUTO) opts->flavor = + if (opts->flavor == OEM_AUTO) opts->flavor = #ifdef DRSYS OEM_EDR; #else @@ -885,7 +885,7 @@ int main(int argc, char **argv) if (opts.copyShell) { printf("Copying shell (command interpreter)...\n"); - + /* copy command.com, 1st try source path, then try %COMSPEC% */ sprintf(srcFile, "%s%s", opts.srcDrive, (opts.fnCmd)?opts.fnCmd:"COMMAND.COM"); if (!copy(srcFile, opts.dstDrive, "COMMAND.COM")) @@ -973,7 +973,7 @@ void reset_drive(int DosDrive); #pragma aux reset_drive = \ "push ds" \ "inc dx" \ - "mov ah, 0xd" \ + "mov ah, 0xd" \ "int 0x21" \ "mov ah,0x32" \ "int 0x21" \ @@ -1030,7 +1030,7 @@ int fat32readwrite(int DosDrive, void *diskReadPacket, unsigned intno) regs.x.cx = 0xffff; regs.x.si = intno; intdos(®s, ®s); - + return regs.x.cflag; } /* fat32readwrite */ @@ -1373,7 +1373,7 @@ void put_boot(SYSOptions *opts) dataSectors = totalSectors - bs32->bsResSectors - (bs32->bsFATs * fatSize) - rootDirSectors; clusters = dataSectors / bs32->bsSecPerClust; - + if (clusters < FAT_MAGIC) /* < 4085 */ fs = FAT12; else if (clusters < FAT_MAGIC16) /* < 65525 */ @@ -1432,7 +1432,7 @@ void put_boot(SYSOptions *opts) { unsigned offset; offset = (fs == FAT16) ? 0x175 : 0x178; - + if ( (newboot[offset]==0x84) && (newboot[offset+1]==0xD2) ) /* test dl,dl */ { /* if always use LBA then NOP out conditional jmp over LBA logic if A: */ @@ -1495,12 +1495,12 @@ void put_boot(SYSOptions *opts) /* the location of the "0060" segment portion of the far pointer in the boot sector is just before cont: in boot*.asm. - This happens to be offset 0x78 for FAT32 and offset 0x5c for FAT16 + This happens to be offset 0x78 for FAT32 and offset 0x5c for FAT16 force use of value stored in bs by NOPping out mov [drive], dl 0x82: 88h,56h,40h for fat32 chs & lba boot sectors - i.e. BE CAREFUL WHEN YOU CHANGE THE BOOT SECTORS !!! + i.e. BE CAREFUL WHEN YOU CHANGE THE BOOT SECTORS !!! */ if (opts->kernel.stdbs) { @@ -1527,7 +1527,7 @@ void put_boot(SYSOptions *opts) /* the location of the "0060" segment portion of the far pointer in the boot sector is just before cont: in boot*.asm. - This happens to be offset 0x78 for FAT32 and offset 0x5c for FAT16 + This happens to be offset 0x78 for FAT32 and offset 0x5c for FAT16 The oem boot sectors do not have/need this value for patching. the location of the jmp address (patching from @@ -1539,8 +1539,8 @@ void put_boot(SYSOptions *opts) force use of value stored in bs by NOPping out mov [drive], dl 0x66: 88h,56h,24h for fat16 and fat12 boot sectors 0x4F: 88h,56h,24h for oem compatible fat16 and fat12 boot sectors - - i.e. BE CAREFUL WHEN YOU CHANGE THE BOOT SECTORS !!! + + i.e. BE CAREFUL WHEN YOU CHANGE THE BOOT SECTORS !!! */ if (opts->kernel.stdbs) { @@ -1584,7 +1584,7 @@ void put_boot(SYSOptions *opts) printf("Root directory starts at sector (PREVIOUS + %u * %u)\n", bs->bsFATsecs, bs->bsFATs); } - + { int i = 0; memset(&newboot[0x1f1], ' ', 11); @@ -1634,7 +1634,7 @@ void put_boot(SYSOptions *opts) printf("Can't write new boot sector to drive %c:\n", opts->dstDrive + 'A'); exit(1); } - + /* for FAT32, we need to update the backup copy as well */ /* unless user has asked us not to, eg for better dual boot support */ /* Note: assuming sectors 1-5 & 7-11 (FSINFO+additional boot code) @@ -1801,7 +1801,7 @@ BOOL copy(const BYTE *source, COUNT drive, const BYTE * filename) BYTE far *buffer, far *bufptr; UWORD offs; unsigned chunk_size; - + /* get length of file to copy, then allocate enough memory for whole file */ filesize = filelength(fdin); if (alloc_dos_mem(filesize, &theseg)!=0) diff --git a/tests/absread/absread.c b/tests/absread/absread.c index ec9ef0ee..50d2a985 100644 --- a/tests/absread/absread.c +++ b/tests/absread/absread.c @@ -39,9 +39,9 @@ void get_partition_offset(int drive) { static struct deviceparams dp; int err=0; - + printf("Getting drive info: int21h function 440Dh subfunction 0860h\n"); - + dp.specfunc = 1; /* Get current information */ __asm { @@ -58,11 +58,11 @@ void get_partition_offset(int drive) if (!err) { printf("Partition Offset = %02lXh [c=%02u,h=%02u,s=%2u]\n", dp.hiddensecs, dp.cylinders, dp.heads, dp.secpertrack); - printf("FAT32 version 4860h to compare\n"); + printf("FAT32 version 4860h to compare\n"); } else printf("Original version failed, checking FAT32 version using 4860h\n"); - + __asm { mov ax, 0x440d mov bx, drive @@ -135,7 +135,7 @@ void read_mbr(int drive, const void *buf) //printf("Success reading MBR\n\n"); return; } - + __asm { mov ax, 0x440d mov bx, drive @@ -151,20 +151,20 @@ void read_mbr(int drive, const void *buf) //printf("Success reading FAT32 MBR\n\n"); return; } - + printf("mbr read error"); } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { unsigned int c,h,s; static uint8_t buf[1024]; unsigned drive = (unsigned)(argv[1][0]); /* a=1,b=2,... */ drive = drive-'a'+1; printf("Query drive %c:\n", 'a'+drive-1); - + get_partition_offset(drive); - + read_mbr(drive, buf); printf("MBR: %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh\n", ((const uint8_t *)buf)[0], @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) mbr.sectors=s; read_mbr(drive, buf); if (buf[0] != 0) { - printf("Found at %u,%u,%u\n", c,h,s); + printf("Found at %u,%u,%u\n", c,h,s); printf("MBR: %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh %02Xh\n", ((const uint8_t *)buf)[0], @@ -197,12 +197,12 @@ int main(int argc, char *argv[]) ((const uint8_t *)buf)[5], ((const uint8_t *)buf)[6], ((const uint8_t *)buf)[7]); - + exit(0); } } printf("c=%u,", c); fflush(NULL); } - + return 0; } diff --git a/utils/exeflat.c b/utils/exeflat.c index 9f291b44..b254e1d6 100644 --- a/utils/exeflat.c +++ b/utils/exeflat.c @@ -36,10 +36,10 @@ large portions copied from task.c /* history - 10/??/01 - Bart Oldeman + 10/??/01 - Bart Oldeman primary release - 11/28/01 - tom ehlert + 11/28/01 - tom ehlert added -UPX option to make the kernel compressable with UPX */ @@ -79,7 +79,7 @@ static void usage(void) printf("usage: exeflat (src.exe) (dest.sys) (relocation-factor)\n"); printf (" -S10 - Silent relocate segment 10 (down list)\n"); - + exit(1); } @@ -185,12 +185,12 @@ static int exeflat(const char *srcfile, const char *dstfile, silentdone++; goto dontPrint; } - + printf("relocation at 0x%04x:0x%04x ->%04x\n", reloc[i].seg, reloc[i].off, segment); - + dontPrint: - + segment += start_seg; *spot0 = segment & 0xff; *spot1 = segment >> 8; @@ -306,7 +306,7 @@ static void write_trailer(FILE *dest, size_t size, int compress_sys_file, /* hand assembled - so this remains ANSI C ;-) */ /* well almost: we still need packing and assume little endian ... */ /* move kernel down to place CONFIG-block, which added above, - at start_seg-2:0 (e.g. 0x5e:0) instead of + at start_seg-2:0 (e.g. 0x5e:0) instead of start_seg:0 (e.g. 0x60:0) and store there boot drive number from BL; kernel.asm will then check presence of additional CONFIG-block at this address. */ @@ -366,10 +366,10 @@ int main(int argc, char **argv) for (i = 4; i < argc && !UPX; i++) { char *argptr = argv[i]; - + if (argptr[0] != '-' && argptr[0] != '/') usage(); - + argptr++; switch (toupper(argptr[0])) @@ -384,10 +384,10 @@ int main(int argc, char **argv) LENGTH(silentSegments)); exit(1); } - + silentSegments[silentcount++] = (short)strtol(argptr + 1, NULL, 0); break; - + default: usage(); } diff --git a/utils/patchobj.c b/utils/patchobj.c index 72d9870b..b03200f7 100644 --- a/utils/patchobj.c +++ b/utils/patchobj.c @@ -1,15 +1,15 @@ /***************************************************************************** -** PATCHOBJ facility - change strings in the LNAMES record +** PATCHOBJ facility - change strings in the LNAMES record ** ** Copyright 2001 by tom ehlert ** ** GPL bla to be added, but intended as GPL -** +** ** ** 09/06/2001 - initial revision -** not my biggest kind of software; anyone willing to add +** not my biggest kind of software; anyone willing to add ** comments, errormessages, usage info,...??? -** +** *****************************************************************************/ #include diff --git a/utils/relocinf.c b/utils/relocinf.c index 89d778f0..c0405a28 100644 --- a/utils/relocinf.c +++ b/utils/relocinf.c @@ -1,6 +1,6 @@ /***************************************************************************** ** RelocInf.C -** +** ** provide some info about relocation entries in an exe file ** ** usage: @@ -10,12 +10,12 @@ ** Copyright 2001 by tom ehlert ** ** GPL bla to be added, but intended as GPL -** +** ** ** 09/06/2001 - initial revision -** not my biggest kind of software; anyone willing to add +** not my biggest kind of software; anyone willing to add ** comments, errormessages, usage info,...??? -** +** *****************************************************************************/ * /