Compare commits

...

No commits in common. "master" and "UNSTABLE" have entirely different histories.

246 changed files with 14997 additions and 31870 deletions

6
.gitattributes vendored
View File

@ -1,6 +0,0 @@
* text eol=crlf
*.up -text
*.UP -text
ci_*.sh text eol=lf
.github/workflows/*.yml text eol=lf
test/** binary diff

View File

@ -1,48 +0,0 @@
name: Build
on:
pull_request:
types:
- opened
- ready_for_review
- reopened
- synchronize
push:
workflow_dispatch:
jobs:
build:
if: contains(github.event.head_commit.message, '[skip ci]') == false
runs-on: ubuntu-22.04
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Package install
run: ./ci_prereq.sh
- name: build
run: ./ci_build.sh
- name: test
run: ./ci_test.sh
- name: make snapshot name
id: snapshotname
run: |
(
today=`date -u +%F | tr '\n' '-'`
s_sha=`echo -n ${GITHUB_SHA} | cut -c1-8`
printf "fname=snapshot-%s%s\n" $today $s_sha >> $GITHUB_OUTPUT
)
- name: upload
if: github.repository == 'FDOS/kernel' &&
(github.event_name == 'push' || github.event.pull_request.merged == true)
uses: actions/upload-artifact@v4
with:
name: ${{ steps.snapshotname.outputs.fname }}
path: _output/*/*.???

59
.gitignore vendored
View File

@ -1,59 +0,0 @@
# Object Files
*.OBJ
*.obj
# List Files
*.LST
*.lst
# Map files
*.MAP
*.map
*.SYM
*.sym
# Executable files
*.EXE
*.exe
*.COM
*.com
# Bin files
*.BIN
*.bin
# Libraries
*.LIB
*.lib
# generated text files
sys/*.h
sys/*.H
kernel/*.lnk
kernel/*.LNK
# FreeDOS build tools configuration
config.bat
config.mak
kernel/*.SYS
kernel/*.sys
bin/[kK]*.SYS
bin/[kK]*.sys
bin/COMMAND.COM
bin/command.com
bin/COUNTRY.SYS
bin/country.sys
bin/SETVER.SYS
bin/setver.sys
# backup files
*.orig
*~
*.diff
*.rej
# CI build
_downloads/**
_output/**
_watcom/**

7
.gitmodules vendored
View File

@ -1,7 +0,0 @@
[submodule "share"]
path = share
url = https://github.com/FDOS/share.git
ignore = untracked
[submodule "country"]
path = country
url = https://github.com/FDOS/country.git

View File

@ -1,123 +0,0 @@
@ECHO OFF
IF "%1"=="" GOTO USAGE
REM assumes ran in same directory as this file, ie base of kernel source
SET BASEPATH=%CD%
CD ..
REM setup command aliases
SET ZIPIT=7z.exe a -tzip -mx9 -mm=deflate -mpass15 -r
REM when called from RELEASE.BAT assume clean source exported from version control
IF "%2"=="RELEASE" GOTO PACK
ECHO create source copy
if EXIST SOURCE RMDIR /S /Q SOURCE > NUL
MKDIR SOURCE
ECHO \.svn>SOURCE\SKIPLIST
ECHO .git>>SOURCE\SKIPLIST
ECHO .yml>>SOURCE\SKIPLIST
ECHO CNAME>>SOURCE\SKIPLIST
XCOPY %BASEPATH% SOURCE\ke%1 /S /V /I /Q /G /H /R /Y /EXCLUDE:SOURCE\SKIPLIST
DEL SOURCE\SKIPLIST > NUL
ECHO ensuring clean
PUSHD .
CD SOURCE\ke%1
CALL clobber.bat
POPD
:PACK
SET VERSION=%1
SET LSMRET=SRC
SET LSMFILE=SOURCE\ke%1\docs\fdkernel.lsm
GOTO LSM
:SRC
REM remove CONFIG.BAT if exists, such as building packages from develoment directory
IF EXIST SOURCE\ke%1\CONFIG.BAT DEL SOURCE\ke%1\CONFIG.BAT > NUL
ECHO zipping source
%ZIPIT% ke%1s.zip SOURCE\*
ECHO gathering source and creating APPINFO and expected packaging dir structure
REM FreeDOS package format, has APPINFO, BIN, DOC\KERNEL, SOURCE\KERNEL\
MKDIR PACKAGE
MKDIR PACKAGE\SOURCE
XCOPY /S /I /Q SOURCE\ke%1 PACKAGE\SOURCE\KERNEL
MKDIR PACKAGE\DOC
MKDIR PACKAGE\DOC\KERNEL
COPY /N SOURCE\ke%1\DOCS\* PACKAGE\DOC\KERNEL\
COPY SOURCE\ke%1\COPYING PACKAGE\DOC\KERNEL\COPYING
MKDIR PACKAGE\APPINFO
MOVE PACKAGE\DOC\KERNEL\fdkernel.lsm PACKAGE\APPINFO\KERNEL.LSM
MKDIR PACKAGE\BIN
ECHO using working configuration file
COPY %BASEPATH%\CONFIG.BAT SOURCE\ke%1\ > NUL
CD SOURCE\ke%1
ECHO build and packaging
SET VERSION=%1 (FAT12/FAT16)
SET FAT=16
SET CPU=86
SET BZKRET=F16
GOTO BZK
:F16
SET VERSION=%1 (FAT12/FAT16/FAT32)
SET FAT=32
SET CPU=386
SET BZKRET=F32
GOTO BZK
:F32
ECHO building FreeDOS package
CD ..\..\PACKAGE
%ZIPIT% ..\kernel.zip APPINFO BIN DOC SOURCE
ECHO clean up
CD ..
RMDIR /S /Q SOURCE > NUL
RMDIR /S /Q PACKAGE > NUL
ECHO Done.
SET BZKRET=
GOTO DONE
:BZK
ECHO build kernel %VERSION%
CALL build.bat /D KERNEL_VERSION /V "%1 " %CPU% win upx fat%FAT%
DEL BIN\K*86??.sys
SET LSMRET=BZK_2
SET LSMFILE=docs\fdkernel.lsm
GOTO LSM
:BZK_2
SET LSMRET=
ECHO zipping FAT%FAT% release version
%ZIPIT% ..\..\ke%1_%CPU%f%FAT%.zip BIN\* DOCS\*
ECHO storing binaries for FreeDOS package
COPY BIN\KERNEL.SYS ..\..\PACKAGE\BIN\KERNL%CPU%.SYS
COPY /B /Y BIN\country.sys ..\..\PACKAGE\BIN\COUNTRY.SYS
COPY /B /Y BIN\setver.sys ..\..\PACKAGE\BIN\SETVER.SYS
COPY /B /Y BIN\sys.com ..\..\PACKAGE\BIN\SYS.COM
IF EXIST BIN\share.com COPY /B /Y BIN\share.com ..\..\PACKAGE\BIN\SHARE.COM
ECHO cleaning up between builds
CALL clobber.bat
GOTO %BZKRET%
:LSM
ECHO Begin3>%LSMFILE%
ECHO Title: The FreeDOS Kernel>>%LSMFILE%
ECHO Version: %VERSION%>>%LSMFILE%
ECHO Entered-date: %DATE%>>%LSMFILE%
ECHO Description: The FreeDOS Kernel>>%LSMFILE%
ECHO Keywords: kernel, FreeDOS, DOS, MSDOS>>%LSMFILE%
ECHO Author: (developers: can be reached on the freedos-kernel mailing list)>>%LSMFILE%
ECHO Maintained-by: freedos-kernel@lists.sourceforge.net>>%LSMFILE%
ECHO Primary-site: http://github.com/fdos/kernel>>%LSMFILE%
ECHO Alternate-site: http://www.fdos.org/kernel/>>%LSMFILE%
ECHO Alternate-site: http://freedos.sourceforge.net/kernel/>>%LSMFILE%
ECHO Original-site: http://www.gcfl.net/pub/FreeDOS/kernel>>%LSMFILE%
ECHO Platforms: DOS, FreeDOS, DOSEMU (OpenWatcom/Borland/GCC-ia16, NASM, UPX)>>%LSMFILE%
ECHO Copying-policy: GPL2>>%LSMFILE%
ECHO End>>%LSMFILE%
SET LSMFILE=
SET VERSION=
GOTO %LSMRET%
:USAGE
ECHO Build kernel packages (interim builds or release without tagging) - usage: %0 {VERSION} e.g. %0 2039 or %0 git
:DONE
CD %BASEPATH%
SET BASEPATH=
SET ZIPIT=

View File

@ -1,17 +0,0 @@
fd kernel
=========
FreeDOS kernel - current 0xFD version is 2.43 (2043)
http://www.fdos.org/kernel/
The FreeDOS kernel implements the core MS/PC-DOS (R) compatible functions. It is derived from Pat Villani's DOS-C kernel and released under the GPL v2. Please see http://www.freedos.org/ for more details about the FreeDOS (TM) Project. This was originally a branch based on 2042 SVN 0xFD kernel; the full svn history has since been added to git (see other branches) and current development of release kernels are available here. Please fork and submit a Pull Request!
Compiled kernels ready to use (just copy kernel.sys over an existing install) are available at http://www.fdos.org/kernel/testing/git/ - also available are the source archive and fdpkg compatible packages. *** TODO update links/upload archives
This version of the kernel is intended only for 8086+ or 80386+ IBM compatible computers in continuation of the goals of the FreeDOS Project. Please see http://www.fdos.org/kernel for my 0xDC kernel that is work on merging back in some of the original portability aspects and other supported features at the cost of some compatibility with older hardware/software.
Please feel free to email me - PerditionC@gmail.com
Now with automatic builds and soon tests [![Build](../../workflows/Build/badge.svg)](../../actions)

View File

@ -1,30 +0,0 @@
@ECHO OFF
IF "%1"=="" GOTO USAGE
REM assume ran in root directory of kernel checkout, e.g. C:\fdos\source\kernel\
ECHO tag git with release version -
git tag -a -m "Tag kernel release %1" ke%1 HEAD
ECHO get a clean tree
if EXIST ..\SOURCE RMDIR /S /Q ..\SOURCE > NUL
::git clone -v --local --branch ke%1 . ..\SOURCE\ke%1\
git clone -v --local . ..\SOURCE\ke%1\
REM delete files to exclude
RD /S /Q ..\SOURCE\ke%1\.git > NUL
RD /S /Q ..\SOURCE\ke%1\.github > NUL
DEL /Q ..\SOURCE\ke%1\.git* > NUL
DEL /Q ..\SOURCE\ke%1\*.yml > NUL
DEL /Q ..\SOURCE\ke%1\ci*.sh > NUL
DEL /Q ..\SOURCE\ke%1\docs\*.yml > NUL
DEL /Q ..\SOURCE\ke%1\docs\CNAME > NUL
pause
ECHO %CD%
CALL MAKEPKGS.BAT %1 RELEASE
GOTO DONE
:USAGE
ECHO Tag and build release kernels - usage: RELEASE {VERSION} e.g. RELEASE 2039
:DONE
ECHO Please git push the tag to origin and upload the archives.
ECHO E.g. git push origin ke%1

View File

@ -1,3 +1 @@
@echo off
echo Welcome to FreeDOS (http://www.freedos.org)!
path=a:\
@echo Welcome to FreeDOS (http://www.freedos.org)!

View File

@ -1,5 +1 @@
rem dos=high
rem device=fdxms.sys (or himem.sys)
files=20
buffers=20
rem screen=0x12
;

View File

@ -24,83 +24,50 @@
; License along with DOS-C; see the file COPYING. If not,
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
; Memory layout for the FreeDOS FAT12/FAT16 boot process:
;
; ...
; |-------| 1FE0h:7E00h = 27C00h (159 KiB)
; |BOOTSEC| loader relocates itself here first thing,
; |RELOC. | before loading root directory/FAT/kernel file
; |-------| 1FE0h:7C00h = 27A00h (158 KiB)
; | gap | PARAMS live here
; |LBA PKT| LBA disk packet
; |-------| 1FE0h:7BC0h = 279C0h (158 KiB)
; | gap | READADDR_* live here
; |-------| 1FE0h:7BA0h = 279A0h (158 KiB)
; | STACK | below relocated loader, above sector buffer (size 5.9 KiB)
; ...
; |-------| 1FE0h:6400h = 26200h (152 KiB)
; |SEC.BUF| sector buffer, to avoid crossing 64 KiB DMA boundary (size 8 KiB)
; |-------| 1FE0h:4400h = 24200h (144 KiB)
; ...
; |-------| 1FE0h:4380h = 24182h (144 KiB)
; |CLUSTER| built from FAT, listing every cluster of the kernel file.
; | LIST | file <= 134 KiB, cluster >= 32 Byte, hence <= 8578 B list.
; |-------| 1FE0h:2200h = 22000h (136 KiB)
; ...
; |-------| 0000h:7E00h = 07E00h (31.5 KiB)
; |BOOTSEC| possibly overwritten by the FAT (<= 128 KiB) and the kernel,
; |ORIGIN | so the bootsector relocates itself up...
; |-------| 0000h:7C00h = 07C00h (31 KiB)
; ...
; |-------|
; |KERNEL | maximum size 128 KiB (overwrites bootsec origin)
; |LOADED | (holds directory then FAT before kernel file load)
; |-------| 0060h:0000h = 00600h (1.5 KiB)
; ...
; The entire root directory is loaded to the kernel load address
; to scan for the kernel file. It is assumed to fit into 128 KiB.
; Typical root directory size is up to 512 entries = 16 KiB.
; Further, it is assumed that at least one root directory entry
; starts with a NUL byte to signify the end of the directory.
; After the directory entry is found, the entire FAT is loaded to
; the kernel load address. It is assumed that the size of the FAT
; in sectPerFat will not lead to a FAT larger than 128 KiB, which
; is the maximum size a FAT16 may fully utilise.
; The kernel load segment may be patched using the SYS /L switch.
; We support values between 0x60 and 0x200 here, with file size
; of up to 128 KiB (rounded to cluster size). Default is 0x60.
; This loader traditionally supports file sizes up to 134 KiB,
; assuming the default segment of 0x60. This does require a
; cluster size of 4 KiB (leads to maximum 132 KiB) or 2 KiB or
; lower (maximum 134 KiB). A more portable maximum is 128 KiB,
; which works with cluster sizes up to 128 KiB.
;
; +--------+ 1FE0:7E00
; |BOOT SEC|
; |RELOCATE|
; |--------| 1FE0:7C00
; |LBA PKT |
; |--------| 1FE0:7BC0
; |--------| 1FE0:7BA0
; |BS STACK|
; |--------|
; |4KBRDBUF| used to avoid crossing 64KB DMA boundary
; |--------| 1FE0:63A0
; | |
; |--------| 1FE0:3000
; | CLUSTER|
; | LIST |
; |--------| 1FE0:2000
; | |
; |--------| 0000:7E00
; |BOOT SEC| overwritten by max 128k FAT buffer
; |ORIGIN | and later by max 134k loaded kernel
; |--------| 0000:7C00
; | |
; |--------|
; |KERNEL | also used as max 128k FAT buffer
; |LOADED | before kernel loading starts
; |--------| 0060:0000
; | |
; +--------+
;%define ISFAT12 1
;%define ISFAT16 1
;verify one and only one of ISFAT12 or ISFAT16 is defined
%ifdef ISFAT12
%ifdef ISFAT16
%error Must select one FS
%endif
%elifndef ISFAT16
%error Must select one FS
%endif
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 1
%include "magic.mac"
segment .text
segment .text
%define BASE 0x7c00
org BASE
Entry: jmp short real_start
nop
nop
; bp is initialized to 7c00h
%define bsOemName bp+0x03 ; OEM label
@ -124,8 +91,8 @@ Entry: jmp short real_start
%define LOADSEG 0x0060
%define CLUSTLIST 0x2200 ; offset of temporary buffer for FAT
; chain cluster list
%define FATBUF 0x2000 ; offset of temporary buffer for FAT
; chain
; Some extra variables
@ -133,21 +100,12 @@ Entry: jmp short real_start
;-----------------------------------------------------------------------
times 36h - ($ - $$) db 0
; The filesystem ID is used by lDOS's instsect (by ecm)
; by default to validate that the filesystem matches.
%ifdef ISFAT12
%define FATFS "FAT12"
%elifdef ISFAT16
%define FATFS "FAT16"
%endif
db FATFS
times 3Eh - ($ - $$) db 32
times 0x3E-$+$$ db 0
; using bp-Entry+loadseg_xxx generates smaller code than using just
; loadseg_xxx, where bp is initialized to Entry, so bp-Entry equals 0
%define loadsegoff_60 bp-Entry+loadseg_off
%define loadseg_60 bp-Entry+loadseg_seg
%define loadsegoff_60 bp-Entry+loadseg_off
%define loadseg_60 bp-Entry+loadseg_seg
%define LBA_PACKET bp-0x40
%define LBA_SIZE word [LBA_PACKET] ; size of packet, should be 10h
@ -159,9 +117,9 @@ Entry: jmp short real_start
%define LBA_SECTOR_32 word [LBA_PACKET+12]
%define LBA_SECTOR_48 word [LBA_PACKET+14]
%define READBUF 0x4400 ; max 8 KiB buffer
%define READADDR_OFF word BP-0x60 ; pointer within user buffer
%define READADDR_SEG word BP-0x60+2
%define READBUF 0x63A0 ; max 4KB buffer (min 2KB stack), == stacktop-0x1800
%define READADDR_OFF BP-0x60-0x1804 ; pointer within user buffer
%define READADDR_SEG BP-0x60-0x1802
%define PARAMS LBA_PACKET+0x10
;%define RootDirSecs PARAMS+0x0 ; # of sectors root dir uses
@ -178,51 +136,49 @@ Entry: jmp short real_start
;-----------------------------------------------------------------------
real_start:
cli
cld
xor ax, ax
mov ds, ax
mov bp, BASE
cli
cld
xor ax, ax
mov ds, ax
mov bp, BASE
; a reset should not be needed here
; int 0x13 ; reset drive
; a reset should not be needed here
; int 0x13 ; reset drive
; int 0x12 ; get memory available in AX
; mov ax, 0x01e0
; mov cl, 6 ; move boot sector to higher memory
; shl ax, cl
; sub ax, 0x07e0
; int 0x12 ; get memory available in AX
; mov ax, 0x01e0
; mov cl, 6 ; move boot sector to higher memory
; shl ax, cl
; sub ax, 0x07e0
mov ax, 0x1FE0
mov es, ax
mov si, bp
mov di, bp
mov cx, 0x0100
rep movsw
mov ax, 0x1FE0
mov es, ax
mov si, bp
mov di, bp
mov cx, 0x0100
rep movsw
jmp word 0x1FE0:cont
loadseg_off dw 0
magicoffset "loadseg", 5Ch, 5Ch
loadseg_seg dw LOADSEG
loadseg_off dw 0
loadseg_seg dw LOADSEG
cont:
mov ds, ax
mov ss, ax
lea sp, [bp-0x60]
sti
mov ds, ax
mov ss, ax
lea sp, [bp-0x60]
sti
;
; Note: some BIOS implementations may not correctly pass drive number
; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL
; (formerly we checked for [drive]==0xff; update sys.c if code moves)
;
magicoffset "set unit", 66h, 66h
mov [drive], dl ; rely on BIOS drive number in DL
mov [drive], dl ; rely on BIOS drive number in DL
mov LBA_SIZE, 10h
mov LBA_SECNUM,1 ; initialise LBA packet constants
mov word [LBA_SEG],ds
mov word [LBA_OFF],READBUF
mov LBA_SIZE, 10h
mov LBA_SECNUM,1 ; initialise LBA packet constants
mov word [LBA_SEG],ds
mov word [LBA_OFF],READBUF
; GETDRIVEPARMS: Calculate start of some disk areas.
@ -279,7 +235,7 @@ cont:
les di, [loadsegoff_60] ; es:di = 60:0
; Search for KERNEL.SYS file name, and find start cluster.
; Search for KERNEL.SYS file name, and find start cluster.
next_entry: mov cx, 11
mov si, filename
@ -290,10 +246,10 @@ next_entry: mov cx, 11
je ffDone
add di, byte 0x20 ; go to next directory entry
cmp byte [es:di], 0 ; if the first byte of the name is 0,
jnz next_entry ; there is no more files in the directory
cmp byte [es:di], 0 ; if the first byte of the name is 0,
jnz next_entry ; there is no more files in the directory
jmp boot_error ; fail if not found
jc boot_error ; fail if not found
ffDone:
push ax ; store first cluster number
@ -310,7 +266,7 @@ ffDone:
;
; Call with: AX = first cluster in chain
les bx, [loadsegoff_60] ; es:bx=60:0
les bx, [loadsegoff_60] ; es:bx=60:0
mov di, [sectPerFat]
mov ax, word [fat_start]
mov dx, word [fat_start+2]
@ -320,8 +276,8 @@ ffDone:
; Set ES:DI to the temporary storage for the FAT chain.
push ds
pop es
mov ds, [loadseg_60]
mov di, CLUSTLIST
mov ds, [loadseg_60]
mov di, FATBUF
next_clust: stosw ; store cluster number
mov si, ax ; SI = cluster number
@ -340,8 +296,8 @@ fat_12: add si, si ; multiply cluster number by 3...
; the number was odd, CF was set in the last shift instruction.
jnc fat_even
mov cl, 4
shr ax, cl
mov cl, 4
shr ax, cl
fat_even: and ah, 0x0f ; mask off the highest 4 bits
cmp ax, 0x0ff8 ; check for EOF
@ -378,7 +334,7 @@ finished: ; Mark end of FAT chain with 0, so we have a single
les bx, [loadsegoff_60] ; set ES:BX to load address 60:0
mov si, CLUSTLIST ; set DS:SI to the FAT chain
mov si, FATBUF ; set DS:SI to the FAT chain
cluster_next: lodsw ; AX = next cluster to read
or ax, ax ; EOF?
@ -390,9 +346,7 @@ load_next: dec ax ; cluster numbers start with 2
dec ax
mov di, word [bsSecPerClust]
dec di ; minus one if 256 spc
and di, 0xff ; DI = sectors per cluster - 1
inc di ; = spc
and di, 0xff ; DI = sectors per cluster
mul di
add ax, [data_start]
adc dx, [data_start+2] ; DX:AX = first sector to read
@ -401,19 +355,18 @@ load_next: dec ax ; cluster numbers start with 2
; shows text after the call to this function.
show.do_show:
mov ah, 0Eh ; show character
int 10h ; via "TTY" mode
show: pop si
lodsb ; get character
push si ; stack up potential return address
cmp al, 0 ; end of string?
jne .do_show ; until done
mov ah,0x0E ; show character
int 0x10 ; via "TTY" mode
cmp al,'.' ; end of string?
jne show ; until done
ret
boot_error: call show
; db "Error! Hit a key to reboot.",0
db "Error!",0
; db "Error! Hit a key to reboot."
db "Error!."
xor ah,ah
int 0x13 ; reset floppy
@ -432,59 +385,53 @@ boot_error: call show
readDisk: push si
mov LBA_SECTOR_0,ax
mov LBA_SECTOR_16,dx
mov word [READADDR_SEG], es
mov word [READADDR_OFF], bx
mov LBA_SECTOR_0,ax
mov LBA_SECTOR_16,dx
mov word [READADDR_SEG], es
mov word [READADDR_OFF], bx
%ifndef QUIET
call show
db ".",0
%else ; ensure code after this still at same location
times 5 nop
%endif
db "."
read_next:
;******************** LBA_READ *******************************
; check for LBA support
mov ah,041h ;
mov bx,055aah ;
; check for LBA support
mov ah,041h ;
mov bx,055aah ;
mov dl, [drive]
magicoffset "LBA detection", 17Bh, 178h
test dl,dl ; don't use LBA addressing on A:
jz read_normal_BIOS ; might be a (buggy)
; CDROM-BOOT floppy emulation
test dl,dl ; don't use LBA addressing on A:
jz read_normal_BIOS ; might be a (buggy)
; CDROM-BOOT floppy emulation
int 0x13
jc read_normal_BIOS
jc read_normal_BIOS
shr cx,1 ; CX must have 1 bit set
shr cx,1 ; CX must have 1 bit set
sbb bx,0aa55h - 1 ; tests for carry (from shr) too!
jne read_normal_BIOS
sbb bx,0aa55h - 1 ; tests for carry (from shr) too!
jne read_normal_BIOS
; OK, drive seems to support LBA addressing
; OK, drive seems to support LBA addressing
lea si,[LBA_PACKET]
lea si,[LBA_PACKET]
; 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
; 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:
;******************** END OF LBA_READ ************************
mov cx,LBA_SECTOR_0
mov dx,LBA_SECTOR_16
mov cx,LBA_SECTOR_0
mov dx,LBA_SECTOR_16
;
@ -557,7 +504,6 @@ do_int13_read:
times 0x01f1-$+$$ db 0
magicoffset "kernel name", 1F1h, 1F1h
filename db "KERNEL SYS",0,0
sign dw 0xAA55
@ -565,29 +511,28 @@ sign dw 0xAA55
%ifdef DBGPRNNUM
; DEBUG print hex digit routines
PrintLowNibble: ; Prints low nibble of AL, AX is destroyed
and AL, 0Fh ; ignore upper nibble
cmp AL, 09h ; if greater than 9, then don't base on '0', base on 'A'
jbe .printme
add AL, 7 ; convert to character A-F
.printme:
add AL, '0' ; convert to character 0-9
mov AH,0x0E ; show character
int 0x10 ; via "TTY" mode
retn
and AL, 0Fh ; ignore upper nibble
cmp AL, 09h ; if greater than 9, then don't base on '0', base on 'A'
jbe .printme
add AL, 7 ; convert to character A-F
.printme:
add AL, '0' ; convert to character 0-9
mov AH,0x0E ; show character
int 0x10 ; via "TTY" mode
retn
PrintAL: ; Prints AL, AX is preserved
push AX ; store value so we can process a nibble at a time
shr AL, 4 ; move upper nibble into lower nibble
call PrintLowNibble
pop AX ; restore for other nibble
push AX ; but save so we can restore original AX
call PrintLowNibble
pop AX ; restore for other nibble
retn
push AX ; store value so we can process a nibble at a time
shr AL, 4 ; move upper nibble into lower nibble
call PrintLowNibble
pop AX ; restore for other nibble
push AX ; but save so we can restore original AX
call PrintLowNibble
pop AX ; restore for other nibble
retn
PrintNumber: ; Prints (in Hex) value in AX, AX is preserved
xchg AH, AL ; high byte 1st
call PrintAL
xchg AH, AL ; now low byte
call PrintAL
retn
xchg AH, AL ; high byte 1st
call PrintAL
xchg AH, AL ; now low byte
call PrintAL
retn
%endif

View File

@ -1,37 +1,34 @@
; Memory layout for the FreeDOS FAT32 single stage boot process:
;
; ...
; |-------| 1FE0h:7E00h = 27C00h (159 KiB)
; |BOOTSEC| loader relocates itself here first thing,
; |RELOC. | before loading root directory/FAT/kernel file
; |-------| 1FE0h:7C00h = 27A00h (158 KiB)
; | STACK | below relocated loader, above FAT sector (size 22 KiB)
; ...
; |-------| 2200h:2000h = 24000h (144 KiB)
; | FAT | (only 1 sector buffered, maximum sector size 8 KiB)
; |-------| 2200h:0000h = 22000h (136 KiB)
; ...
; |-------| 0000h:7E00h = 07E00h (31.5 KiB)
; |BOOTSEC| overwritten by the kernel, so the
; |ORIGIN | bootsector relocates itself up...
; |-------| 0000h:7C00h = 07C00h (31 KiB)
; ...
; |-------|
; |KERNEL | maximum size 128 KiB (overwrites bootsec origin)
; |LOADED | (holds 1 sector directory buffer before kernel file load)
; |-------| 0060h:0000h = 00600h (1.5 KiB)
; ...
; The kernel load segment may be patched using the SYS /L switch.
; We support values between 0x60 and 0x200 here, with file size
; of up to 128 KiB (rounded to cluster size). Default is 0x60.
; +--------+
; | |
; | |
; |--------| 4000:0000
; | |
; | FAT |
; | |
; |--------| 2000:0000
; |BOOT SEC|
; |RELOCATE|
; |--------| 1FE0:0000
; | |
; | |
; | |
; | |
; |--------|
; |BOOT SEC|
; |ORIGIN | 07C0:0000
; |--------|
; | |
; | |
; | |
; |--------|
; |KERNEL |
; |LOADED |
; |--------| 0060:0000
; | |
; +--------+
;%define MULTI_SEC_READ 1
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 0
%include "magic.mac"
segment .text
@ -60,16 +57,11 @@ Entry: jmp short real_start
%define xrootClst bp+0x2c ; Starting cluster of root directory
%define drive bp+0x40 ; Drive number
times 52h - ($ - $$) db 0
; The filesystem ID is used by lDOS's instsect (by ecm)
; by default to validate that the filesystem matches.
db "FAT32"
times 5Ah - ($ - $$) db 32
times 0x5a-$+$$ db 0
%define LOADSEG 0x0060
%define FATSEG 0x2200
%define FATSEG 0x2000
%define fat_sector bp+0x48 ; last accessed sector of the FAT
@ -100,14 +92,12 @@ real_start: cld
jmp word 0x1FE0:cont
loadseg_off dw 0
magicoffset "loadseg", 78h
loadseg_seg dw LOADSEG
cont: mov ds, ax
mov ss, ax
lea sp, [bp-0x20]
sti
magicoffset "set unit", 82h
mov [drive], dl ; BIOS passes drive number in DL
; call print
@ -149,7 +139,7 @@ secshift: inc ax
shr cx, 1
cmp cx, 1
jne secshift
mov word [fat_secshift], ax
mov byte [fat_secshift], al
dec cx
; FINDFILE: Searches for the file in the root directory.
@ -221,10 +211,6 @@ c6:
jmp short c5
boot_error:
mov ax, 0E00h | '!'
int 10h ; display the error sign
mov al, 07h
int 10h ; beep
xor ah,ah
int 0x16 ; wait for a key
int 0x19 ; reboot the machine
@ -245,7 +231,8 @@ next_cluster:
cn_loop:
shr dx,1
rcr ax,1
loop cn_loop ; DX:AX fat sector where our
dec cx
jnz cn_loop ; DX:AX fat sector where our
; cluster resides
; DI - cluster index in this
; sector
@ -277,9 +264,8 @@ cn_exit:
ret
boot_success:
mov dl, [drive] ; for Enhanced DR-DOS load
mov bl, dl ; for FreeDOS load
boot_success:
mov bl, [drive]
jmp far [loadsegoff_60]
; Convert cluster to the absolute sector
@ -303,9 +289,7 @@ c3:
sub ax, 2
sbb cx, byte 0 ; CX:AX == cluster - 2
mov bl, [bsSecPerClust]
dec bx ; bl = spc - 1, 0FFh if 256 spc
sub bh, bh ; bx = spc - 1
inc bx ; bx = spc
sub bh, bh
xchg cx, ax ; AX:CX == cluster - 2
mul bx ; first handle high word
; DX must be 0 here
@ -316,7 +300,6 @@ c3:
adc dx, [data_start + 2]
ret
%if 0
; prints text after call to this function.
print_1char:
@ -329,8 +312,7 @@ print1: lodsb ; get token
cmp al, 0 ; end of string?
jne print_1char ; until done
ret ; and jump to it
%endif
;input:
; DX:AX - 32-bit DOS sector number
; ES:BX - destination buffer
@ -399,15 +381,12 @@ read_ok:
mov es, cx
no_incr_es:
inc ax
jnz .no_carry
inc dx
.no_carry:
add ax,byte 1
adc dx,byte 0
ret
times 0x01f1-$+$$ db 0
magicoffset "kernel name", 1F1h
filename db "KERNEL SYS",0,0
sign dw 0xAA55

View File

@ -27,36 +27,27 @@
; Memory layout for the FreeDOS FAT32 single stage boot process:
;
; ...
; |-------| 1FE0h:7E00h = 27C00h (159 KiB)
; |BOOTSEC| loader relocates itself here first thing,
; |RELOC. | before loading root directory/FAT/kernel file
; |-------| 1FE0h:7C00h = 27A00h (158 KiB)
; | STACK | below relocated loader, above FAT sector (size 22 KiB)
; |-------| 1FE0:7E00
; |BOOTSEC|
; |RELOC. |
; |-------| 1FE0:7C00
; ...
; |-------| 2200h:2000h = 24000h (144 KiB)
; | FAT | (only 1 sector buffered, maximum sector size 8 KiB)
; |-------| 2200h:0000h = 22000h (136 KiB)
; |-------| 2000:0200
; | FAT | (only 1 sector buffered)
; |-------| 2000:0000
; ...
; |-------| 0000h:7E00h = 07E00h (31.5 KiB)
; |-------| 0000:7E00
; |BOOTSEC| overwritten by the kernel, so the
; |ORIGIN | bootsector relocates itself up...
; |-------| 0000h:7C00h = 07C00h (31 KiB)
; |-------| 0000:7C00
; ...
; |-------|
; |KERNEL | maximum size 128 KiB (overwrites bootsec origin)
; |LOADED | (holds 1 sector directory buffer before kernel file load)
; |-------| 0060h:0000h = 00600h (1.5 KiB)
; |KERNEL | maximum size 134k (overwrites bootsec origin)
; |LOADED | (holds 1 sector directory buffer before kernel load)
; |-------| 0060:0000
; ...
; The kernel load segment may be patched using the SYS /L switch.
; We support values between 0x60 and 0x200 here, with file size
; of up to 128 KiB (rounded to cluster size). Default is 0x60.
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 0
%include "magic.mac"
segment .text
@ -94,7 +85,7 @@ Entry: jmp short real_start
%define LOADSEG 0x0060
%define FATSEG 0x2200
%define FATSEG 0x2000
%define fat_secshift fat_afterss-1 ; each fat sector describes 2^??
; clusters (db) (selfmodifying)
@ -105,11 +96,7 @@ Entry: jmp short real_start
%define data_start bp+0x4c ; first data sector (dd)
; (overwriting unused bytes)
times 52h - ($ - $$) db 0
; The filesystem ID is used by lDOS's instsect (by ecm)
; by default to validate that the filesystem matches.
db "FAT32"
times 5Ah - ($ - $$) db 32
times 0x5a-$+$$ db 0
; not used: [0x42] = byte 0x29 (ext boot param flag)
; [0x43] = dword serial
; [0x47] = label (padded with 00, 11 bytes)
@ -134,9 +121,7 @@ real_start: cld
rep movsw ; move boot code to the 0x1FE0:0x0000
jmp word 0x1FE0:cont
loadseg_off dw 0
magicoffset "loadseg", 78h
dw LOADSEG
loadseg_off dw 0, LOADSEG
; -------------
@ -144,15 +129,10 @@ cont: mov ds, ax
mov ss, ax ; stack and BP-relative moves up, too
lea sp, [bp-0x20]
sti
magicoffset "set unit", 82h
mov [drive], dl ; BIOS passes drive number in DL
%ifndef QUIET
mov si, msg_LoadFreeDOS
call print ; modifies AX BX SI
%else ; ensure code after this still at same location
times 6 nop
%endif
; -------------
@ -254,9 +234,7 @@ rk_walk_fat: pop eax
;-----------------------------------------------------------------------
boot_success:
mov dl, [drive] ; for Enhanced DR-DOS load
mov bl, dl ; for FreeDOS load
boot_success: mov bl, [drive]
jmp far [loadsegoff_60]
;-----------------------------------------------------------------------
@ -331,8 +309,6 @@ convert_cluster:
dec eax
movzx edx, byte [bsSecPerClust]
dec dl ; spc - 1
inc dx ; spc
push edx
mul edx
pop edx
@ -421,7 +397,6 @@ msg_BootError db "No "
; currently, only "kernel.sys not found" gives a message,
; but read errors in data or root or fat sectors do not.
magicoffset "kernel name", 1F1h
filename db "KERNEL SYS"
sign dw 0, 0xAA55

View File

@ -1,76 +0,0 @@
; Public Domain 2024 by E. C. Masloch
%macro _appenddigitstrdef 2.nolist
%substr %%ii "0123456789ABCDEF" (%2) + 1
%strcat _%1 _%1,%%ii
%endmacro
; %1 = name of single-line macro to set. will be prefixed by underscore
; %2 = number to write
; %3 = minimal number of hexits, 0..8. defaults to 1
; (setting it to 0 with a number of 0 defines macro to "")
%macro _autohexitsstrdef 2-3.nolist 1
%if %3 > 8
%error Minimal number of hexits 9 or more: %3
%endif
%define _%1 ""
%if (%2) >= 1_0000_0000h
%error Number has to use 9 or more hexits: %2
%endif
%if (%2) >= 1000_0000h || %3 >= 8
_appenddigitstrdef %1, (%2 >> (7 * 4)) & 0Fh
%endif
%if (%2) >= 100_0000h || %3 >= 7
_appenddigitstrdef %1, (%2 >> (6 * 4)) & 0Fh
%endif
%if (%2) >= 10_0000h || %3 >= 6
_appenddigitstrdef %1, (%2 >> (5 * 4)) & 0Fh
%endif
%if (%2) >= 1_0000h || %3 >= 5
_appenddigitstrdef %1, (%2 >> (4 * 4)) & 0Fh
%endif
%if (%2) >= 1000h || %3 >= 4
_appenddigitstrdef %1, (%2 >> (3 * 4)) & 0Fh
%endif
%if (%2) >= 100h || %3 >= 3
_appenddigitstrdef %1, (%2 >> (2 * 4)) & 0Fh
%endif
%if (%2) >= 10h || %3 >= 2
_appenddigitstrdef %1, (%2 >> (1 * 4)) & 0Fh
%endif
%if (%2) >= 1h || %3 >= 1
_appenddigitstrdef %1, (%2 >> (0 * 4)) & 0Fh
%endif
%endmacro
%macro magicoffset 2-4.nolist ,0
%if ISFAT1216DUAL
%ifdef ISFAT12
%define SYSOFFSET %2
%elifdef ISFAT16
%define SYSOFFSET %3
%else
%define SYSOFFSET 0
; Just a placeholder, so the proper error message
; will be shown when assembling without either
; of the ISFATx defines.
%endif
%else
%define SYSOFFSET %2
%ifnempty %3
%error Not in dual mode
%endif
%endif
%assign NEWOFFSET $ + %4 - Entry
%if NEWOFFSET != SYSOFFSET
_autohexitsstrdef NEWOFFSETHEX, NEWOFFSET
%strcat _NEWOFFSETHEX _NEWOFFSETHEX,'h'
%deftok NEWOFFSET _NEWOFFSETHEX
%if ISFAT1216DUAL
%error Magic offset %1 changed for FATFS, old=SYSOFFSET, new=NEWOFFSET
%else
%error Magic offset %1 changed, old=SYSOFFSET, new=NEWOFFSET
%endif
%endif
%endmacro

View File

@ -1,33 +1,37 @@
#
# makefile for DOS-C boot
#
# $Id$
#
!include "../mkfiles/generic.mak"
production: fat12com.bin fat16com.bin fat32chs.bin fat32lba.bin oemfat12.bin oemfat16.bin
########################################################################
fat12com.bin: boot.asm magic.mac
$(NASM) -dISFAT12 $(NASMBOOTFLAGS) boot.asm -lfat12com.lst -ofat12com.bin
all: fat12.bin fat16.bin fat32chs.bin fat32lba.bin oemfat12.bin oemfat16.bin
fat16com.bin: boot.asm magic.mac
$(NASM) -dISFAT16 $(NASMBOOTFLAGS) boot.asm -lfat16com.lst -ofat16com.bin
fat12.bin: boot.asm $(DEPENDS)
$(NASM) -DISFAT12 boot.asm -l$*.lst -o$*.bin
fat32chs.bin: boot32.asm magic.mac
$(NASM) $(NASMBOOTFLAGS) boot32.asm -lfat32chs.lst -ofat32chs.bin
fat16.bin: boot.asm $(DEPENDS)
$(NASM) -DISFAT16 boot.asm -l$*.lst -o$*.bin
fat32lba.bin: boot32lb.asm magic.mac
$(NASM) $(NASMBOOTFLAGS) boot32lb.asm -lfat32lba.lst -ofat32lba.bin
fat32chs.bin: boot32.asm $(DEPENDS)
$(NASM) boot32.asm -l$*.lst -o$*.bin
oemfat12.bin: oemboot.asm magic.mac
$(NASM) -dISFAT12 $(NASMBOOTFLAGS) oemboot.asm -loemfat12.lst -ooemfat12.bin
fat32lba.bin: boot32lb.asm $(DEPENDS)
$(NASM) boot32lb.asm -l$*.lst -o$*.bin
oemfat16.bin: oemboot.asm magic.mac
$(NASM) -dISFAT16 $(NASMBOOTFLAGS) oemboot.asm -loemfat16.lst -ooemfat16.bin
oemfat12.bin: oemboot.asm $(DEPENDS)
$(NASM) -DISFAT12 oemboot.asm -l$*.lst -o$*.bin
clobber: clean
-$(RM) *.bin status.me
oemfat16.bin: oemboot.asm $(DEPENDS)
$(NASM) -DISFAT16 oemboot.asm -l$*.lst -o$*.bin
########################################################################
clean:
-$(RM) *.lst *.map *.bak *.obj
-$(RM) *.bak *.cod *.crf *.err *.las *.lst *.map *.obj *.xrf
clobber: clean
-$(RM) *.bin status.me

View File

@ -116,11 +116,6 @@
; |IVT | Interrupt Vector Table
; +--------+ 0000:0000
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 1
%include "magic.mac"
CPU 8086 ; enable assembler warnings to limit instruction set
;%define ISFAT12 1 ; only 1 of these should be set,
@ -148,7 +143,7 @@ segment .text
%define FATBUF bp-0x7500 ; offset of temporary buffer for FAT
; chain 0:FATBUF = 0:0700 = LOADSEG:0
%define ROOTDIR 0x7C00-0x7700 ; offset to buffer for root directory
%define ROOTDIR bp-0x7700 ; offset to buffer for root directory
; entry of kernel 0:ROOTDIR
%define CLUSTLIST bp+0x0300 ; zero terminated list of clusters
; that the kernel occupies
@ -228,22 +223,7 @@ Entry: jmp short real_start
db 0x29 ; extended boot record id
dd 0x12345678 ; volume serial number
db 'NO NAME '; volume label
times 36h - ($ - $$) db 0
; The filesystem ID is used by lDOS's instsect (by ecm)
; by default to validate that the filesystem matches.
%ifdef ISFAT12
%define FATFS "FAT12"
%ifdef ISFAT16
%error Must select one FS
%endif
%elifdef ISFAT16
%define FATFS "FAT16"
%else
%define FATFS "unknown"
%error Must select one FS
%endif
db FATFS ; filesystem id
times 3Eh - ($ - $$) db 32
db 'FAT12 ' ; filesystem id
;-----------------------------------------------------------------------
; ENTRY
@ -289,7 +269,6 @@ real_start:
; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL
; (formerly we checked for [drive]==0xff; update sys.c if code moves)
;
magicoffset "set unit", 4Fh, 4Fh
mov [drive], dl ; rely on BIOS drive number in DL
@ -340,11 +319,11 @@ real_start:
pop di ; mov di, word [RootDirSecs]
pop ax ; mov ax, word [root_dir_start]
pop dx ; mov dx, word [root_dir_start+2]
mov bx, ROOTDIR ; es:bx = 0:0500
lea bx, [ROOTDIR] ; es:bx = 0:0500
push es ; save pointer to ROOTDIR
call readDisk
pop es ; restore pointer to ROOTDIR
mov si, ROOTDIR ; ds:si = 0:0500
lea si, [ROOTDIR] ; ds:si = 0:0500
; Search for kernel file name, and find start cluster.
@ -361,7 +340,6 @@ next_entry: mov cx, 11
jc boot_error ; fail if not found and si wraps
cmp byte [si], 0 ; if the first byte of the name is 0,
jnz next_entry ; there are no more files in the directory
jmp boot_error
ffDone:
mov [first_cluster], ax ; store first cluster number
@ -369,7 +347,7 @@ ffDone:
%ifdef SETROOTDIR
; copy over this portion of root dir to 0x0:500 for PC-DOS
; (this may allow IBMBIO.COM to start in any directory entry)
mov di, ROOTDIR ; es:di = 0:0500
lea di, [ROOTDIR] ; es:di = 0:0500
mov cx, 32 ; limit to this 1 entry (rest don't matter)
rep movsw
%endif
@ -421,12 +399,11 @@ fat_12: add si, si ; multiply cluster number by 3...
; value is in bits 4-15, and must be shifted right 4 bits. If
; the number was odd, CF was set in the last shift instruction.
mov cl, 4 ; always initialise shift counter
jc fat_odd ; is odd, only shift down -->
shl ax, cl ; shift up (effectively masks off
; the highest 4 bits)
fat_odd:
jnc fat_even
mov cl, 4
shr ax, cl
fat_even: and ah, 0x0f ; mask off the highest 4 bits
cmp ax, 0x0ff8 ; check for EOF
jb next_clust ; continue if not EOF
@ -478,14 +455,13 @@ cluster_next: lodsw ; AX = next cluster to read
%else
jmp LOADSEG:0000 ; yes, pass control to kernel
%endif
magicoffset "load jump ofs", 11Ah, 118h, -4
; failed to boot
boot_error:
call show
; db "Error! Hit a key to reboot.",0
db "):",0
; db "Error! Hit a key to reboot."
db "):."
%ifdef LOOPONERR
jmp $
%else
@ -502,9 +478,7 @@ load_next: dec ax ; cluster numbers start with 2
dec ax
mov di, word [bsSecPerClust]
dec di ; minus one if 256 spc
and di, 0xff ; DI = sectors per cluster - 1
inc di ; = spc
and di, 0xff ; DI = sectors per cluster
mul di
add ax, [data_start]
adc dx, [data_start+2] ; DX:AX = first sector to read
@ -514,14 +488,13 @@ load_next: dec ax ; cluster numbers start with 2
; shows text after the call to this function.
show.do_show:
mov ah, 0Eh ; show character
int 10h ; via "TTY" mode
show: pop si
lodsb ; get character
push si ; stack up potential return address
cmp al, 0 ; end of string?
jne .do_show ; until done
mov ah,0x0E ; show character
int 0x10 ; via "TTY" mode
cmp al,'.' ; end of string?
jne show ; until done
ret
@ -543,7 +516,7 @@ readDisk: push si ; preserve cluster #
mov word [LBA_OFF], bx
call show
db ".",0
db "."
read_next:
; initialize constants
@ -664,8 +637,6 @@ read_skip:
ret
times 0x01f1-$+$$ db 0
magicoffset "kernel name", 1F1h, 1F1h
%ifdef MSCOMPAT
filename db "IO SYS"
%else

View File

@ -1,6 +1,7 @@
@echo off
rem batch file to build everything
rem IF NOTHING COMPILES, CHECK IF YOUR CVS CHECKOUT USES CORRECT DOS LINEBREAKS
:- batch file to build everything
:- $Id$
if NOT "%1" == "/?" goto start
echo ":-----------------------------------------------------------------------"
@ -13,7 +14,6 @@ goto end
:start
:- assume an error until successful build
set XERROR=1
if "%XERROR%" == "" goto noenv
@ -24,7 +24,7 @@ if not exist config.bat echo You must copy CONFIG.B to CONFIG.BAT and edit it to
if not exist config.bat goto abort
call config.bat
:-if "%LAST%" == "" goto noenv
if "%LAST%" == "" goto noenv
:-----------------------------------------------------------------------
:- following is command line handling
@ -36,10 +36,10 @@ call config.bat
if "%1" == "fat32" set XFAT=32
if "%1" == "fat16" set XFAT=16
if "%1" == "msc" set COMPILER=MSCL8
if "%1" == "msc" set COMPILER=MSC
if "%1" == "wc" set COMPILER=WATCOM
if "%1" == "tc" set COMPILER=TC2
if "%1" == "tcpp" set COMPILER=TURBOCPP
if "%1" == "tc" set COMPILER=TC
if "%1" == "tcpp" set COMPILER=TCPP
if "%1" == "bc" set COMPILER=BC
if "%1" == "86" set XCPU=86
@ -50,7 +50,6 @@ if "%1" == "x86" goto setCPU
if "%1" == "upx" set XUPX=upx --8086 --best
if "%1" == "debug" set ALLCFLAGS=%ALLCFLAGS% -DDEBUG
if "%1" == "lfn" set ALLCFLAGS=%ALLCFLAGS% -DWITHLFNAPI
if "%1" == "lfnapi" set ALLCFLAGS=%ALLCFLAGS% -DWITHLFNAPI
if "%1" == "win" set ALLCFLAGS=%ALLCFLAGS% -DWIN31SUPPORT
@ -65,8 +64,11 @@ if "%1" == "/D" goto setDefine
shift
if not "%1" == "" goto loop_commandline
call default.bat
:-if "%LAST%" == "" goto noenv
if "%COMPILER%" == "" echo you MUST define a COMPILER variable in CONFIG.BAT
if "%COMPILER%" == "" goto abort
call defaults.bat
if "%LAST%" == "" goto noenv
:-----------------------------------------------------------------------
:- finally - we are going to compile
@ -78,35 +80,35 @@ echo.
echo Process UTILS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd utils
%MAKE% production
call %MAKE% all
if errorlevel 1 goto abort-cd
echo.
echo Process LIB ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\lib
%MAKE%
call %MAKE% all
if errorlevel 1 goto abort-cd
echo.
echo Process DRIVERS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\drivers
%MAKE% production
call %MAKE% all
if errorlevel 1 goto abort-cd
echo.
echo Process BOOT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\boot
%MAKE% production
call %MAKE% all
if errorlevel 1 goto abort-cd
echo.
echo Process SYS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\sys
%MAKE% production
call %MAKE% all
if errorlevel 1 goto abort-cd
if NOT "%XUPX%" == "" %XUPX% ..\bin\sys.com
@ -114,28 +116,15 @@ echo.
echo Process KERNEL +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\kernel
%MAKE% production
if errorlevel 1 goto abort-cd
echo.
echo Process COUNTRY +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\country
%MAKE% DIRSEP=\ CP=copy production
if errorlevel 1 goto abort-cd
echo.
echo Process SETVER +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\setver
%MAKE% production
call %MAKE% all
if errorlevel 1 goto abort-cd
cd ..
:- if you like, put finalizing commands (like copy to floppy) into build2.bat
set XERROR=
:- if you like, put finalizing commands (like copy to floppy) into build2.bat
if exist build2.bat call build2.bat
echo.
@ -166,18 +155,8 @@ if "%1" == "" echo such as /D DEBUG : extra DEBUG output
if "%1" == "" echo or /D DOSEMU : printf output goes to dosemu log
if "%1" == "" echo or /D WIN31SUPPORT : enable Win 3.x hooks
if "%1" == "" goto abort
if "%2" == "/V" goto :setDefineWithValue
set ALLCFLAGS=%ALLCFLAGS% -D%1
set NASMFLAGS=%NASMFLAGS% -D%1
REM $(NASMBOOTFLAGS) are extra flags only used when building boot sectors
set NASMBOOTFLAGS=%NASMBOOTFLAGS% -d%1
goto nextOption
:setDefineWithValue
set ALLCFLAGS=%ALLCFLAGS% -D%1=%3
set NASMFLAGS=%NASMFLAGS% -D%1=%3
shift
shift
goto nextOption
:noenv
@ -191,4 +170,4 @@ cd ..
echo Compilation was aborted!
:end
call default.bat clearset
call defaults.bat clearset

View File

@ -1,65 +1,77 @@
@echo off
rem IF NOTHING COMPILES, CHECK IF YOUR CVS CHECKOUT USES CORRECT DOS LINEBREAKS
:- $Id: buildall.bat 1305 2006-10-31 21:13:02Z bartoldeman $
:----------------------------------------------------------
:- batch file to build _many_ KERNELS, hope build works.
:- takes 3 minutes on my(TE) Win2K/P700. your milage may vary :-)
:- batch file to build _many_ KERNELS
:----------------------------------------------------------
if "%1" == "$SUMMARY" goto summary
set onerror=if not "%XERROR%" == "" goto daswarwohlnix
:***** MSCL kernels
call config.bat
if "%LAST%" == "" goto end
if "%MS_BASE%" == "" goto no_ms
call build -r msc 386 fat16
%ONERROR%
call build -r msc 186 fat16
%ONERROR%
call build -r msc 86 fat16
%ONERROR%
call build -r msc 386 fat32
%ONERROR%
call build -r msc 186 fat32
%ONERROR%
call build -r msc 86 fat32
%ONERROR%
:***** MSVC kernels
if "%MSC_BASE%" == "" goto no_ms
call build.bat -r msc 386 fat16
if "%XERROR%" == "" call build.bat -r msc 186 fat16
if "%XERROR%" == "" call build.bat -r msc 86 fat16
if "%XERROR%" == "" call build.bat -r msc 386 fat32
if "%XERROR%" == "" call build.bat -r msc 186 fat32
if "%XERROR%" == "" call build.bat -r msc 86 fat32
if not "%XERROR%" == "" goto daswarwohlnix
:no_ms
:***** TC 2.01 kernels
if "%TC2_BASE%" == "" goto no_tc
call build -r tc 186 fat16
%ONERROR%
call build -r tc 86 fat16
%ONERROR%
call build -r tc 186 fat32
%ONERROR%
call build -r tc 86 fat32
%ONERROR%
if "%TC_BASE%" == "" goto no_tc
call build.bat -r tc 186 fat16
if "%XERROR%" == "" call build.bat -r tc 86 fat16
if "%XERROR%" == "" call build.bat -r tc 186 fat32
if "%XERROR%" == "" call build.bat -r tc 86 fat32
if not "%XERROR%" == "" goto daswarwohlnix
:no_tc
:***** TCPP kernels
if "%TCPP_BASE%" == "" goto no_tcpp
call build.bat -r tcpp 186 fat16
if "%XERROR%" == "" call build.bat -r tcpp 86 fat16
if "%XERROR%" == "" call build.bat -r tcpp 186 fat32
if "%XERROR%" == "" call build.bat -r tcpp 86 fat32
if not "%XERROR%" == "" goto daswarwohlnix
:no_tcpp
:***** BC kernels
if "%BC_BASE%" == "" goto no_bc
call build.bat -r bc 386 fat16
if "%XERROR%" == "" call build.bat -r bc 186 fat16
if "%XERROR%" == "" call build.bat -r bc 86 fat16
if "%XERROR%" == "" call build.bat -r bc 386 fat32
if "%XERROR%" == "" call build.bat -r bc 186 fat32
if "%XERROR%" == "" call build.bat -r bc 86 fat32
if not "%XERROR%" == "" goto daswarwohlnix
:no_bc
:***** (Open) Watcom kernels
if not "%COMPILER%" == "WATCOM" goto no_wc
call build -r wc 386 fat32
%ONERROR%
call build -r wc 386 fat16
%ONERROR%
call build -r wc 86 fat32
%ONERROR%
call build -r wc 86 fat16
%ONERROR%
if "%WATCOM%" == "" goto no_wc
call build.bat -r wc 386 fat32
if "%XERROR%" == "" call build.bat -r wc 386 fat16
if "%XERROR%" == "" call build.bat -r wc 86 fat32
if "%XERROR%" == "" call build.bat -r wc 86 fat16
if not "%XERROR%" == "" goto daswarwohlnix
:no_wc
:***** now rebuild the default kernel
call build -r
call build.bat -r
if not "%XERROR%" == "" goto daswarwohlnix
:**************************************************************
:* now we build a summary of all kernels HMA size + total size
@ -71,30 +83,30 @@ set Sumfile=bin\ksummary.txt
set TempSumfile=bin\tsummary.txt
:****echo >%TempSumfile% Summary of all kernels build
:****echo.|date >>%TempSumfile%
:****echo.|time >>%TempSumfile%
:****echo.|date >>%TempSumfile%
:****echo.|time >>%TempSumfile%
:****for %%i in (bin\k*.map) do call %0 $SUMMARY %%i
if exist %Sumfile% del %Sumfile%
if exist %TempSumfile% del %TempSumfile%
if exist %Sumfile% del %Sumfile%>nul
if exist %TempSumfile% del %TempSumfile%>nul
>ktemp.bat
for %%i in (bin\k*.map) do echo call %0 $SUMMARY %%i >>ktemp.bat
sort <ktemp.bat >ktemps.bat
call ktemps.bat
del ktemp.bat
del ktemps.bat
del ktemp.bat>nul
del ktemps.bat>nul
echo >>%Sumfile% Summary of all kernels build
echo.|date >>%Sumfile%
echo.|time >>%Sumfile%
echo.|date >>%Sumfile%
echo.|time >>%Sumfile%
find <%TempSumfile% "H" >>%Sumfile%
del %TempSumfile%
del %TempSumfile%>nul
set TempSumfile=
set Sumfile=
goto end
:summary
:summary
echo H************************************************* %2 >>%TempSumfile%
find<%2 " HMA_TEXT"|find/V "HMA_TEXT_START"|find/V "HMA_TEXT_END">>%TempSumfile%
find<%2 " STACK">>%TempSumfile%
@ -104,6 +116,5 @@ goto end
:daswarwohlnix
echo Sorry, something didn't work as expected :-(
set ONERROR=
:end

View File

@ -1,117 +0,0 @@
#!/bin/sh
set -e
if [ -z "${BUILD_DIR}" ] ; then
BUILD_DIR=$(pwd)
fi
echo BUILD_DIR is \"${BUILD_DIR}\"
# Output directory
rm -rf _output
mkdir _output
# GCC
mkdir _output/gcc
git clean -x -d -f -e test -e _output -e _downloads -e _watcom
make -C country clean
make all COMPILER=gcc
mv -n bin/KGC*.map bin/KGC*.sys _output/gcc/.
mv -n bin/country.sys _output/gcc/.
# GCC share
(
cd share
git submodule update --init --recursive
git clean -x -d -f
env COMPILER=gcc ./build.sh
)
mv -n share/src/share.com _output/gcc/.
mv -n share/src/share.map _output/gcc/.
# Watcom
OWTAR=ow-snapshot.tar.xz
if [ ! -d _watcom ] ; then
mkdir -p _downloads
mkdir _watcom
if [ ! -f _downloads/$OWTAR ] ; then
(cd _downloads && wget --no-verbose https://github.com/open-watcom/open-watcom-v2/releases/download/Last-CI-build/$OWTAR)
fi
(cd _watcom && tar -xf ../_downloads/$OWTAR)
fi
export WATCOM=$BUILD_DIR/_watcom
export PATH=$BUILD_DIR/bin:$PATH:$WATCOM/binl64
mkdir _output/wc
git clean -x -d -f -e test -e _output -e _downloads -e _watcom
make -C country clean
make all COMPILER=owlinux
mv -n bin/KWC*.map bin/KWC*.sys _output/wc/.
mv -n bin/country.sys _output/wc/.
## DOS (GCC)
#mkdir _output/gcc_dos
#git clean -x -d -f -e test -e _output -e _downloads -e _watcom
#{
# echo set COMPILER=GCC
# echo set MAKE=make
# echo set XCPU=386
# echo set XFAT=32
# echo set XNASM='C:\\devel\\nasm\\nasm'
# echo set OLDPATH=%PATH%
# echo set PATH='C:\\devel\\i16gnu\\bin;C:\\bin;%OLDPATH%'
#} | unix2dos > config.bat
#dosemu -td -q -K . -E "build.bat"
# DOS (Watcom)
mkdir _output/wc_dos
git clean -x -d -f -e test -e _output -e _downloads -e _watcom
{
echo set COMPILER=WATCOM
echo set WATCOM='C:\\devel\\watcomc'
echo set MAKE=wmake /ms
echo set XCPU=386
echo set XFAT=32
echo set XNASM='C:\\devel\\nasm\\nasm'
echo set XUPX=upx --8086 --best
echo set OLDPATH=%PATH%
echo set PATH='%WATCOM%\\binw;C:\\bin;%OLDPATH%'
echo set DOS4G=QUIET
} | unix2dos > config.bat
dosemu -td -q -K . -E "build.bat"
mv -n bin/KWC*.map bin/KWC*.sys _output/wc_dos/.
mv -n bin/country.sys _output/wc_dos/.
# DOS (Turbo C 2.01)
if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
mkdir _output/tc_dos
git clean -x -d -f -e test -e _output -e _downloads -e _watcom
{
echo set COMPILER=TC2
echo set TC2_BASE='C:\\tc201'
echo set MAKE=make
echo set XCPU=386
echo set XFAT=32
echo set XNASM=nasm
echo set OLDPATH=%PATH%
echo set PATH='%TC2_BASE%;C:\\devel\\nasm;C:\\bin;%OLDPATH%'
} | unix2dos > config.bat
dosemu -td -q -K . -E "build.bat lfn"
mv -n bin/KTC*.map bin/KTC*.sys _output/tc_dos/.
mv -n bin/country.sys _output/tc_dos/.
# TC share
(
cd share
git submodule update --init --recursive
git clean -x -d -f
env COMPILER=tcc2-emu ./build.sh
)
mv -n share/src/share.com _output/tc_dos/.
mv -n share/src/share.map _output/tc_dos/.
fi
echo done

View File

@ -1,82 +0,0 @@
#!/bin/sh
set -e
sudo add-apt-repository -y ppa:tkchia/build-ia16
sudo add-apt-repository -y ppa:dosemu2/ppa
sudo apt update
# for cross building
sudo apt install gcc-ia16-elf libi86-ia16-elf nasm upx qemu-system-x86 mtools util-linux bash
# for building with DOS using an emulator
sudo apt install dosemu2 dos2unix
# Perhaps later we should build using Freecom from published package
mkdir -p _downloads
cd _downloads
HERE=$(pwd)
#IBIBLIO_PATH='http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos'
IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3'
BASE=${IBIBLIO_PATH}/base
# get FreeDOS kernel
[ -f kernel.zip ] || wget --no-verbose ${BASE}/kernel.zip
# get FreeCOM
[ -f freecom.zip ] || wget --no-verbose ${BASE}/freecom.zip
DEVEL=${IBIBLIO_PATH}/devel
# get gnumake for DOS
[ -f djgpp_mk.zip ] || wget --no-verbose ${DEVEL}/djgpp_mk.zip
# get nasm for DOS
[ -f nasm.zip ] || wget --no-verbose ${DEVEL}/nasm.zip
# get upx for DOS
[ -f upx.zip ] || wget --no-verbose ${DEVEL}/upx.zip
# grab ia16-gcc from ibiblio.org
#[ -f i16gcc.zip ] || wget --no-verbose ${DEVEL}/i16gcc.zip
#[ -f i16newli.zip ] || wget --no-verbose ${DEVEL}/i16newli.zip
#[ -f i16butil.zip ] || wget --no-verbose ${DEVEL}/i16butil.zip
#[ -f i16lbi86.zip ] || wget --no-verbose ${DEVEL}/i16lbi86.zip
# get watcom for DOS
[ -f watcomc.zip ] || wget --no-verbose ${DEVEL}/watcomc.zip
mkdir -p ${HOME}/.dosemu/drive_c
cd ${HOME}/.dosemu/drive_c && (
mkdir -p bin
# Boot files
unzip -L -q ${HERE}/kernel.zip
cp -p bin/kernl386.sys ./kernel.sys
unzip -L -q ${HERE}/freecom.zip
cp -p bin/command.com ./command.com
cp -p /usr/share/dosemu/dosemu2-cmds-0.3/c/fdconfig.sys .
# Development files
unzip -L -q ${HERE}/djgpp_mk.zip
cp -p devel/djgpp/bin/make.exe bin/.
unzip -L -q ${HERE}/upx.zip
cp -p devel/upx/upx.exe bin/.
echo PATH to make and upx binaries is 'c:/bin'
unzip -L -q ${HERE}/nasm.zip
echo PATH to nasm binary is 'c:/devel/nasm'
# unzip -L -q ${HERE}/i16gcc.zip
# unzip -L -q ${HERE}/i16newli.zip
# unzip -L -q ${HERE}/i16butil.zip
# unzip -L -q ${HERE}/i16lbi86.zip
# echo PATH to ia16 binaries is 'c:/devel/i16gnu/bin'
unzip -L -q ${HERE}/watcomc.zip
echo PATH to watcom binaries is 'c:/devel/watcomc/binw'
)

View File

@ -1,52 +0,0 @@
#! /bin/bash
KVER=8632
if [ ! -f _output/gcc/KGC${KVER}.sys ] ; then
echo GCC built kernel not present
exit 1
fi
if [ ! -f _output/wc/KWC${KVER}.sys ] ; then
echo Watcom built kernel not present
exit 1
fi
if [ ! -f _output/wc_dos/KWC38632.sys ] ; then
echo Watcom DOS built kernel not present
exit 1
fi
if [ ! -f _output/tc_dos/KTC38632.sys ] && [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
echo Turbo C 2.01 built kernel not present
exit 1
fi
echo Kernels have all been built
find _output -ls
cd test
if ! ./test.sh ../_output/gcc/KGC${KVER}.sys diskgc bootgc 'boot gcc: '
then
echo GCC boot test failed
exit 2
fi
if ! ./test.sh ../_output/wc/KWC${KVER}.sys diskwc bootwc 'boot wc: '
then
echo OpenWatcom boot test failed
exit 2
fi
if ! ./test.sh ../_output/wc_dos/KWC38632.sys diskwcd bootwcd 'boot wcd: '
then
echo 'OpenWatcom(DOS) boot test failed'
exit 2
fi
if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
if ! ./test.sh ../_output/tc_dos/KTC38632.sys disktcd boottcd 'boot tcd: '
then
echo 'Turbo C 2.01 boot test failed'
exit 2
fi
fi
cd ..
exit 0

View File

@ -1,40 +1,45 @@
@echo off
:- batch file to clean everything
:- $Id: clean.bat 1181 2006-05-20 20:45:59Z mceric $
:- batch file to clean and clobber everything
:- $Id$
if "%1" == "" %0 clean
goto %1
goto end
:clean
:clobber
if not exist config.bat echo You must copy CONFIG.B to CONFIG.BAT and edit it to reflect your setup!
if not exist config.bat goto end
call config.bat
call default.bat
if not "%LAST%" == "" call defaults.bat
if "%LAST%" == "" goto end
cd utils
%MAKE% clean
call %MAKE% %1
cd ..\lib
%MAKE% clean
call %MAKE% %1
cd ..\drivers
%MAKE% clean
call %MAKE% %1
cd ..\boot
%MAKE% clean
call %MAKE% %1
cd ..\sys
%MAKE% clean
call %MAKE% %1
cd ..\kernel
%MAKE% clean
cd ..\setver
%MAKE% clean
call %MAKE% %1
cd ..\hdr
if exist *.bak del *.bak
if exist *.bak del *.bak>nul
cd ..
if exist *.bak del *.bak
if exist *.bak del *.bak>nul
if "%1"=="clobber" if exist status.me del status.me>nul
:end
default.bat clearset
defaults.bat clearset

View File

@ -1,46 +1 @@
@echo off
:- batch file to clobber everything
:- $Id: clobber.bat 1181 2006-05-20 20:45:59Z mceric $
if not exist config.bat echo You must copy CONFIG.B to CONFIG.BAT and edit it to reflect your setup!
if not exist config.bat goto end
call config.bat
call default.bat
cd utils
%MAKE% clobber
cd ..\lib
%MAKE% clobber
cd ..\drivers
%MAKE% clobber
cd ..\boot
%MAKE% clobber
cd ..\sys
%MAKE% clobber
cd ..\kernel
%MAKE% clobber
cd ..\setver
%MAKE% clobber
cd ..\hdr
if exist *.bak del *.bak
cd ..\bin
if exist sys.com del sys.com
if exist country.sys del country.sys
cd ..
if exist *.bak del *.bak
if exist status.me del status.me
:end
default.bat clearset
@clean clobber

181
config.b
View File

@ -1,126 +1,121 @@
:-
@echo off
:- batch file that is included in all other batch files for configuration
:- $Id$
:-----------------------------------------------------------------------
:- NOTICE! You must edit and rename this file to CONFIG.BAT!
:-----------------------------------------------------------------------
:- determine compiler(s) settings.
:-
:- you REQUIRED to
:- search for NASM - and set the path to NASM
:- search for COMPILER - and set the default compiler name
:- search for ??_BASE - and set the path to (all) compiler(s)
:-****************************************************************
:- NOTICE! You must edit and rename this file to CONFIG.BAT! *
:-****************************************************************
set LAST=
:-*********************************************************************
:- determine your compiler settings
:-
:- you have to
:- search for XNASM - and set the path for NASM
:- search for COMPILER - and set your compiler
:- search for ??_BASE - and set the path to your compiler
:-
:-*********************************************************************
:-----------------------------------------------------------------------
:- define NASM executable. It should not be protected mode DJGPP
:- version if you're using Windows NT/2k/XP to compile. also:
:- NASM/DJGPP crashes when using protected mode Borland's make.
:-**********************************************************************
:-- define NASM executable - remember - it should not be protected
:- mode DJGPP version if you're using Windows NT/2k/XP to compile
:- because DJGPP-nasm crashes when using protected mode Borland's
:- make under Windows NT/2k/XP
:-**********************************************************************
set NASM=c:\bin\nasm16
::set NASM=c:\bin\nasmw.exe
set XNASM=nasm
:**********************************************************************
:- define your COMPILER type here, pick one of them
:**********************************************************************
:-----------------------------------------------------------------------
:- define COMPILER name here, pick one of them.
:- Turbo C 2.01
:- set COMPILER=TC2
:: set COMPILER=TC
:- Turbo C++ 1.01
:- set COMPILER=TURBOCPP
:- Turbo C 3.0
:- set COMPILER=TC3
:- Borland C 3.1
set COMPILER=BC3
::set COMPILER=TCPP
:- Turbo C++ 3.0
::set COMPILER=TCPP3
:- Borland C
:- set COMPILER=BC5
::set COMPILER=BC
:- Microsoft C
:- set COMPILER=MSCL8
:- Watcom C (for DOS)
:- set COMPILER=WATCOM
:- Watcom C (for Windows)
:- set COMPILER=OWWIN
::set COMPILER=MSC
:- Watcom C
set COMPILER=WATCOM
:-**********************************************************************
:-- where is the BASE dir of your compiler(s) ??
:-**********************************************************************
:- set TC2_BASE=c:\tc201
:- set TP1_BASE=c:\tcpp
:- set TC3_BASE=c:\tc3
set BC3_BASE=c:\bc
:- set BC5_BASE=c:\bc5
:- set MS_BASE=c:\msvc
:-----------------------------------------------------------------------
:- define BASE dir of compiler;
:- may be defined for all installed compilers.
:- if WATCOM maybe you need to set your WATCOM environment variables
:- and path
:- if not \%WATCOM% == \ goto watcom_defined
:- set WATCOM=c:\watcom
:- set PATH=%PATH%;%WATCOM%\binw
:- set DOS4G=QUIET
:watcom_defined
::set TC_BASE=c:\tc
::set TCPP_BASE=c:\tcpp
::set TCPP3_BASE=c:\tcpp3
::set BC_BASE=c:\bc
::set MSC_BASE=c:\msc
set WATCOM=c:\watcom
:-**********************************************************************
:- where is UPX and which options to use?
:-**********************************************************************
set XUPX=upx --8086 --best
:- or use set XUPX=
:- if you don't want to use it
:-**********************************************************************
:- (optionally) which linker to use:
:- (otherwise will be determined automatically)
:-
:- WARNING TLINK needs to be in your PATH!
:-**********************************************************************
:-----------------------------------------------------------------------
:- define which linker to use OR it will be determined AUTOMATICALLY.
:- Turbo Link
:- set XLINK=tlink /m/c/s/l
::set LINK=tlink /c/m/s/l
:- Microsoft Link
:- set XLINK=d:\qb\link /ma
:- set XLINK=%MS_BASE%\bin\link /ONERROR:NOEXE /ma /nologo
::set LINK=link /ONERROR:NOEXE /nologo
:- WATCOM Link (wlinker is a batch file calling ms2wlink and wlink)
:- set XLINK=..\utils\wlinker /ma /nologo
::set LINK=..\utils\wlinker /nologo
:- set path for Turbo Link - use OLDPATH to restore normal path
:- set OLDPATH=%PATH%
:- set PATH=%PATH%;%TC2_BASE%
:-----------------------------------------------------------------------
:- define which librarian to use OR it will be determined AUTOMATICALLY.
:**********************************************************************
:* optionally define your MAKE type here, if not then
:* it will be automatically determined, pick one of them
:* use MS nmake if you want to compile with MSCL
:**********************************************************************
:- Turbo Lib
::set LIBUTIL=tlib
::set LIBTERM=
:- Microsoft Lib
::set LIBUTIL=lib /nologo
::set LIBTERM=;
:- WATCOM Lib
::set LIBUTIL=wlib -q
::set LIBTERM=
:-----------------------------------------------------------------------
:- define which MAKE to use OR it will be determined AUTOMATICALLY.
:- Borland MAKE
:- set MAKE=%TC2_BASE%\make
::set MAKE=make
::set MAKE=maker -S
:- Watcom MAKE in MS mode
:- set MAKE=%WATCOM%\binw\wmake /ms
::set MAKE=wmake /ms
:- Microsoft MAKE
:- set MAKE=%MS_BASE%\bin\nmake /nologo
::set MAKE=nmake /nologo
::set MAKE=nmaker /nologo
:**********************************************************************
:* select your default target: required CPU and what FAT system to support
:**********************************************************************
:-----------------------------------------------------------------------
:- This section can still be used if you need special consideration
:- for UPX, such as it is not in your PATH or you do not want
:- 8086 compatible settings, otherwise the recommended use is now
:- to add 'upx' option to the build.bat command line
:- set XCPU=86
:- set XCPU=186
set XCPU=386
:- where is UPX and which options to use
:- (comment this out if you don't want to use it)
:- set XFAT=16
set XFAT=32
::set XUPX=upx --8086 --best
:-----------------------------------------------------------------------
:- select default target: CPU type (default is 86) and
:- what FAT system (default is 32) to support
:- NOTE: Turbo C doesn't support 386 CPU.
::set XCPU=86
::set XCPU=186
::set XCPU=386
::set XFAT=16
::set XFAT=32
:- Give extra compiler DEFINE flags here
:- such as -DDEBUG : extra DEBUG output
:- -DDOSEMU : printf output goes to dosemu log
:- set ALLCFLAGS=-DDEBUG
:- -DWIN31SUPPORT : extra Win3.x API support
::set ALLCFLAGS=-DDEBUG
:-----------------------------------------------------------------------
:-
:- $Id: config.b 864 2004-04-11 12:21:25Z bartoldeman $
:-
set LAST=1
if not "%LAST%" == "1" defaults.bat clearset

View File

@ -1,65 +0,0 @@
#
# Linux cross compilation only!
# config file that is included in the main makefile for configuration
#
#****************************************************************
# NOTICE! If you edit you must rename this file to config.mak!*
#****************************************************************
#**********************************************************************
#- define NASM executable
#**********************************************************************
XNASM=nasm
#**********************************************************************
#- where is the BASE dir of your compiler(s) ??
#**********************************************************************
# if WATCOM maybe you need to set your WATCOM environment variables
# and path
ifndef WATCOM
WATCOM=$(HOME)/watcom
PATH:=$(WATCOM)/binl:$(PATH)
endif
#**********************************************************************
# where is UPX and which options to use?
#**********************************************************************
XUPX=upx --8086 --best
# or use
#unexport XUPX
# without the # if you don't want to use it
#**********************************************************************
# (optionally) which linker to use:
# (otherwise will be determined automatically)
# WATCOM Link
#XLINK=wlink
#*********************************************************************
# optionally define your MAKE type here, if not then
# it will be automatically determined, pick one of them
# use MS nmake if you want to compile with MSCL
#*********************************************************************
# Watcom MAKE in MS mode
#MAKE=wmake -ms -h
#*********************************************************************
# select your default target: required CPU and what FAT system to support
#*********************************************************************
# XCPU=86
# XCPU=186
XCPU=386
# XFAT=16
XFAT=32
# Give extra compiler DEFINE flags here
# such as -DDEBUG : extra DEBUG output
# -DDOSEMU : printf output goes to dosemu log
# set ALLCFLAGS=-DDEBUG

@ -1 +0,0 @@
Subproject commit 13587a32d6fda6cf1a1ce9bd9c3da7d3ae5a8dd5

View File

@ -1,88 +0,0 @@
@echo off
:- $Id: default.bat 1482 2009-07-11 16:59:43Z perditionc $
:- with option clearset, clears all config.bat-made environment variables
:- without options, MAKE / LINK / ... are set to defaults based on COMPILER ...
if "%1" == "clearset" goto clearset
:-----------------------------------------------------------------------
if not "%COMPILER%" == "" goto skip_cc
set COMPILER=WATCOM
echo No compiler specified, defaulting to Open Watcom
:skip_cc
:-----------------------------------------------------------------------
if not "%MAKE%" == "" goto skip_make
if "%COMPILER%" == "TC2" set MAKE=%TC2_BASE%\make
if "%COMPILER%" == "TURBOCPP" set MAKE=%TP1_BASE%\bin\make
if "%COMPILER%" == "TC3" set MAKE=%TC3_BASE%\bin\make
if "%COMPILER%" == "BC3" set MAKE=%BC3_BASE%\bin\make
if "%COMPILER%" == "BC5" set MAKE=%BC5_BASE%\bin\make
if "%COMPILER%" == "WATCOM" set MAKE=wmake /ms /h
if "%COMPILER%" == "OWWIN" set MAKE=wmake /ms /h
if "%COMPILER%" == "MSCL8" set MAKE=%MS_BASE%\bin\nmake /nologo
echo Make is %MAKE%.
:skip_make
:-----------------------------------------------------------------------
if not "%XLINK%" == "" goto skip_xlink
if "%COMPILER%" == "TC2" set XLINK=%TC2_BASE%\tlink /m/c
if "%COMPILER%" == "TURBOCPP" set XLINK=%TP1_BASE%\bin\tlink /m/c
if "%COMPILER%" == "TC3" set XLINK=%TC3_BASE%\bin\tlink /m/c
if "%COMPILER%" == "BC3" set XLINK=%BC3_BASE%\bin\tlink /m/c
if "%COMPILER%" == "BC5" set XLINK=%BC5_BASE%\bin\tlink /m/c
if "%COMPILER%" == "WATCOM" set XLINK=..\utils\wlinker /ma/nologo
if "%COMPILER%" == "OWWIN" set XLINK=..\utils\wlinker /ma/nologo
if "%COMPILER%" == "MSCL8" set XLINK=%MS_BASE%\bin\link /ONERROR:NOEXE /ma /nologo
echo Linker is %XLINK%.
:skip_xlink
:-----------------------------------------------------------------------
if not "%XUPX%" == "" set UPXOPT=-U
if "%XUPX%" == "" set UPXOPT=
goto end
:-----------------------------------------------------------------------
:clearset
if not "%OLDPATH%" == "" set PATH=%OLDPATH%
if not "%OLDPATH%" == "" set OLDPATH=
set MAKE=
set COMPILER=
set ALLCFLAGS=
set CFLAGS=
set XCPU=
set XCPU_EX=
set XFAT=
set XLINK=
set TC2_BASE=
set TP1_BASE=
set TC3_BASE=
set BC3_BASE=
set BC5_BASE=
set MS_BASE=
set XNASM=
set NASMFLAGS=
set NASMBOOTFLAGS=
set XUPX=
set UPXOPT=
set LOADSEG=
:end

111
defaults.bat Normal file
View File

@ -0,0 +1,111 @@
@echo off
:- $Id$
set LAST=
if "%1" == "clearset" goto clearset
:-----------------------------------------------------------------------
if "%COMPILER%" == "TC" set BASE=%TC_BASE%
if "%COMPILER%" == "TCPP" set BASE=%TCPP_BASE%
if "%COMPILER%" == "TCPP3" set BASE=%TCPP3_BASE%
if "%COMPILER%" == "BC" set BASE=%BC_BASE%
if "%COMPILER%" == "WATCOM" set BASE=%WATCOM%
if "%COMPILER%" == "MSC" set BASE=%MSC_BASE%
if "%BASE%" == "" goto clearset
:-----------------------------------------------------------------------
if not "%BINPATH%" == "" goto skip_binpath
set BINPATH=%BASE%\bin
if "%COMPILER%" == "TC" set BINPATH=%BASE%
if "%COMPILER%" == "WATCOM" set BINPATH=%BASE%\binw
if "%COMPILER%-%OS%" == "WATCOM-Windows_NT" set BINPATH=%BASE%\binnt
:skip_binpath
echo Path to compiler programs (binaries) is %BINPATH%
:-----------------------------------------------------------------------
:- When compiling executable, compilers may invoke secondary programs
:- such as preprocessor, compiler component, or linker through PATH;
set OLDPATH=%PATH%
set PATH=%BINPATH%;%PATH%
:- MSC searches libraries only through LIB variable.
:- If already set then assume preset to include MSC's lib
if "%COMPILER%%LIB%" == "MSC" set LIB=%MSC_BASE%\lib
:-----------------------------------------------------------------------
if not "%LINK%" == "" goto skip_link
set LINK=%BINPATH%\tlink /c/m/s/l
if "%COMPILER%" == "WATCOM" set LINK=..\utils\wlinker /nologo
if "%COMPILER%" == "MSC" set LINK=%BINPATH%\link /ONERROR:NOEXE /batch
echo Linker is %LINK%
:skip_link
:-----------------------------------------------------------------------
if not "%LIBUTIL%" == "" goto skip_lib
set LIBUTIL=%BINPATH%\tlib
set LIBTERM=
if "%COMPILER%" == "WATCOM" set LIBUTIL=%BINPATH%\wlib -q
if "%COMPILER%" == "MSC" set LIBUTIL=%BINPATH%\lib /nologo
if "%COMPILER%" == "MSC" set LIBTERM=;
echo Librarian is %LIBUTIL%
:skip_lib
:-----------------------------------------------------------------------
if not "%MAKE%" == "" goto skip_make
set MAKE=%BINPATH%\make
if "%COMPILER%" == "WATCOM" set MAKE=%BINPATH%\wmake /ms /h
if "%COMPILER%" == "MSC" set MAKE=%BINPATH%\nmake /nologo
echo Make is %MAKE%
:skip_make
:-----------------------------------------------------------------------
set LAST=1
if "%LAST%" == "1" goto end
:-----------------------------------------------------------------------
:clearset
set NASM=
set NASMFLAGS=
set COMPILER=
set BASE=
set BINPATH=
set TC_BASE=
set TCPP_BASE=
set TCPP3_BASE=
set BC_BASE=
set MSC_BASE=
set LINK=
set LIBUTIL=
set LIBTERM=
set MAKE=
set XUPX=
set XCPU=
set XCPU_EX=
set XFAT=
set ALLCFLAGS=
set LOADSEG=
if not "%OLDPATH%" == "" set PATH=%OLDPATH%
set OLDPATH=
:end

View File

@ -1 +0,0 @@
kernel.fdos.org

View File

@ -1,4 +0,0 @@
theme: jekyll-theme-tactile
title: "FreeDOS kernel"
description: "Implementation of the core DOS API for FreeDOS, kernel.sys"
show_downloads: "true"

View File

@ -1,8 +1,6 @@
The current bug database is available on the web at
http://sourceforge.net/tracker/?group_id=5109&atid=105109
http://www.freedos.org/freedos/bugs/
Please request an account if you want to report or
update bugs. Reading the database needs no login.
Thanks!

View File

@ -1,7 +1,4 @@
Building on DOS or Windows:
===========================
To build the operating system a batch file (BUILD.BAT) is included
To build the operating system, a batch file (BUILD.BAT) is included
to make life easier. This file is in the FDKERNEL directory of the
distribution. In addition, there is a corresponding batch file
(CLEAN.BAT) to clean up the source directories.
@ -15,43 +12,8 @@ kernel come out, you can extract them over your previous source, and
not have to worry about resetting up your configuration because your
CONFIG.BAT file will not get replaced!
For example to build your custom branded kernel for 386+ with FAT32
support using OpenWatcom compilers use a command such as:
BUILD.BAT 386 ow fat32 upx /D CUSTOM_BRANDING /V "MyDOS"
Building on Linux:
==================
To cross compile on Linux you need to install Open Watcom 1.8 from
www.openwatcom.org and NASM which is probably included in your
distribution. You can then copy config.m to config.mak and adjust
for the same reasons mentioned above.
Use the following commands:
- to build:
make all
- to build, overriding a config.mak setting, e.g.:
make all XCPU=386
- to clean:
make clean
- to clobber (delete everything that was generated):
make clobber
You can now also cross compile with T.K. Chia's fork of ia16-elf-gcc,
which is available at https://github.com/tkchia/gcc-ia16, using
make all COMPILER=gcc
or by setting COMPILER=gcc in config.mak. If you are using Ubuntu
Linux 20.04 LTS (Focal Fossa), 18.04 (Bionic Beaver), or 16.04 LTS
(Xenial Xerus), there are precompiled ia16-elf-gcc packages at
https://launchpad.net/~tkchia/+archive/ubuntu/build-ia16/.
Otherwise, for now ia16-elf-gcc needs to be compiled from source.
Only releases 20180708 and later are supported.
Notes:
======
The recommended compiler and assembler at the time of writing (2009/05/19)
are OpenWatcom 1.8 and NASM 2.05.01.
The recommended compiler and assembler at the time of writing (2004/01/31)
are OpenWatcom 1.2 and NASM 0.98.38.
You may need to download the latest version of NASM and a C compiler
Be sure to edit the CONFIG.BAT file to reflect where you put the tools.
@ -130,6 +92,6 @@ component. Study the makefile to better understand this.
---------------------------------------------------------------------
$Id: build.txt 1387 2009-05-19 21:39:29Z bartoldeman $
$Id$

View File

@ -2,7 +2,6 @@ Title: Config.sys Options
Configuring your DOS system for use:
------------------------------------
When booting DOS, you will find it only supports a subset of
the devices available on many computers. To support additional
devices and advanced features, device specific driver and
@ -30,41 +29,24 @@ Set extended Control-C/Control-Break checking to on [default] or off.
When set to on, the kernel will perform the check (and invoke current
handler if pressed) prior to most int 21h calls. When set to off,
the kernel only performs the check on I/O calls using standard streams.
Example: break=off
e.g. break=off
BUFFERS
BUFFERSHIGH
Usage: buffers=nn[,m] where nn is in range 1-99 & m is in range 1-8
Usage: buffers=nn[,n] where nn is in range 1-99 & n is in range 1-8
Memory buffers used by the kernel; primary[,secondary]
The secondary buffer option is available for compatibility with
other DOS kernels, but is ignored by the FreeDOS kernel. In MS DOS,
a secondary buffer can used to read-ahead data. FreeDOS does not do
this. Buffers are stored in HMA by FreeDOS, unless you select nn to
allocate more buffers than fit in HMA. If nn is smaller, unused HMA
space will be used for further buffers until something else allocates
the HMA space for something else. Even then, at least nn buffers will
always be available. You can set nn to a negative value to disable
the use of unused HMA space: BUFFERS=-10 only uses 10 buffers, further
free space in the HMA will just stay unused. Because the buffers can
use the HMA anyway, BUFFERSHIGH does the same as BUFFERS for now, but
shows a note about that to inform the user that it does not use UMB.
Example: buffers=20
other DOS kernels, but is ignored by the FreeDOS kernel.
e.g. buffers=20
COUNTRY
Usage: country=nnn[,[mmm][,[d:][path]file]]
Enables/sets international features of DOS by selecting a country
code and (only with the unstable / devel kernel) optionally also
a codepage and country file. The stable kernel only uses the nnn
value. For full support, use the unstable / devel kernel. You also
need a COUNTRY.SYS file for the latter, while the former ignores the
filename argument and only sets date/time/number formats, using values
compiled into the kernel for a few common countries. It does not set
sort order and upper/lower case translation tables. NLSFUNC can only
be used with the unstable kernel.
Only limited country=nnn support is presently available.
Enables/sets international features of DOS
nnn is country code (001==US)
mmm is code page (437 is default, 850 is updated form, 1252 for Windows)
[drive][path]file specifies file with country specific data
Example: country=001,850,C:\FDOS\BIN\COUNTRY.SYS
e.g. country=001,850,C:\FDOS\BIN\COUNTRY.SYS
DEVICE
Usage: device=[d:][path]file [options]
@ -72,7 +54,7 @@ Load the device driver specified by d:path\file (into conventional
[low 640KB] memory). The options are for the driver itself; refer
to documentation that came with your particular device for supported
options and their usage.
Example: device=himem.sys
e.g. device=himem.sys
DEVICEHIGH
Usage: devicehigh=[d:][path]file [options]
@ -83,9 +65,9 @@ Note: The order you load devices may have a large impact on amount
of free memory available. In general try to load large (in memory
usage) programs into high memory first.
Important: You should have a high memory manager such as FDXMS or
HIMEM installed (prior device=FDXMS.SYS or device=HIMEM.SYS) before
Himem installed (prior device=FDXMS.SYS or device=HIMEM.SYS) before
using this option.
Example: devicehigh=xcdrom.sys /D:FDCD0001
e.g. devicehigh=atapicdd.sys /D:FDCD0001
DOS
Usage: dos=high|low,umb|noumb
@ -95,23 +77,23 @@ 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
Example: dos=high,umb
Example: dos=low,noumb
e.g. dos=high,umb
or dos=low,noumb
DOSDATA
Usage: dosdata=umb
Try to load kernel data into Upper Memory Blocks; effectively
same as using the [name]HIGH variant of kernel parameters,
same as using the <name>HIGH variant of kernel parameters,
such as fileshigh, lastdrivehigh, and stackshigh (does not
effect drivers loaded using device= or install=).
Example: dosdata=umb
e.g. dosdata=umb
ECHO
Usage: ECHO Message to be displayed to user.
ECHO displays (echos) its arguments to the console during
config.sys processing when device drivers are loaded (when
DEVICE= lines are executed).
Example:
e.g.
ECHO loading driver 1
device=Driver1.sys
ECHO driver1 successfully loaded
@ -121,17 +103,15 @@ Usage: EECHO Message with ANSI Escape Sequence
EECHO allows for echo-ing ANSI Escape Sequences
(redefines keyboard input for example). Use a dollar sign ($)
to represent the ANSI Escape character. Note: requires an
ANSI driver like NANSI loaded prior to use.
Example: EECHO feeling $[33;44;1m blue :-)
ansi driver loaded prior to use.
FCBS
Usage: fcbs=nnn
where nnn is in range 1-255
Sets the number of File Control Blocks to reserve room for.
As file control blocks have been replaced by file handles
(see files) and FreeDOS dynamically simulates FCBS from the
handle data as needed, nnn is simply ignored by FreeDOS.
Example: fcbs=4
(see files) most applications will not need this value adjusted.
e.g. fcbs=4
FILES
FILESHIGH
@ -143,24 +123,7 @@ Note: there are other restrictions, so a given program
may not be able to actually open this many
A good number is 20, though some programs suggest/require
30, 40, or even 255
Example: files=20
IDLEHALT
Usage: idlehalt=n
where n can be -1, 0, 1 or higher (default 0)
Activates built-in kernel energy saving functionality if n is
not 0. Value -1 enables all hooks, 1 enables only "safe" hooks,
CPU halted only if kernel is waiting for CON char device input.
Further hooks for n=-1 and n>0 depend on the kernel version:
In addition to the safe hooks, other hooks can get activated,
for example one for int 0x2f, ax=0x1680 "release time slice".
Note: In rare cases, entering or leaving HLT mode (which causes
big changes in CPU power consumption) can cause crashes if
cheap power supplies or mainboards cannot properly filter
the transients. Underclocking the whole system may help.
Linux always does a few HLT at boot time, to force a hang
on buggy systems early (boot with no-hlt to disable HLT).
P90 may have buggy HLT? www.tavi.co.uk/ps2pages/ohland/halt.html
e.g. files=20
INSTALL
INSTALLHIGH
@ -170,105 +133,35 @@ load TSR (terminate and stay resident) programs with a minimal
environment block. The options are for the program itself; refer
to documentation that came with your particular software for
supported options and usage.
Example: install=nansi.com
KEYBUF
Usage: keybuf=n[,m]
where n is in 0xac-0xde or 0x106-0x1de range and m is max 0x200
Relocate keyboard buffer from the default location at
0x40:0x1e-0x3e to 0x40:n-m. The buffer must be more
than 32 bytes and must not touch offsets 0x100-0x105.
Default for m is "next multiple of 0x100 after n".
Note: Some BIOSes store data in the 0xac-0xff area. BASICA will
use the 0x106-0x120 area. Other hardware, drivers or apps
can collide with KEYBUF, too, so use it at your own risk.
A reasonably safe choice should be "keybuf=0x140,0x1c0".
e.g. install=nansi.com
LASTDRIVE
LASTDRIVEHIGH
Usage: lastdrive=x
where x is last drive letter available for use; A-Z
Example: lastdrive=z
MENU
Usage: menu [text]
where text is the text you want to be shown while running
config.sys. Menu displays a menu while running config.sys.
Use menudefault to set a time delayed default option.
Lines that begin with 1? will only be processed if the user
presses 1. Lines beginning with 23? will be loaded if the
user presses either 2 or 3. Options other than 0 can only
be selected if at least one "numbers?" line actually uses
them, as shown in the example below.
Example:
menu Please Select Configuration:
menu
menu Option 0 basic stuff only
menu Option 1 CD-ROM
menu Option 2 TROUSERS
menu Option 3 CD-ROM and TROUSERS
0?echo you selected option 0
13?device=xcdrom.sys /D:FDCD0001
23?install=trousers.com
MENUCOLOR
Usage: menucolor foreground[,background]
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;
6=Brown; 7=Light Gray
The following colors can only be used for the foreground:
8=Dark Gray; 9=Light Blue; 10=Light Green; 11=Light Cyan;
12=Light Red; 13=Light Magenta; 14=Yellow; 15=White.
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
MENUDEFAULT
Usage: menudefault=defaultoption,delay
where delay is the delay time in seconds and defaultoption is the
used standard option if the delay time is over. Menudefault sets
a time delayed default option for a config.sys menu: If no key
has been pressed during [delay] seconds, the default choice is
activated. Pressing a key stops the countdown, the kernel will
wait infinitely for the user to make a selection. Note that some
virtual machines like Bochs can have broken (too fast) timing.
Example: menudefault=0,5
e.g. lastdrive=z
NUMLOCK
Usage: numlock=on|off
Set the keyboard number lock to on or off.
Example: numlock=off
e.g. numlock=off
REM
Usage: rem Your remarks!
This provides the ability to place comments within the configuration
file. The text following the rem until the end of the line is
reached is ignored. This may also be used to temporarily disable
loading a particular device or other option. A synonym for REM is
the semicolon, see the examples.
Example: REM DOS=HIGH,UMB
Example: ;DOS=HIGH,UMB
reached are ignored. This may also be used to temporarily disable
loading a particular device or other option.
SCREEN
Usage: screen=xx
Switches into videomode xxx (INT10/11xx/000)
where xx should be 0x11 for 8x14 font (28 lines VGA, 25 lines EGA)
or 0x12 for 8x8 font (43 lines EGA, 50 lines VGA) or 0x14 for the
default VGA font (25 lines VGA). Some newer graphics cards may not
have 8x14 fonts in the BIOS. In that case, a driver can be loaded
to load a suitable font in RAM, but SCREEN=0x11 should not be used.
If xx is less than 15 (0x0f), it is treated as screen mode number,
for example 1 for CGA 40x25 color text or 7 for monochrome text.
Example: SCREEN=0x12
where xx should be 0x11 for 28 lines or 0x12 for 43/50 (EGA/VGA) lines
SET
Usage: set ENVVAR=value
Sets the environment variable to provided value.
Example: set HOME=C:\home\me
e.g. set HOME=C:\home\me
SHELL
SHELLHIGH
@ -279,18 +172,15 @@ shell option, you can get command.com to process a differently named
file (such as FDAUTO.BAT for coexisting with another DOS using different
configuration options) or run a completely different command interpreter
such as 4DOS or a (unix) sh variant.
Example: shell=C:\4DOS.COM /E:256 /P
Example: SHELL=C:\FDOS\bin\command.com C:\FDOS\bin /E:1024 /P=C:\fdauto.bat
e.g. shell=C:\COMMAND.COM /E:256 /P
STACKS
STACKSHIGH
Usage: stacks=nn,mmm
Usage: stacks=nn,nnn
where nn is in range 0,8-64 and nnn is in range 32-512
Changes number and size of hardware interrupt stacks available
nn is number of different stacks and mmm is size in bytes of each one
In some cases you can use "stacks=0,0" to use only standard stacks
instead of letting DOS allocate extra stacks for hardware interrupts.
Example: stacks=16,256
Changes number of stacks available
nn is number of different stacks and nnn is size in bytes of each one
e.g. stacks=16,256
SWITCHAR
Usage: switchar=c
@ -298,44 +188,28 @@ Sets the default switchar to character c. Where c is a single character
that is used to indicate a command line parameter is an option switch.
The default is a forward slash (/). Note: This simply sets the value
returned by a get switchar query, it will not effect programs that use
hardcoded switch characters. The switch character is the sign used to
mark options, for example the "/" in "DIR /w". Good values: "/" and "-".
Example: switchar=-
hardcoded switch characters.
e.g. 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),
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
/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
after the keyboard is set up - right moment is easy to miss.
/K forces treating of keyboard as 86 key keyboard, not 102/105 key.
Might be useful with BIOSes or drivers which have no or broken
handling for 102/105 key keyboards.
/N disables F5/F8 support [equivalent to kernel config (SYS CONFIG,
run SYS CONFIG /? for explanations) skipconfigseconds=-1]
F5 (skip config) and F8 (single step config.sys) key presses
are ignored (note: with /F a well timed F5/F8 still works, whereas
/N completely disables).
/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
[386Enhanced] section. --- may be ignored for compatibility
/F skips the delay checking for F5/F8 keystroke before processing config.sys
[equivalent to setting kernel config option skipconfigseconds = 0]
/N disables F5/F8 support [equivalent to kernel config skipconfigseconds = -1]
(note: with /F a well timed F5/F8 still works, whereas /N completely disables)
/K forces treating of keyboard as 86 key keyboard
/E enables moving of EBDA (Extended BIOS Data Area), optionally a size in KB
may be specified [xxx, in range of 48-1024]
/W disables Windows 3.0 from 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 [386Enhanced]
section.) --- Unsupported, though may be ignored for compatibility.
VERSION
Usage: version=x.y
FreeDOS specific command to specify what DOS version to report. For
a kernel with FAT32 support, 7.10 is a good choice. Otherwise, 5.0
and 6.22 are common values. FreeCOM command.com "ver /r" displays
both the reported and the FreeDOS internal version numbers.
Example: version=6.22
FreeDOS specific command to specify what DOS version to report.
e.g. version=6.2
@ -348,14 +222,14 @@ normal
'?' - ALWAYS ask if a single line shall be executed
FILES=20
DEVICE?=MyNetWorkDriver.sys
?DEVICE=MyNetWorkDriver.sys
'!' - NEVER ask if a single line shall be executed, even if single stepping
!FILES=20
!DOS=HIGH,UMB
!BUFFERS=30
!DEVICE=MyNetWorkDriver.sys
DEVICE=MyNetWorkDriver.sys
configuration management - you may compose several configurations,
@ -364,20 +238,19 @@ using following special commands:
MENU
MENU select your configuration
MENU
MENU use (0) for basic configuration
MENU use (1) for CDROM operation
MENU use (2) for NETWORK configuration
MENU use (3) to load neither CDROM nor NETWORK drivers
MENU
MENUDEFAULT=3,60 (configuration 3, wait 60 seconds)
MENUDEFAULT=0,1 ( configuration 0, wait 1 second)
rem CDROM
1? rem CDROM
1? device=CDROM.SYS
rem NETWORK
2? rem NETWORK
2? device=MyNetworkDriver.SYS
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
allows for selecting from multiple options during bootup while
@ -395,7 +268,7 @@ environment variable CONFIG like
if %CONFIG% == 0 echo configuration 0 selected
however, if you have no MENUs in config.sys, then %config% has no value,
however, if you have no menu's in config.sys, then %config% has no value,
thus resulting in "IF == 0 echo configuration 0 selected."
(which causes syntax errors as there's nothing on the left side of == )
@ -415,7 +288,7 @@ thus my config.sys now looks like
!buffers=30
!screen=0x12
!lastdrive=z
!shell=\command.com /p /e:512 /MSG
!shellhigh=a:\command.com /p /e:512 /MSG
MENU
MENU 0 - SoftIce+HIMEM+Network (default)
@ -432,7 +305,7 @@ MENUDEFAULT=0,0
0?device=c:\ntclient\ifshlp.sys
DEVICE=xcdrom.sys /D:MSCD000
DEVICE=ATAPICDD.SYS /D:MSCD000
Full Screen Menus (thanks to Rune Espeseth)
@ -451,39 +324,37 @@ buffers=20
REM *** The Menu ***
MENU
MENU *-------------------------------------------------------*
MENU ! My Menu - FreeDOS rules! !
MENU *-------------------------------------------------------*
MENU ! !
MENU ! 1. Test with border !
MENU ! !
MENU ! 2. Another test... !
MENU ! !
MENU ! 3. Third choice !
MENU ! !
MENU ! 4. Fourth choice. !
MENU ! !
MENU *-------------------------------------------------------*
MENU ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
MENU º My Menu - FreeDOS rules! º
MENU ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
MENU º º
MENU º 1. Test with border º
MENU º º
MENU º 2. Another test... º
MENU º º
MENU º 3. Third choice º
MENU º º
MENU º 4. Fourth choice. º
MENU º º
MENU ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
MENU
MENUDEFAULT=1,10 ( configuration 1, wait 10 seconds)
REM 1st choice
1?ECHO You selected menu #1
1? REM 1st choice
1? ECHO You selected menu #1
REM 2nd choice
2?ECHO You selected menu #2
2? REM 2nd choice
2? ECHO You selected menu #2
REM 3rd choice
3?ECHO You selected menu #3
3? REM 3rd choice
3? ECHO You selected menu #3
REM 4th choice
4?ECHO You selected menu #4
4? REM 4th choice
4? ECHO You selected menu #4
2002-11-28 - Tom Ehlert
2003-07-15 - Bernd Blaauw
2003-09-18 - Bart Oldeman
2004-07-24 - Jeremy Davis
...
2008-22-01 - Fritz Mueller / Eric Auer

View File

@ -1,6 +1,6 @@
These are the known contributors of the FreeDOS kernel. If you have
contributed in any way to the kernel, but are not on this list, please
email the current kernel maintainer so we can add you to the list!
contributed in any way to the kernel, but are not on this list,
please email the current kernel maintainer so we can add you to the list!
Thanks to all the following for contributing to the FreeDOS kernel:
@ -11,16 +11,14 @@ Bernd Blaauw (bblaauw@home.nl)
Brian Reifsnyder (reifsnyderb@mindspring.com)
Charles Dye (raster@highfiber.com)
Eduardo Casino (casino_e@terra.es)
Eric Auer (e.auer@jpberlin.de)
Eric Auer (eric@coli.uni-sb.de)
Eric Biederman (ebiederm+eric@ccr.net)
Eric Luttmann (ecl@users.sourceforge.net)
Fritz Mueller (fritz.mueller@mail.com)
Geraldo Netto (geraldonetto@gmail.com)
Helmut Fritsch (helmut.fritsch@gcd-hs.de)
James Tabor (jimtabor@infohwy.com)
Jason Hood (jadoxa@yahoo.com.au)
Jens Horstmeier (Jens.Horstmeier@abg1.siemens.de)
Jeremy Davis (jeremyd@fdos.org)
Jeremy Davis (jeremyd@computer.org)
Jim Hall (jhall@freedos.org)
John Price (linux-guru@gcfl.net)
Kolya Ksenev (7207@mx.csd.tsu.ru)
@ -31,7 +29,6 @@ Michal Bakowski (mb@orad.pl)
Ron Cemer (roncemer@gte.net)
"ror4" (ror4@angelfire.com)
Rune Espeseth (re@icd.no)
sava (lpproj@gmail.com)
Steffen Kaiser (Steffen.Kaiser@fh-rhein-sieg.de)
Steve Miller (SMiller@dsfx.com)
Tom Ehlert (te@drivesnapshot.de)
@ -41,5 +38,5 @@ At this place we should also thank Ralf Brown for his interrupt list.
It is a truely invaluable resource for us.
And last, but not least, a big thanks to Pasquale J. Villani
(patv@iop.com), who is the original author of DOS-C, on which
the FreeDOS kernel is based.
(patv@iop.com), who was the original author of DOS-C, in which the
FreeDOS kernel was based.

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -304,8 +304,8 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation
Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.

View File

@ -1,15 +1,13 @@
Begin3
Title: The FreeDOS Kernel
Version: git
Entered-date: N/A
Description: The FreeDOS Kernel
Keywords: kernel, FreeDOS, DOS, MSDOS
Author: (developers: can be reached on the freedos-kernel mailing list)
Maintained-by: freedos-kernel@lists.sourceforge.net
Primary-site: http://github.com/fdos/kernel
Alternate-site: http://www.fdos.org/kernel/
Alternate-site: http://freedos.sourceforge.net/kernel/
Version: 2.0.35a-UNSTABLE
Entered-date: 30 May 2004
Description: The FreeDOS Kernel.
Keywords: kernel freedos dos msdos
Author: (developers)
Maintained-by: jeremyd@computer.org
Primary-site: http://freedos.sourceforge.net
Original-site: http://www.gcfl.net/pub/FreeDOS/kernel
Platforms: DOS, FreeDOS, DOSEMU (OpenWatcom/Borland/GCC-ia16, NASM, UPX)
Copying-policy: GPL2
Platforms: dos dosemu
Copying-policy: GPL
End

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
INTRODUCTION
------------
The release archives contains the current FreeDOS Kernel, also
known as DOS-C, originally written by Pasquale J. Villani.
The FreeDOS Kernel is available from https://github.com/FDOS/kernel/
(formally http://freedos.sourceforge.net/ ).
It's also available from http://www.dosemu.org/ (somewhere on there).
The FreeDOS Kernel is also available through the FreeDOS Project at
http://www.freedos.org/
See the DOCS directory for more documentation and information about
the FreeDOS Kernel.
Contents of zip files:
* [ke20xx_f16.zip](https://github.com/FDOS/kernel/releases/download/ke2043/ke2043_86f16.zip) : binaries for 8086, FAT12 and FAT16 only
* [ke20xx_f32.zip](https://github.com/FDOS/kernel/releases/download/ke2043/ke2043_86f32.zip) : binaries for 8086, FAT12, FAT16, and FAT32
* [ke20xxs.zip](https://github.com/FDOS/kernel/releases/download/ke2043/ke2043s.zip) : sources for the kernel
BUG REPORTS
-----------
If you have found a bug, think you have found a bug, or would just
like to make a suggestion, go to the bug tracking web page at
https://github.com/FDOS/kernel/issues
(Previously at http://sourceforge.net/tracker/?group_id=5109&atid=105109, and
even earlier archive of old (Bugzilla) items is at www.freedos.org/bugzilla/ )
Copyright
---------
DOS-C is (c) Copyright 1995, 1996 by Pasquale J. Villani
All Rights Reserved.

View File

@ -2,7 +2,8 @@
DOS-C Systems Calls
The following table represents the industry standard kernel DOS calls
currently supported by DOS-C. This list is for FreeDOS build 2036 (5/2006).
currently supported by DOS-C. This list is for Release 1.1, build
2003 as issued on Feb 28, 1999.
int 20: Terminated Current Process
Supported
@ -15,9 +16,9 @@ int 21 Description State Ver Status
00h Terminate Program superseded 1.00 supported
01h Read Keyboard with Echo superseded 1.00 supported
02h Display Character superseded 1.00 supported
03h Auxilliary Input superseded 1.00 supported
04h Auxilliary Output superseded 1.00 supported
05h Print Character superseded 1.00 supported
03h Auxilliary Input superseded 1.00 Note 1
04h Auxilliary Output superseded 1.00 Note 1
05h Print Character superseded 1.00 Note 1
06h Direct Console I/O active 1.00 supported
07h Direct Console Input active 1.00 supported
08h Read Keyboard Without Echo active 1.00 supported
@ -95,7 +96,7 @@ int 21 Description State Ver Status
4b00h Load and Execute Program active 2.00 supported
4b01h Load Program active 5.00 supported
4b03h Load Overlay active 2.00 supported
4b05h Set Execution State active 5.00 PLANNED
4b05h Set Execution State active 5.00 planned
4ch End Program active 2.00 supported
4dh Get Child-Program Return Value active 2.00 supported
4eh Find First File active 2.00 supported
@ -118,22 +119,22 @@ int 21 Description State Ver Status
5bh Create New File active 3.00 supported
5ch Lock/Unlock File active 3.10 supported
5d00h Server Function Call active 3.10 supported
5d01h Commit All Files active 3.10 NOTE 3
5d02h Close File by Name active 3.10 NOTE 3
5d03h Close All Files for Computer active 3.10 NOTE 3
5d04h Close All Files for Process active 3.10 NOTE 3
5d05h Get Open File List active 3.10 NOTE 3
5d01h Commit All Files active 3.10 planned
5d02h Close File by Name active 3.10 planned
5d03h Close All Files for Computer active 3.10 planned
5d04h Close All Files for Process active 3.10 planned
5d05h Get Open File List active 3.10 planned
5d06h Get Multiple SDA active 4.00 supported
5d07h Get Redirected Printer Mode active 3.10 supported
5d08h Set Redirected Printer Mode active 4.00 supported
5d09h Flush Redirected Printer Output active 4.00 supported
5d0ah Set Extended Error active 4.00 supported
5d0ah Set Extended Error active 4.00 planned
5eh Generic Network Functions #1 active 3.10 supported
5fh Generic Network Functions #2 active 3.10 supported
60h Truename function undocumented 3.00 supported
61h UNUSED obsolete supported
62h Get current PSP active 3.00 supported
63h Multibyte char ops undocumented 3.20 NOTE 1
63h Multibyte char ops undocumented 3.20 Note 4
64h ? undocumented returns error
65h NLS Functions active 3.30 supported
66h Code Page Functions active 3.30 supported
@ -143,7 +144,7 @@ int 21 Description State Ver Status
6ah COMMIT FILE (same as 68h) active 4.00 supported
6bh NULL FUNCTION active 5.00 supported
6ch Extended Open/Create active 4.00 supported
71h LONG FILENAME FUNCTIONS active 7.00 NOTE 2
71h LONG FILENAME FUNCTIONS active 7.00 not supported
int 22: Program Termination Address.
Supported.
@ -170,23 +171,19 @@ int 29: Fast Console Output.
Supported.
int 2F: DOS Multiplex.
Supported (not ALL functions, but MOST functions supported)
Supported.
Notes:
Note 1 - Although this system call is supported, there are no device
drivers to support these devices in this release.
Note 1 - function 63 Returns error code and lead byte table pointer
DS:SI (function 0). Functions 1 and 2 return error code -1
(Korean Hangul keyboard input method not supported), but our
UNSTABLE kernels can contain more NLSFUNC / COUNTRY support.
Note 2 - Returns error code because internal data structures differ.
Note 2 - for LFN support, you can load a separate driver like DOSLFN.
It will hook int 21 and provide long file name functionality.
Note 3 - Only sub-functions 0 and 1 are currently supported.
Note 3 - planned, but the implementation will be in SHARE. The DOS
kernel only calls hooks (via far call) in a table which is
right before the SFT (list of lists [4] points to SFT). As
long as our SHARE does not support the hooks, they are not
supported either, the unused hook table would waste memory.
Note 4 - Returns error code.
Note 5 - Vector supported but performs no action.
License
-------
@ -195,4 +192,4 @@ See COPYING in DOS-C root directory for license.
---------------------------------------------------------------------
$Id: intfns.txt 1344 2007-07-28 18:29:50Z mceric $
$Id$

View File

@ -1,94 +0,0 @@
FreeDOS kernel with memdisk support compiled in:
When enabled one can supplement (or replace) CONFIG.SYS from the memdisk
command line. The kernel upon booting will verify running on a 386+ and
then check for memdisk using int 13h call with magic values. If found
then the memdisk command line is processed and simulated CONFIG.SYS lines
are evaluated left to right as though they logically followed the last
line in CONFIG.SYS (or FDCONFIG.SYS).
Example syslinux.cfg section:
LABEL FreeDOS
KERNEL memdisk
MENU LABEL FreeDOS example
INITRD FDSTD.img
APPEND {ECHO Booting FreeDOS}{ECHO This is the second line.}
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
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 {}).
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 {.
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.
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
any CONFIG.SYS lines.
ECHO HI
ECHO Y=1 Z=1 X=386
The following APPEND lines are all treated identically by the kernel.
APPEND floppy FD={ECHO Welcome}{ECHO 2nd line}{ECHO third}
APPEND floppy FD={ECHO Welcome{ECHO 2nd line{ECHO third
APPEND {ECHO Welcome} {ECHO 2nd line} {ECHO third} floppy
APPEND {ECHO Welcome{Echo 2nd line} {ECHO third floppy
resulting in the following equivalent three CONFIG.SYS lines
ECHO Welcome
ECHO 2nd line
ECHO third
The following complete example syslinux.cfg and FreeDOS configuration files
could be used to boot various kernel options avoiding the use of the FreeDOS
kernel menu in addition to the Sylinux menu.
# CONFIG.SYS
REM always executed, in common with all choices
FILES=20
LASTDRIVE=Z
SHELLHIGH=\COMMAND.COM /E:256 /P
#AUTOEXEC.BAT
@ECHO OFF
CLS
ECHO Welcome to FreeDOS (http://www.freedos.org)!
ECHO User selected menu %CONFIG%
# SYSLINUX.CFG
UI vesamenu.c32
DEFAULT clean
LABEL clean
MENU LABEL FreeDOS with no drivers
KERNEL memdisk
INITRD /fdos0360.img
APPEND floppy FD={SET config=0}
LABEL jemm
MENU LABEL FreeDOS with memory manager
KERNEL memdisk
INITRD /fdos0360.img
APPEND floppy FD={SET config=1}{DEVICE?=JEMMEX.EXE
Syslinux boot-prompt (when vesamenu not used):
jemm
or
jemm NOEMS

View File

@ -1,4 +1,4 @@
Current version: $Id: nls.txt 59 2000-08-06 04:42:32Z jimtabor $
Current version: $Id$
This document describes all aspects of the implementation
of NLS in the FreeDOS kernel -- 2000/06/16 ska

View File

@ -1,64 +1,14 @@
You can check out the latest code (from a UNIX type machine) using
CVS as follows:
Thanks to Bart Oldeman for helping us with moving the FreeDOS source code
from CVS to Subversion! The old CVS repository is still available for
browsing, but will no longer be used for managing FreeDOS Projects - and
will probably be deleted later. Please use Subversion for the FreeDOS
kernel, FreeCOM (FreeDOS command.com), Install, and Mem.
Bart has also written a Subversion at SourceForge Mini How-to:
http://fd-doc.sourceforge.net/wiki/index.php?n=FdDocEn.SVN
This information was mostly lifted from SourceForge.net:
https://sourceforge.net/svn/?group_id
FreeDOS Subversion:
Subversion (SVN) is a tool used by many software developers to manage
changes within their source code tree. SVN provides the means to store not
only the current version of a piece of source code, but a record of all
changes (and who made those changes) that have occurred to that source code.
Use of SVN is particularly common on projects with multiple developers,
since SVN ensures changes made by one developer are not accidentally removed
when another developer posts their changes to the source tree.
In order to access a Subversion repository, you must install a special piece
of software called a Subversion client. Subversion clients are available for
most any operating system.
To get a working copy, do svn co URL freedos where URL is the complete path
to the trunk of the project you want. For example:
FreeDOS kernel
https://freedos.svn.sourceforge.net/svnroot/freedos/kernel/trunk
FreeDOS FreeCOM
https://freedos.svn.sourceforge.net/svnroot/freedos/freecom/trunk
FreeDOS MEM
https://freedos.svn.sourceforge.net/svnroot/freedos/mem/trunk
FreeDOS Install
https://freedos.svn.sourceforge.net/svnroot/freedos/install/trunk
Be careful NOT to use the top level
* https://freedos.svn.sourceforge.net/svnroot/freedos URL
instead of one of the trunk URLs. This will pull all modules, tags and/or
branches of the project - it will be huge. Instead, you will want to use
/trunk to the URL to check out only the trunk code (main development line).
Though Subversion repositories are most commonly accessed using a special
piece of software called a Subversion client, SourceForge also provides a
web-based interface to view Subversion repositories. Browsing the Subversion
tree gives you a great view into the current status of this project's code.
You may also view the complete history of any file in the repository.
* Browse Subversion repository
http://freedos.svn.sourceforge.net/viewvc/freedos/
FreeDOS is a trademark of Jim Hall.
Note: Readonly access via the old CVS interface worked as follows:
To check out the code, first log in:
cvs -z3 -d:pserver:anonymous@cvs.freedos.sourceforge.net:/cvsroot/freedos login
Password: Press the Enter key.
Then, to get the kernel code:
cvs -z3 -d:pserver:anonymous@cvs.freedos.sourceforge.net:/cvsroot/freedos checkout kernel
cvs -z3 -d:pserver:anonymous@cvs.freedos.sourceforge.net:/cvsroot/freedos
checkout kernel
You can also view the CVS code from the web at
http://freedos.sourceforge.net/
Go to the CVS page.

View File

@ -1,43 +1,29 @@
INTRODUCTION
------------
This archive contains the current FreeDOS Kernel, also
known as DOS-C, originally written by Pasquale J. Villani.
The FreeDOS Kernel is available from http://freedos.sourceforge.net/
It's also available from http://www.dosemu.org/ (somewhere on there).
The FreeDOS Kernel is available from http://freedos.sourceforge.net.
It's also available from http://www.dosemu.org (somewhere on there).
The FreeDOS Kernel is also available through the FreeDOS Project at
http://www.freedos.org/
http://www.freedos.org.
See the DOCS directory for more documentation and information about
the FreeDOS Kernel.
Contents of release zip files:
Contents of zip files:
ke20xx_16.zip : binaries for 8086, FAT16
ke20xx_32.zip : binaries for 8086, FAT16, FAT32
ke20xxsrc.zip : sources for the kernel
BUG REPORTS
-----------
If you have found a bug, think you have found a bug, or would just
like to make a suggestion or feature request, then add an issue to
the kernel's GitHub site:
https://github.com/FDOS/kernel/issues
Note: bugs (or feature requests) reported at the old bug tracking
web page http://sourceforge.net/tracker/?group_id=5109&atid=105109
and http://sourceforge.net/tracker/?atid=355109&group_id=5109&func=browse
will still be reviewed, but not actively.
An archive of old (Bugzilla) items is at www.freedos.org/bugzilla/
like to make a suggestion, go to the bug tracking web page at
http://www.freedos.org/bugs/
Copyright
---------
DOS-C is (c) Copyright 1995, 1996 by Pasquale J. Villani
All Rights Reserved.
Portions of FreeDOS kernel copyright others, 199?-2021

120
docs/sys.htm Normal file
View File

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

View File

@ -1,4 +1,4 @@
FreeDOS System Installer v3.6f - Nov 20, 2024
FreeDOS SYS 3.6
documentation by:
Jeremy Davis
Bart Oldeman
@ -13,9 +13,10 @@ The best documentation is the source itself, but
we try to keep this document updated.
Usage: SYS [source] drive: [bootsect] [{option}]
Usage:
SYS [source] dest: [bootsect] [{option}]
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given
dest = drive (A:,B:,C:,... or A,B,C,...) to install system to
dest = A,B,etc.
bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector
{option} is one or more of the following:
@ -23,34 +24,22 @@ Usage: SYS [source] drive: [bootsect] [{option}]
/BOOTONLY: do *not* copy kernel / shell, only update boot sector or image
/UPDATE : copy kernel and update boot sector (do *not* copy shell)
/OEM : indicates boot sector, filenames, and load segment to use
/OEM:FD FreeDOS settings
/OEM:EDR Enhanced DR-DOS (DRBIO.SYS and DRDOS.SYS)
/OEM:LEDRPACK Enhanced DR-DOS (EDRPACK.SYS, lDOS drload)
/OEM:LEDR Enhanced DR-DOS (EDRDOS.COM, lDOS iniload)
/OEM:LMSPACK OSS MS-DOS (LMSPACK.SYS, lDOS drload)
/OEM:LMS OSS MS-DOS (LMSDOS.COM, lDOS iniload)
/OEM:OPENDOS Caldera OpenDOS 7.01 (and Novell DOS 7),
DR-DOS 7.02 - 7.03, 7.01.01 - 7.01.06
/OEM:PC PC-DOS, DR DOS 5 - Novell DOS 7
/OEM:MS MS-DOS
/OEM:W9x MS Win9x DOS
default is /OEM[:AUTO], select DOS based on existing files
/OEM:FD use FreeDOS compatible settings
/OEM:DR use DR DOS 7+ compatible settings (same as /OEM)
/OEM:PC use PC-DOS compatible settings
/OEM:MS use MS-DOS compatible settings
/OEM:W9x use MS Win9x DOS compatible settings
default is /OEM:AUTO, select DOS based on existing files
/K name : name of kernel to use in boot sector instead of KERNEL.SYS
/L segm : hex load segment to use in boot sector instead of 0x60
/B btdrv : hex BIOS # of boot drive set in bs, 0=A:, 80=1st hd,...
/FORCE : override automatic selection of BIOS related settings
/FORCE:BSDRV (/FORCEDRV) use boot drive # set in bootsector
/FORCE:BIOSDRV use boot drive # provided by BIOS
/FORCE:AUTO select LBA or CHS depending on BIOS availability
/FORCE:LBA always use LBA
/FORCE:CHS always use CHS
/FORCEDRV: force use of drive # set in bs instead of BIOS boot value
/NOBAKBS : skips copying boot sector to backup bs, FAT32 only else ignored
/SKFN filename : copy from filename to KERNEL.SYS; settings same as /OEM:FD
/SCFN filename : copy from filename to COMMAND.COM
/SKFN filename : set KERNEL.SYS input file and /OEM:FD
/SCFN filename : sets COMMAND.COM input file
/BACKUPBS [path]filename : save current bs before overwriting
/DUMPBS [path]filename : save current bs and exit
/RESTORBS [path]filename : overwrite bs and exit
/VERBOSE : display additional (debug) output
SYS CONFIG /help
@ -97,23 +86,6 @@ for dual booting or diagnostic purposes.
If you also specify BOTH, sys will write to both
the image file and the boot sector.
The FORCE options override the default actions
to use. On FAT32 drives /FORCE:LBA and /FORCE:CHS
will select which boot sector code is used (default
same as /FORCE:AUTO will choose based on query of
BIOS support for LBA extensions and use LBA if it
is supported else only CHS will be used). On FAT12
and FAT16 drives specifying /FORCE:LBA will ensure
even 1st floppy drive attempts to use LBA support
(note that CHS may still be used if LBA check fails)
and /FORCE:CHS will always bypass use of LBA extensions.
SYS by default installs the FreeDOS kernel KERNEL.SYS.
If KERNEL.SYS is not found, it may install a different
kernel, like an Enhanced DR-DOS kernel, provided it
finds one. You may explicitly tell SYS which kernel
flavour to install via the /OEM argument.
Kernel Configuration Options:

View File

@ -25,15 +25,14 @@
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
;
; $Id: floppy.asm 980 2004-06-19 19:41:47Z perditionc $
; $Id$
;
%include "../kernel/segs.inc"
%include "../hdr/stacks.inc"
segment HMA_TEXT
;
; BOOL ASMPASCAL fl_reset(WORD drive);
; int ASMPASCAL fl_reset(UBYTE drive);
;
; Reset both the diskette and hard disk system.
; returns TRUE if successful.
@ -42,188 +41,175 @@ segment HMA_TEXT
global FL_RESET
FL_RESET:
pop ax ; return address
pop dx ; drive (DL only)
pop dx ; drive
push ax ; restore address
mov ah,0 ; BIOS reset diskette & fixed disk
mov ah,0 ; reset disk
int 13h
sbb ax,ax ; carry set indicates error, AX=-CF={-1,0}
sbb ax,ax ; CF=1: error
inc ax ; ...return TRUE (1) on success,
ret ; else FALSE (0) on failure
ret ; FALSE (0) on error
;
; COUNT ASMPASCAL fl_diskchanged(WORD drive);
; int ASMPASCAL fl_diskchanged(UBYTE drive);
;
; Read disk change line status.
; returns 1 if disk has changed, 0 if not, 0xFFFF if error.
; returns 1 if disk has changed, 0 if not, 0xFF if error.
;
global FL_DISKCHANGED
FL_DISKCHANGED:
pop ax ; return address
pop dx ; drive (DL only, 00h-7Fh)
pop dx ; drive
push ax ; restore stack
push si ; preserve value
mov ah,16h ; read change status type
push si
mov ah,16h ; read change status type
xor si,si ; RBIL: avoid crash on AT&T 6300
int 13h
pop si ; restore
pop si
sbb al,al ; AL=-CF={-1,0} where 0==no change
jnc fl_dc ; carry set on error or disk change
cmp ah,6 ; if AH==6 then disk change, else error
jne fl_dc ; if error, return -1
mov al, 1 ; set change occurred
fl_dc: cbw ; extend AL into AX, AX={1,0,-1}
ret ; note: AH=0 on no change, AL set above
sbb al,al ; CF=0 (disk has not changed)
jnc ret_AH_0 ; ...return 0
cmp ah,6 ; ah!=6 (error)
jne ret_AH_0 ; ...return 0xFF
mov al,1 ; ah=6 (disk has changed)
jmp short ret_AH_0 ; ...return 1
;
; int ASMPASCAL fl_read (UBYTE drive, WORD head, WORD track, WORD sector, WORD count, void FAR *buffer);
; int ASMPASCAL fl_write (UBYTE drive, WORD head, WORD track, WORD sector, WORD count, void FAR *buffer);
; int ASMPASCAL fl_verify(UBYTE drive, WORD head, WORD track, WORD sector, WORD count, void FAR *buffer);
; int ASMPASCAL fl_format(UBYTE drive, WORD head, WORD track, WORD sector, WORD count, void FAR *buffer);
;
; Format tracks (sector should be 0).
; COUNT ASMPASCAL fl_format(WORD drive, WORD head, WORD track, WORD sector, WORD count, UBYTE FAR *buffer);
; Reads one or more sectors.
; COUNT ASMPASCAL fl_read (WORD drive, WORD head, WORD track, WORD sector, WORD count, UBYTE FAR *buffer);
; Writes one or more sectors.
; COUNT ASMPASCAL fl_write (WORD drive, WORD head, WORD track, WORD sector, WORD count, UBYTE FAR *buffer);
; COUNT ASMPASCAL fl_verify(WORD drive, WORD head, WORD track, WORD sector, WORD count, UBYTE FAR *buffer);
;
; Returns 0 if successful, error code otherwise.
;
global FL_FORMAT
FL_FORMAT:
mov ah,5 ; format track
jmp short fl_common
mov ah,5 ; format track
jmp short fl_common
global FL_VERIFY
FL_VERIFY:
mov ah,4 ; verify sector(s)
jmp short fl_common
global FL_READ
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
mov ah,2 ; read sector(s)
jmp short fl_common
global FL_WRITE
FL_WRITE:
mov ah,3 ; write sector(s)
mov ah,3 ; write sector(s)
fl_common:
push bp ; setup stack frame
mov bp,sp
fl_common:
push bp
mov bp,sp
arg drive, head, track, sector, count, {buffer,4}
mov cx,[.track] ; cylinder number
mov cx,[bp+12] ; cylinder number
mov al,1 ; error code
cmp ch,3
ja fl_error ; can't write above 3FFh=1023
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.
xchg ch,cl ; ch=low 8 bits of cylinder number
mov dh,[bp+14] ; head number
ror cl,1 ; bits 8-9 of cylinder number...
ror cl,1 ; ...to bits 6-7 in CL
or cl,[bp+10] ; sector number (bits 0-5)
xchg ch,cl ; ch=low 8 bits of cyl number
ror cl,1 ; bits 8-9 of cylinder number...
ror cl,1 ; ...to bits 6-7 in CL
or cl,[.sector] ; or in the sector number (bits 0-5)
mov al,[.count] ; count of sectors to read/write/...
les bx,[.buffer] ; Load 32 bit buffer ptr into ES:BX
mov dl,[.drive] ; drive (if or'ed 80h its a hard drive)
mov dh,[.head] ; get the head number
int 13h ; process sectors
mov al,[bp+8] ; number of sectors
les bx,[bp+4] ; 32-bit buffer ptr
mov dl,[bp+16] ; drive (if or'ed 80h its hard drive)
int 13h ; process sectors
sbb al,al ; carry: al=ff, else al=0
and al,ah ; carry: error code, else 0
fl_error:
mov ah,0 ; extend AL into AX without sign extension
pop bp
ret 14
mov ah,0
pop bp
ret 14
;
; COUNT ASMPASCAL fl_lba_ReadWrite(BYTE drive, WORD mode, void FAR * dap_p);
; int ASMPASCAL fl_lba_ReadWrite(UBYTE drive, WORD mode, void FAR * dap);
;
; Returns 0 if successful, error code otherwise.
;
global FL_LBA_READWRITE
global FL_LBA_READWRITE
FL_LBA_READWRITE:
push bp ; setup stack frame
mov bp,sp
push ds
push si ; wasn't in kernel < KE2024Bo6!!
arg drive, mode, {dap_p,4}
mov dl,[.drive] ; drive (if or'ed with 80h a hard drive)
mov ax,[.mode] ; get the command
lds si,[.dap_p] ; 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
ret 8
push bp
mov bp,sp
push si
push ds
mov dl,[bp+10] ; drive (if or'ed 80h its hard drive)
mov ax,[bp+8] ; command
lds si,[bp+4] ; far dap pointer
int 13h ; process sectors
pop ds
pop si
pop bp
mov al,ah ; place error code into al
mov ah,0
ret 8
;
; void ASMPASCAL fl_readkey (void);
;
global FL_READKEY
FL_READKEY: xor ah, ah
FL_READKEY:
mov ah,0
int 16h
ret
;
; COUNT ASMPASCAL fl_setdisktype (WORD drive, WORD type);
; int ASMPASCAL fl_setdisktype (UBYTE drive, WORD type);
;
global FL_SETDISKTYPE
FL_SETDISKTYPE:
pop bx ; return address
popargs dx,ax ; drive number(dl),disk format type(al)
pop ax ; disk type
pop dx ; drive
push bx ; restore stack
mov ah,17h ; floppy set disk type for format
mov ah,17h ; set disk type for format
int 13h
ret_AH:
mov al,ah ; place any error code into al
mov ah,0 ; zero out ah
mov al,ah ; place error code into al
ret_AH_0:
mov ah,0
ret
;
; COUNT ASMPASCAL fl_setmediatype (WORD drive, WORD tracks, WORD sectors);
; int ASMPASCAL fl_setmediatype (UBYTE drive, WORD tracks, WORD sectors);
;
global FL_SETMEDIATYPE
FL_SETMEDIATYPE:
pop ax ; return address
popargs dx,cx,bx ; drive number,#tracks,sectors/track
pop bx ; sectors/track
pop cx ; number of tracks
pop dx ; drive
push ax ; restore stack
push di
dec cx ; number of cylinders - 1 (last cyl number)
dec cx ; last cylinder 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
ror cl,1 ; bits 8-9 of cylinder number...
ror cl,1 ; ...to bits 6-7 in CL
or cl,bl ; sectors/track (bits 0-5)
mov ah,18h ; set media type for format
int 13h
jc skipint1e
push es
xor dx,dx
mov es,dx
xor dx,dx
mov es,dx
cli
pop word [es:0x1e*4+2] ; set int 0x1e table to es:di
mov [es:0x1e*4 ], di
mov [es:0x1e*4],di
pop word [es:0x1e*4+2] ; set int 0x1e table to es:di
sti
skipint1e:
pop di
skipint1e:
pop di
jmp short ret_AH

View File

@ -1,49 +1,28 @@
#
# makefile for device.lib
#
# $Id: makefile 1387 2009-05-19 21:39:29Z bartoldeman $
# $Id$
#
!include "../mkfiles/generic.mak"
OBJS=floppy.obj rdpcclk.obj wrpcclk.obj wratclk.obj
LIBOBJS=+floppy +rdpcclk +wrpcclk +wratclk
# MICROSOFT C
# -----------
#MODEL = s
#CFLAGS = /c /Gs /A$(MODEL)
#AFLAGS = /Mx /Dmem$(MODEL)=1
#TERM = ;
# Build the LIBRARY ####################################################
# BORLAND C
# -----------
#MODEL = s
#CFLAGS = -c -m$(MODEL)
#AFLAGS = /Mx /Dmem$(MODEL)=1
#LIBFLAGS = /c
all: ..\lib\device.lib
OBJS = floppy.obj rdpcclk.obj wrpcclk.obj wratclk.obj
..\lib\device.lib: $(OBJS)
-$(RM) $*.lib
$(LIBUTIL) $(LIBFLAGS) $* $(LIBOBJS) $(LIBTERM)
LIBOBJS= $(LIBPLUS)floppy.obj $(LIBPLUS)rdpcclk.obj $(LIBPLUS)wrpcclk.obj $(LIBPLUS)wratclk.obj
$(OBJS): $(DEPENDS) ../kernel/segs.inc
# Build the LIBRARY
# -----------------
all: production
production: ../lib/device.lib
../lib/device.lib: device.lib
$(CP) device.lib ..$(DIRSEP)lib
clobber: clean
-$(RM) device.lib status.me ..$(DIRSEP)lib$(DIRSEP)device.lib
########################################################################
clean:
-$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.cod *.err
device.lib : $(OBJS)
-$(RM) device.lib
$(LIBUTIL) $(LIBFLAGS) device.lib $(LIBOBJS) $(LIBTERM)
-$(RM) *.bak *.cod *.crf *.err *.las *.lst *.map *.obj *.xrf
clobber: clean
-$(RM) ..\lib\device.lib status.me

View File

@ -42,8 +42,8 @@ READPCCLOCK:
extern _DaysSinceEpoch ; ; update days if necessary
; (ah is still 0, al contains midnight flag)
add word [_DaysSinceEpoch ],ax ; *some* BIOSes accumulate several days
adc word [_DaysSinceEpoch+2],byte 0;
add word [_DaysSinceEpoch ],ax ; *some* BIOS's accumulate several days
adc word [_DaysSinceEpoch+2],0 ;
; set return value dx:ax
xchg ax,cx ; ax=_cx, cx=_ax

View File

@ -29,7 +29,6 @@
;
%include "../kernel/segs.inc"
%include "../hdr/stacks.inc"
segment HMA_TEXT
@ -48,14 +47,13 @@ WRITEATCLOCK:
; bcdMinutes = 6
; bcdHours = 8
; bcdDays = 10
arg bcdDays, bcdHours, bcdMinutes, bcdSeconds
mov ch,byte [.bcdHours]
mov cl,byte [.bcdMinutes]
mov dh,byte [.bcdSeconds]
mov ch,byte [bp+8] ;bcdHours
mov cl,byte [bp+6] ;bcdMinutes
mov dh,byte [bp+4] ;bcdSeconds
mov dl,0
mov ah,3
int 1ah
mov bx,word [.bcdDays]
mov bx,word [bp+10] ;bcdDays
mov dx,word [bx]
mov cx,word [bx+2]
mov ah,5

View File

@ -28,7 +28,6 @@
; $Header$
;
%include "../kernel/segs.inc"
%include "../hdr/stacks.inc"
segment HMA_TEXT
@ -41,7 +40,8 @@ segment HMA_TEXT
WRITEPCCLOCK:
; Ticks = 4
pop ax ; return address
popargs {cx,dx} ; Ticks
pop dx
pop cx ; Ticks
push ax ; restore stack
mov ah,1
int 1ah

View File

@ -3,12 +3,16 @@
*/*/clean.bat
*/*/clobber.bat
*/*/config.b
*/*/defaults.bat
*/*/filelist
*/*/default.bat
*/*/makefile
*/*/bin/autoexec.bat
*/*/bin/config.sys
*/*/bin/install.bat
*/*/boot/boot.asm
*/*/boot/boot32.asm
*/*/boot/boot32lb.asm
*/*/boot/oemboot.asm
*/*/boot/makefile
*/*/docs/bugs.txt
*/*/docs/build.txt
@ -34,11 +38,10 @@
*/*/hdr/buffer.h
*/*/hdr/cds.h
*/*/hdr/clock.h
*/*/hdr/date.h
*/*/hdr/dcb.h
*/*/hdr/ddate.h
*/*/hdr/device.h
*/*/hdr/dirmatch.h
*/*/hdr/dtime.h
*/*/hdr/error.h
*/*/hdr/exe.h
*/*/hdr/fat.h
@ -57,6 +60,7 @@
*/*/hdr/sft.h
*/*/hdr/stacks.inc
*/*/hdr/tail.h
*/*/hdr/time.h
*/*/hdr/version.h
*/*/hdr/xstructs.h
*/*/kernel/nls/001-437.hc
@ -74,6 +78,7 @@
*/*/kernel/config.c
*/*/kernel/config.h
*/*/kernel/console.asm
*/*/kernel/country.asm
*/*/kernel/dosfns.c
*/*/kernel/dosidle.asm
*/*/kernel/dosnames.c
@ -104,18 +109,15 @@
*/*/kernel/iprf.c
*/*/kernel/irqstack.asm
*/*/kernel/kernel.asm
*/*/kernel/kernel.cfg
*/*/kernel/lfnapi.c
*/*/kernel/ludivmul.inc
*/*/kernel/main.c
*/*/kernel/memdisk.asm
*/*/kernel/memmgr.c
*/*/kernel/misc.c
*/*/kernel/network.c
*/*/kernel/newstuff.c
*/*/kernel/nls.c
*/*/kernel/nls_hc.asm
*/*/kernel/nls_load.c
*/*/kernel/nlssupt.asm
*/*/kernel/prf.c
*/*/kernel/printer.asm
@ -128,26 +130,30 @@
*/*/kernel/syspack.c
*/*/kernel/systime.c
*/*/kernel/task.c
*/*/kernel/tci.cfg
*/*/kernel/turboc.cfg
*/*/kernel/msc.cfg
*/*/kernel/wc.cfg
*/*/kernel/wci.cfg
*/*/lib/makefile
*/*/mkfiles/generic.mak
*/*/mkfiles/bc5.mak
*/*/mkfiles/mscl8.mak
*/*/mkfiles/tc2.mak
*/*/mkfiles/tc3.mak
*/*/mkfiles/turbocpp.mak
*/*/mkfiles/bc.mak
*/*/mkfiles/tc.mak
*/*/mkfiles/tcpp.mak
*/*/mkfiles/tcpp3.mak
*/*/mkfiles/msc.mak
*/*/mkfiles/watcom.mak
*/*/sys/fdkrncfg.c
*/*/sys/bin2c.c
*/*/sys/makefile
*/*/sys/sys.c
*/*/sys/talloc.c
*/*/sys/turboc.cfg
*/*/utils/echoto.bat
*/*/utils/exeflat.c
*/*/utils/indent.ini
*/*/utils/makefile
*/*/utils/patchobj.c
*/*/utils/proto.bat
*/*/utils/relocinf.c
*/*/utils/rmfiles.bat
*/*/utils/wlinker.bat
*/*/utils/turboc.cfg

View File

@ -33,13 +33,11 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *buffer_hRcsId =
"$Id: buffer.h 1702 2012-02-04 08:46:16Z perditionc $";
"$Id$";
#endif
#endif
#include "dsk.h" /* only for MAX_SEC_SIZE */
#define BUFFERSIZE MAX_SEC_SIZE
#define BUFFERSIZE 512
struct buffer {
UWORD b_next; /* next buffer in LRU list */
UWORD b_prev; /* previous buffer in LRU list */

View File

@ -26,6 +26,12 @@
/* Cambridge, MA 02139, USA. */
/****************************************************************/
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *Cds_hRcsId =
"$Id$";
#endif
#endif
#define MAX_CDSPATH 67
@ -55,9 +61,9 @@ struct cds {
if local path: ofs > colon
*/
BYTE cdsNetFlag1; /* According to PCDOS 7 Tech Ref: IFS drive, 2=IFS, 4=NetUse */
BYTE FAR *cdsIfs; /* Pointer to Installable File System Header */
UWORD cdsNetFlags2; /* File System specific data */
BYTE cdsNetFlag1;
BYTE FAR *cdsIfs;
UWORD cdsNetFlags2;
};

View File

@ -33,7 +33,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *clock_hRcsId =
"$Id: clock.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************/
/* */
/* ddate.h */
/* date.h */
/* */
/* DOS General Date Structure */
/* */
@ -33,7 +33,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *date_hRcsId =
"$Id: date.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif
@ -51,7 +51,7 @@ static BYTE *date_hRcsId =
#define EPOCH_DAY 1 /* 1 for January 1 */
#define EPOCH_YEAR 1980 /* for Tues 1-1-80 epoch */
typedef UWORD ddate;
typedef UWORD date;
#endif

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *clock_hRcsId =
"$Id: dcb.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif
@ -80,8 +80,8 @@ struct dpb {
ULONG dpb_xdata;
ULONG dpb_xsize; /* # of clusters+1 on media */
ULONG dpb_xfatsize; /* # of sectors / FAT */
ULONG dpb_xrootclst; /* starting cluster of root dir */
ULONG dpb_xcluster; /* cluster # of first free */
CLUSTER dpb_xrootclst; /* starting cluster of root dir */
CLUSTER dpb_xcluster; /* cluster # of first free */
/* -1 if not known */
#endif
};
@ -89,4 +89,3 @@ struct dpb {
#define UNKNCLUSTER 0x0000 /* see RBIL INT 21/AH=52 entry */
#define XUNKNCLSTFREE 0xffffffffl /* unknown for DOS */
#define UNKNCLSTFREE 0xffff /* unknown for DOS */

View File

@ -125,20 +125,19 @@
#endif
/* ensure printf is prototyped */
/* just to be sure printf is declared */
#if defined(DEBUG) || defined(DEBUGIRQ) || defined(DEBUGCFG) || \
defined(DEBUGDOSFNS) || defined(CHDIR_DEBUG) || defined(FIND_DEBUG) || \
defined(DEBUGFATDIR) || defined(DEBUGFATFS) || \
defined(FORCEPRINTF)
defined(DEBUGFATDIR) || defined(DEBUGFATFS)
#ifndef DEBUG_NEED_PRINTF
#define DEBUG_NEED_PRINTF
#endif
#endif
#ifdef DEBUG_NEED_PRINTF
int VA_CDECL printf(CONST char * fmt, ...);
VOID VA_CDECL printf(CONST char FAR * fmt, ...);
#ifdef DEBUG_PRINT_COMPORT
int VA_CDECL dbgc_printf(CONST char * fmt, ...);
VOID VA_CDECL dbgc_printf(CONST char FAR * fmt, ...);
#endif
#endif

View File

@ -27,6 +27,12 @@
/* Cambridge, MA 02139, USA. */
/****************************************************************/
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *device_hRcsId =
"$Id$";
#endif
#endif
/*
* Status Word Bits
@ -150,15 +156,15 @@ typedef struct {
UWORD bpb_nbyte; /* Bytes per Sector */
UBYTE bpb_nsector; /* Sectors per Allocation Unit */
UWORD bpb_nreserved; /* # Reserved Sectors */
UBYTE bpb_nfat; /* # FATs */
UBYTE bpb_nfat; /* # FAT's */
UWORD bpb_ndirent; /* # Root Directory entries */
UWORD bpb_nsize; /* Total volume Size in sectors */
UWORD bpb_nsize; /* Size in sectors */
UBYTE bpb_mdesc; /* MEDIA Descriptor Byte */
UWORD bpb_nfsect; /* FAT size in sectors */
UWORD bpb_nsecs; /* Sectors per track */
UWORD bpb_nheads; /* Number of heads */
ULONG bpb_hidden; /* Hidden sectors */
ULONG bpb_huge; /* Total volume Size in sectors if*/
ULONG bpb_huge; /* Size in sectors if */
/* bpb_nsize == 0 */
#ifdef WITHFAT32
ULONG bpb_xnfsect; /* FAT size in sectors if */
@ -168,7 +174,7 @@ typedef struct {
/* bits 6-4: reserved (0) */
/* bits 3-0: active FAT number */
UWORD bpb_xfsversion; /* filesystem version */
ULONG bpb_xrootclst; /* starting cluster of root dir */
CLUSTER bpb_xrootclst; /* starting cluster of root dir */
UWORD bpb_xfsinfosec; /* FS info sector number, */
/* 0xFFFF if unknown */
UWORD bpb_xbackupsec; /* backup boot sector number */
@ -177,8 +183,7 @@ typedef struct {
} bpb;
#define N_RETRY 5 /* number of retries permitted */
#include "dsk.h"
#define SEC_SIZE 512 /* size of sector in bytes */
#define LBA_READ 0x4200
#define LBA_WRITE 0x4300
@ -242,7 +247,7 @@ typedef struct ddtstruct {
/* description flag bits */
#define DF_FIXED 0x001 /* fixed media, ie hard drive */
#define DF_CHANGELINE 0x002 /* door lock or disk change detection reported as supported */
#define DF_CURBPBLOCK 0x004 /* current BPB locked, use existing BPB instead of building one */
#define DF_CURBPBLOCK 0x004 /* current BPB locked ??? */
#define DF_SAMESIZE 0x008 /* all sectors in a track are the same size */
#define DF_MULTLOG 0x010 /* physical drive represents multiple logical ones, eg A: & B: */
#define DF_CURLOG 0x020 /* active (current) logical drive for this physical drive */
@ -253,7 +258,6 @@ typedef struct ddtstruct {
/* freedos specific flag bits */
#define DF_LBA 0x400
#define DF_WRTVERIFY 0x800
#define DF_DMA_TRANSPARENT 0x1000 /* DMA boundary errors are handled transparently */
/* typedef struct ddtstruct ddt;*/
@ -494,12 +498,7 @@ COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice, int mo
WORD ASMCFUNC FAR clk_driver(rqptr rp);
/* execrh.asm */
#if defined(__WATCOMC__) && _M_IX86 >= 300
WORD execrh(request FAR *, struct dhdr FAR *);
#pragma aux execrh "^" __parm __reverse __routine [] __modify [__ax __bx __cx __dx __es __fs __gs]
#else
WORD ASMPASCAL execrh(request FAR *, struct dhdr FAR *);
#endif
/*
* end of device.h

View File

@ -31,24 +31,32 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *dirmatch_hRcsId =
"$Id: dirmatch.h 1415 2009-06-02 13:18:24Z bartoldeman $";
"$Id$";
#endif
#endif
typedef struct {
UBYTE dm_drive;
BYTE dm_name_pat[FNAME_SIZE + FEXT_SIZE];
UBYTE dm_attr_srch;
BYTE dm_attr_srch; /* !!! should be UBYTE --avb */
UWORD dm_entry;
CLUSTER dm_dircluster;
#ifndef WITHFAT32
UWORD reserved;
#endif
UWORD reserved2;
struct {
BITS f_dmod:1; /* directory has been modified */
BITS f_droot:1; /* directory is the root */
BITS f_dnew:1; /* fnode is new and needs fill */
BITS f_ddir:1; /* fnode is assigned to dir */
BITS f_filler:12; /* filler to avoid a bad bug */
/* (feature?) in TC 2.01 */
} dm_flags; /* file flags */
UBYTE dm_attr_fnd; /* found file attribute */
dtime dm_time; /* file time */
ddate dm_date; /* file date */
time dm_time; /* file time */
date dm_date; /* file date */
ULONG dm_size; /* file size */
BYTE dm_name[FNAME_SIZE + FEXT_SIZE + 2]; /* file name */
} dmatch;

View File

@ -1,31 +0,0 @@
/****************************************************************/
/* */
/* dsk.h */
/* Disk access Header File */
/* */
/* Copyright (c) 2012 */
/* FreeDOS */
/* All Rights Reserved */
/* */
/* This file is part of DOS-C. */
/* */
/* DOS-C is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version */
/* 2, or (at your option) any later version. */
/* */
/* DOS-C is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
/* the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public */
/* License along with DOS-C; see the file COPYING. If not, */
/* write to the Free Software Foundation, 675 Mass Ave, */
/* Cambridge, MA 02139, USA. */
/****************************************************************/
#ifndef MAX_SEC_SIZE
#define MAX_SEC_SIZE (1*512) /* max supported size of sector in bytes */
#endif

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *error_hRcsId =
"$Id: error.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *exe_hRcsId =
"$Id: exe.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *fat_hRcsId =
"$Id: fat.h 1448 2009-06-16 21:45:17Z bartoldeman $";
"$Id$";
#endif
#endif
@ -105,8 +105,8 @@ struct dirent {
UWORD dir_crdate; /* Creation date */
UWORD dir_accdate; /* Last access date */
UWORD dir_start_high; /* High word of the cluster */
dtime dir_time; /* Time file created/updated */
ddate dir_date; /* Date file created/updated */
time dir_time; /* Time file created/updated */
date dir_date; /* Date file created/updated */
UWORD dir_start; /* Starting cluster */
/* 1st available = 2 */
ULONG dir_size; /* File size in bytes */
@ -131,18 +131,20 @@ struct lfn_entry {
struct dpb;
CLUSTER getdstart(struct dpb FAR *dpbp, struct dirent *dentry);
void setdstart(struct dpb FAR *dpbp, struct dirent *dentry, CLUSTER value);
BOOL checkdstart(struct dpb FAR *dpbp, struct dirent *dentry, CLUSTER value);
#else
#define getdstart(dpbp, dentry) \
((dentry)->dir_start)
#define setdstart(dpbp, dentry, value) \
(((dentry)->dir_start) = (UWORD)(value))
#define checkdstart(dpbp, dentry, value) \
(((dentry)->dir_start) == (UWORD)(value))
#endif
#define DIR_NAME 0
#define DIR_EXT FNAME_SIZE
#define DIR_ATTRIB (FNAME_SIZE+FEXT_SIZE)
#define DIR_RESERVED (FNAME_SIZE+FEXT_SIZE+1)
#define DIR_START_HIGH (FNAME_SIZE+FEXT_SIZE+9)
#define DIR_TIME (FNAME_SIZE+FEXT_SIZE+11)
#define DIR_DATE (FNAME_SIZE+FEXT_SIZE+13)
#define DIR_START (FNAME_SIZE+FEXT_SIZE+15)

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *fcb_hRcsId =
"$Id: fcb.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif
@ -86,8 +86,8 @@ typedef struct {
UWORD fcb_recsiz; /* Logical record size in bytes, */
/* default = 128 */
ULONG fcb_fsize; /* File size in bytes */
ddate fcb_date; /* Date file created */
dtime fcb_time; /* Time of last write */
date fcb_date; /* Date file created */
time fcb_time; /* Time of last write */
/* the following are reserved by system */
BYTE fcb_sftno; /* Device ID */
BYTE fcb_attrib_hi; /* share info, dev attrib word hi */

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *file_hRcsId =
"$Id: file.h 831 2004-03-27 00:27:11Z bartoldeman $";
"$Id$";
#endif
#endif
@ -58,10 +58,8 @@ static BYTE *file_hRcsId =
/* bits 2, 3 reserved */
/* bits 4, 5, 6 sharing modes */
/* see PC Mag Nov 15, 1988 "Networked Database" p234 by Frank J Derfler Jr */
#define O_SHAREMASK 0x0070 /* mask to isolate shared bits */
#define O_COMPAT 0x0000 /* default, compatibility mode */
#define O_DENYALL 0x0010 /* sharing bits */
#define O_DENYWRITE 0x0020 /* " " */
#define O_DENYREAD 0x0030 /* " " */

View File

@ -31,27 +31,32 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *fnode_hRcsId =
"$Id: fnode.h 1432 2009-06-10 16:10:54Z bartoldeman $";
"$Id$";
#endif
#endif
struct f_node {
UWORD f_count; /* number of uses of this file */
COUNT f_mode; /* read, write, read-write, etc */
UWORD f_flags; /* file flags */
dmatch *f_dmp; /* this file's dir match */
struct dirent f_dir; /* this file's dir entry image */
ULONG f_dirsector; /* the sector containing dir entry*/
UBYTE f_diridx; /* offset/32 of dir entry in sec*/
UWORD f_diroff; /* offset/32 of the dir entry */
CLUSTER f_dirstart; /* the starting cluster of dir */
/* when dir is not root */
struct dpb FAR *f_dpb; /* the block device for file */
ULONG f_offset; /* byte offset for next op */
CLUSTER f_cluster_offset; /* relative cluster number within file */
CLUSTER f_cluster; /* the cluster we are at */
UBYTE f_sft_idx; /* corresponding SFT index */
};
#define F_DMOD 1 /* directory has been modified */
#define F_DDIR 2 /* fnode is assigned to dir */
#define F_DDATE 4 /* date set using setdate */
typedef struct f_node *f_node_ptr;
struct lfn_inode {

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *kbd_hRcsId =
"$Id: kbd.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -21,29 +21,7 @@
' hit any key to continue to boot from 'diskette or CD'
wait ## seconds
if no key hit, boot from HD
Version_: only in kernel 2042 or higher, offline version identification
OemID: 0xFD for FreeDOS kernel, 0xDC for DosC kernel
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 #)
CheckDebugger: during initialization enable/disable check to stop in debugger if one is active
0 = do not check (assume absent),
1 = do check by running breakpoint,
2 = assume present
Verbose: amount of messages to display during initialization
-1 = quiet
0 = normal
1 = verbose
PartitionMode: how to handle GPT and MBR partitions
bits 0-1: 01=GPT if found, 00=MBR if found, 11=Hybrid, GPT first then MBR, 10=Hybrid, MBR first then GPT
in hybrid mode, EE partitions ignored, drives assigned by GPT or MBR first based on hybrid type
bits 2-4: 001=mount ESP (usually FAT32) partition, 010=mount MS Basic partitions, 100=mount unknown partitions
111=attempt to mount all paritions, 110=attempt to mount all but ESP partitions
bits 5-7: reserved, 0 else undefined behavior
*/
typedef struct _KernelConfig {
char CONFIG[6]; /* "CONFIG" */
@ -55,15 +33,4 @@ typedef struct _KernelConfig {
unsigned char ForceLBA;
unsigned char GlobalEnableLBAsupport; /* = 0 --> disable LBA support */
signed char BootHarddiskSeconds;
/* for version 2042 and higher only */
unsigned char Version_OemID;
unsigned char Version_Major;
unsigned short Version_Revision;
unsigned short Version_Release;
/* for version 2044 and higher only */
unsigned char CheckDebugger;
signed char Verbose;
unsigned char PartitionMode;
} KernelConfig;

View File

@ -26,7 +26,8 @@
/* Boston, MA 02111-1307 USA. */
/****************************************************************/
enum {LOC_CONV=0, LOC_HMA=1};
#ifndef __LOL_H
#define __LOL_H
/* note: we start at DOSDS:0, but the "official" list of lists starts a
little later at DOSDS:26 (this is what is returned by int21/ah=52) */
@ -39,7 +40,7 @@ struct lol {
struct sfttbl far *sfthead; /* 4 System File Table head */
struct dhdr far *clock; /* 8 CLOCK$ device */
struct dhdr far *syscon; /* c console device */
unsigned short maxsecsize; /* 10 max bytes per sector for any blkdev */
unsigned short maxsecbytes; /* 10 max bytes per sector for any blkdev */
void far *inforecptr; /* 12 pointer to disk buffer info record */
struct cds far *CDSp; /* 16 Current Directory Structure */
struct sfttbl far *FCBp; /* 1a FCB table pointer */
@ -55,7 +56,7 @@ struct lol {
unsigned short nbuffers; /* 3f Number of buffers */
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 char dwordmoves; /* 44 use dword moves (unused) */
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 */
@ -73,15 +74,17 @@ struct lol {
unsigned short min_pars; /* 64 minimum para req by program execed */
unsigned short uppermem_root;/* 66 Start of umb chain (usually 9fff) */
unsigned short last_para; /* 68 para: start scanning during memalloc */
/* ANY ITEM BELOW THIS POINT MAY CHANGE */
/* FreeDOS specific entries */
unsigned char os_setver_minor;/*6a settable minor DOS version */
unsigned char os_setver_major;/*6b settable major DOS version */
unsigned char os_minor; /* 6c minor DOS version */
unsigned char os_major; /* 6d major DOS version */
unsigned char rev_number; /* 6e DOS revision#, only 3 bits */
unsigned char rev_number; /* 6e minor DOS version */
unsigned char version_flags; /* 6f DOS version flags */
char *os_release; /* 70 near pointer to os_release string */
struct f_node FAR *f_nodes; /* 70 pointer to the array */
unsigned short f_nodes_cnt; /* 74 number of allocated f_nodes */
char *os_release; /* 76 near pointer to os_release string */
/* ANY ITEM BELOW THIS POINT MAY CHANGE */
#ifdef WIN31SUPPORT
unsigned short winInstanced; /* WinInit called */
unsigned long winStartupInfo[4];
@ -89,3 +92,4 @@ struct lol {
#endif
};
#endif /* __LOL_H */

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *mcb_hRcsId =
"$Id: mcb.h 822 2004-03-25 00:20:20Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -59,9 +59,6 @@
#define REM_PRINTREDIR 0x1125
#define REM_EXTOC 0x112e
/* Redirector extensions */
#define REM_GETLARGESPACE 0x11a3
struct rgds {
UWORD r_spc;
UWORD r_navc;

View File

@ -28,7 +28,7 @@
/****************************************************************/
/* one byte alignment */
#include "algnbyte.h"
#include <algnbyte.h>
/*
* Description of the organization of NLS information -- 2000/02/13 ska
@ -175,7 +175,7 @@
*
* Performance tweaks:
* When the system -- This word applies to the combination of kernel and
* any loaded MUX-14 extension <EFBFBD> la NLSFUNC here. -- uppercases
* any loaded MUX-14 extension á la NLSFUNC here. -- uppercases
* _filenames_, it must perform a DOS-65-A2 internally. In the basic
* implementation this request would be channeled through MUX-14, even
* if there is no external NLSFUNC at all. Also, when a NLS pkg had
@ -403,7 +403,7 @@ struct nlsExtCntryInfo {
0: 12 hours (append AM/PM)
1: 24 houres
*/
intvec upCaseFct; /* far call to a function upcasing the
VOID(FAR * upCaseFct) (VOID); /* far call to a function upcasing the
character in register AL */
char dataSep[2]; /* ASCIZ of separator in data records */
};
@ -430,16 +430,12 @@ struct nlsPackage { /* the contents of one chain item of the
UWORD yeschar; /* yes / no character DOS-65-23 */
UWORD nochar;
unsigned numSubfct; /* number of supported sub-functions */
struct nlsPointer nlsPointers[5]; /* may grow dynamically */
struct nlsExtCntryInfo nlsExt;
struct nlsPointer nlsPointers[1]; /* grows dynamically */
};
struct nlsDBCS { /* The internal structure is unknown to me */
UWORD numEntries;
UWORD dbcsTbl[4]; /* I don't know max size but it should need
at least 3 words (6 bytes)
({0x81,0x9f,0xe0,0xfc,0,0} for CP932-Japan)
-- lpproj 2014/10/27 */
UWORD dbcsTbl[1];
};
struct nlsCharTbl {
@ -474,23 +470,20 @@ struct nlsInfoBlock { /* This block contains all information
maybe tweaked by NLSFUNC */
UWORD sysCodePage; /* system code page */
unsigned flags; /* implementation flags */
#ifdef __GNUC__
/* need to initialize using explicit segment/offset */
union {
struct { struct nlsPackage *off; char *seg; };
struct nlsPackage FAR *p;
} actPkg, chain;
#define actPkg actPkg.p
#define chain chain.p
#else
struct nlsPackage FAR *actPkg; /* current NLS package */
struct nlsPackage FAR *chain; /* first item of info chain --
hardcoded U.S.A./CP437 */
#endif
};
extern struct nlsInfoBlock ASM nlsInfo;
extern struct nlsPackage DOSFAR ASM nlsPackageHardcoded;
extern struct nlsInfoBlock nlsInfo;
extern struct nlsPackage FAR ASM nlsPackageHardcoded;
/* These are the "must have" tables within the hard coded NLS pkg */
extern struct nlsFnamTerm FAR ASM nlsFnameTermHardcoded;
extern struct nlsDBCS FAR ASM nlsDBCSHardcoded;
extern struct nlsCharTbl FAR ASM nlsUpcaseHardcoded;
extern struct nlsCharTbl FAR ASM nlsFUpcaseHardcoded;
extern struct nlsCharTbl FAR ASM nlsCollHardcoded;
extern struct nlsExtCntryInfo FAR ASM nlsCntryInfoHardcoded;
extern BYTE FAR hcTablesStart[], hcTablesEnd[];
/***********************************************************************
@ -623,7 +616,7 @@ struct nlsCSys_loadPackage {
};
/* standard alignment */
#include "algndflt.h"
#include <algndflt.h>
#ifdef DEBUG
/* Enable debugging of NLS part */

View File

@ -52,12 +52,12 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *pcb_hRcsId =
"$Id: pcb.h 1316 2007-05-15 17:48:47Z bartoldeman $";
"$Id$";
#endif
#endif
/* Force one-byte alignment for all the internal structures, see above */
#include "algnbyte.h"
#include <algnbyte.h>
/* */
/* interrupt handler structure definition */
/* */
@ -87,6 +87,14 @@ typedef struct {
UWORD si, di, ds, es;
} lregs;
/* Registers directly passed to syscall;
must be the same order as iregs!
Is used to define parameters. */
#define DIRECT_IREGS \
xreg a, xreg b, xreg c, xreg d, \
UWORD si, UWORD di, UWORD bp, UWORD ds, UWORD es, \
UWORD ip, UWORD cs, UWORD flags
/* Process control block for task switching */
typedef struct {
UWORD pc_ss;
@ -158,7 +166,15 @@ typedef struct {
#define FLG_CARRY 0x0001
/* Allow default alignment from now on */
#include "algndflt.h"
#include <algndflt.h>
/*
* Invoke interrupt "intnr" with all registers from *pr loaded
* into the processor registers (except: SS, SP,& flags)
* On return, all processor registers are stored into *pr (including
* flags).
*/
void ASMCFUNC intr(int intnr, iregs * const pr);
#endif

View File

@ -31,10 +31,12 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static char *portab_hRcsId =
"$Id: portab.h 1121 2005-03-15 15:25:08Z perditionc $";
"$Id$";
#endif
#endif
#include <limits.h>
/****************************************************************/
/* */
/* Machine dependant portable types. Note that this section is */
@ -64,6 +66,14 @@ static char *portab_hRcsId =
#define I86
#define CDECL cdecl
#if __TURBOC__ > 0x202
#if __TURBOC__ < 0x400 /* targeted to TC++ 1.0 which is 0x297 (3.1 is 0x410) */
#pragma warn -pia /* possibly incorrect assignment */
#pragma warn -sus /* suspicious pointer conversion */
/*
* NOTE: The above enable TC++ to build the kernel, but it's not recommended
* for development. Use [Open]Watcom (the best!) or newer Borland compilers!
*/
#endif
/* printf callers do the right thing for tc++ 1.01 but not tc 2.01 */
#define VA_CDECL
#else
@ -73,11 +83,12 @@ static char *portab_hRcsId =
void __int__(int);
#ifndef FORSYS
void __emit__(char, ...);
#define disable() __emit__(0xfa)
#define enable() __emit__(0xfb)
#define disable() __emit__(0xfa) /* cli; disable interrupts */
#define enable() __emit__(0xfb) /* sti; enable interrupts */
#define halt() __emit__(0xf4) /* hlt; halt until interrupt */
#endif
#elif defined(_MSC_VER)
#elif defined (_MSC_VER)
#define I86
#define asm __asm
@ -89,6 +100,7 @@ void __emit__(char, ...);
#define __int__(intno) asm int intno;
#define disable() asm cli
#define enable() asm sti
#define halt() asm hlt
#define _CS getCS()
static unsigned short __inline getCS(void)
{
@ -102,14 +114,14 @@ static unsigned short __inline getSS(void)
#elif defined(__WATCOMC__) /* don't know a better way */
#if defined(_M_I86)
#define I86
#define __int__(intno) asm int intno;
void disable(void);
#pragma aux disable = "cli" __modify __exact [];
#pragma aux disable = "cli" modify exact [];
void enable(void);
#pragma aux enable = "sti" __modify __exact [];
#pragma aux enable = "sti" modify exact [];
void halt(void);
#pragma aux halt = "hlt" modify exact [];
#define asm __asm
#define far __far
#define CDECL __cdecl
@ -117,22 +129,19 @@ void enable(void);
#define PASCAL pascal
#define _CS getCS()
unsigned short getCS(void);
#pragma aux getCS = "mov dx,cs" __value [__dx] __modify __exact[__dx];
#pragma aux getCS = "mov dx,cs" value [dx] modify exact[dx];
#define _SS getSS()
unsigned short getSS(void);
#pragma aux getSS = "mov dx,ss" __value [__dx] __modify __exact[__dx];
#if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300
#pragma aux __default __parm [__ax __dx __cx] __modify [__ax __dx __es __fs] /* min.unpacked size */
#endif
#pragma aux getSS = "mov dx,ss" value [dx] modify exact[dx];
/* enable Possible loss of precision warning for compatibility with Borland */
#pragma enable_message(130)
#if !defined(FORSYS) && !defined(EXEFLAT) && _M_IX86 >= 300
#pragma aux default parm [ax dx cx] modify [ax dx es fs] /* min.unpacked size */
/* #pragma aux default parm [ax dx] modify [ax bx cx dx es fs]min.packed size */
#endif
#else
/* workaround for building some utils with OpenWatcom (flat model) */
#define MC68K
#if _M_IX86 >= 300 || defined(M_I386)
#define I386
#endif
#elif defined (_MYMC68K_COMILER_)
@ -140,44 +149,8 @@ unsigned short getSS(void);
#define MC68K
#elif defined(__GNUC__)
#ifdef __FAR
#define I86
#define STRINGIFY(x) #x
#define __int__(intno) asm volatile(STRINGIFY(int $##intno))
static inline void disable(void)
{
asm volatile("cli");
}
static inline void enable(void)
{
asm volatile("sti");
}
#define far __far
#define CDECL __attribute__((cdecl))
#define VA_CDECL
#define PASCAL
#define _CS getCS()
static inline unsigned short getCS(void)
{
unsigned short ret;
asm volatile("mov %%cs, %0" : "=r"(ret));
return ret;
}
#define _SS getSS()
static inline unsigned short getSS(void)
{
unsigned short ret;
asm volatile("mov %%ss, %0" : "=r"(ret));
return ret;
}
extern char DosDataSeg[];
#else
/* for warnings only ! */
#define MC68K
#endif
#else
#error Unknown compiler
@ -186,15 +159,11 @@ We might even deal with a pre-ANSI compiler. This will certainly not compile.
#ifdef I86
#if _M_IX86 >= 300 || defined(M_I386)
#ifndef I386
#define I386
#endif
#elif _M_IX86 >= 100 || defined(M_I286)
#ifndef I186
#define I186
#endif
#endif
#endif
#ifdef MC68K
#define far /* No far type */
@ -215,12 +184,10 @@ We might even deal with a pre-ANSI compiler. This will certainly not compile.
typedef __SIZE_TYPE__ size_t;
#else
#define CONST
#if !(defined(_SIZE_T) || defined(_SIZE_T_DEFINED) || defined(__SIZE_T_DEFINED))
typedef unsigned size_t;
#endif
#endif
#endif
#if defined(I86) && !defined(MC68K)
#ifdef I86
#define VOID void
#define FAR far /* segment architecture */
#define NEAR near /* " " */
@ -237,16 +204,7 @@ typedef unsigned size_t;
as 'ASMCFUNC', and is (and will be ?-) cdecl */
#define ASMCFUNC CDECL
#define ASMPASCAL PASCAL
#if defined(__GNUC__)
#define ASM
#else
#define ASM ASMCFUNC
#endif
/* variables that can be near or far: redefined in init-dat.h */
#define DOSFAR
#define DOSTEXTFAR
/* */
/* Boolean type & definitions of TRUE and FALSE boolean values */
/* */
@ -298,7 +256,7 @@ typedef unsigned short CLUSTER;
#endif
typedef unsigned short UNICODE;
#if defined(STATICS) || defined(__WATCOMC__) || defined(__GNUC__)
#if defined(STATICS) || defined(__WATCOMC__)
#define STATIC static /* local calls inside module */
#else
#define STATIC
@ -316,6 +274,19 @@ typedef signed long LONG;
#define LONG long
#endif
typedef UWORD ofs_t;
typedef UWORD seg_t;
#define lonibble(v) (0x0f & (v))
#define hinibble(v) (0xf0 & (v))
#if CHAR_BIT == 8
# define lobyte(v) ((UBYTE)(v))
#else
# define lobyte(v) ((UBYTE)(0xff & (v)))
#endif
#define hibyte(v) lobyte ((UWORD)(v) >> 8u)
#if USHRT_MAX == 0xFFFF
# define loword(v) ((unsigned short)(v))
#else
@ -330,49 +301,41 @@ typedef signed long LONG;
#ifdef I86
#ifndef MK_FP
#if defined(__WATCOMC__)
#if defined __WATCOMC__
#define MK_FP(seg,ofs) (((UWORD)(seg)):>((VOID *)(ofs)))
#elif defined(__TURBOC__) && (__TURBOC__ > 0x202)
#elif __TURBOC__ > 0x202
#define MK_FP(seg,ofs) ((void _seg *)(seg) + (void near *)(ofs))
#else
#define MK_FP(seg,ofs) ((void FAR *)(((ULONG)(seg)<<16)|(UWORD)(ofs)))
#define MK_FP(seg,ofs) ((void FAR *)MK_ULONG(seg, ofs))
#endif
#define pokeb(seg, ofs, b) (*((unsigned char far *)MK_FP(seg,ofs)) = b)
#define poke(seg, ofs, w) (*((unsigned far *)MK_FP(seg,ofs)) = w)
#define pokeb(seg, ofs, b) (*(unsigned char far *)MK_FP(seg,ofs) = (b))
#define poke(seg, ofs, w) (*(unsigned far *)MK_FP(seg,ofs) = (w))
#define pokew poke
#define pokel(seg, ofs, l) (*((unsigned long far *)MK_FP(seg,ofs)) = l)
#define peekb(seg, ofs) (*((unsigned char far *)MK_FP(seg,ofs)))
#define peek(seg, ofs) (*((unsigned far *)MK_FP(seg,ofs)))
#define pokel(seg, ofs, l) (*(unsigned long far *)MK_FP(seg,ofs) = (l))
#define peekb(seg, ofs) (*(unsigned char far *)MK_FP(seg,ofs))
#define peek(seg, ofs) (*(unsigned far *)MK_FP(seg,ofs))
#define peekw peek
#define peekl(seg, ofs) (*((unsigned long far *)MK_FP(seg,ofs)))
#define peekl(seg, ofs) (*(unsigned long far *)MK_FP(seg,ofs))
#if defined(__TURBOC__) && (__TURBOC__ > 0x202)
#if __TURBOC__ > 0x202
#define FP_SEG(fp) ((unsigned)(void _seg *)(void far *)(fp))
#else
#define FP_SEG(fp) ((unsigned)((ULONG)(VOID FAR *)(fp)>>16))
#define FP_SEG(fp) hiword ((ULONG)(VOID FAR *)(fp))
#endif
#if defined(__GNUC__) && defined(__BUILTIN_IA16_FP_OFF)
#define FP_OFF(fp) __builtin_ia16_FP_OFF(fp)
#else
#define FP_OFF(fp) ((unsigned)(fp))
#endif
#define FP_OFF(fp) loword (fp)
#endif
#endif
#ifdef MC68K
#define MK_FP(seg,ofs) ((VOID *)(&(((BYTE *)(size_t)(seg))[(ofs)])))
#define FP_SEG(fp) (0)
#define MK_FP(seg,ofs) ((VOID *)&(((BYTE *)(size_t)(seg))[ofs]))
#define FP_SEG(fp) 0
#define FP_OFF(fp) ((size_t)(fp))
#endif
#if defined(__GNUC__) && defined(__FAR)
typedef VOID FAR *intvec;
#else
typedef VOID (FAR ASMCFUNC * intvec) (void);
#endif
#define MK_PTR(type,seg,ofs) ((type FAR*) MK_FP (seg, ofs))
#if __TURBOC__ > 0x202
@ -387,10 +350,29 @@ typedef VOID (FAR ASMCFUNC * intvec) (void);
unreferenced parameter 'x'
and (hopefully) generates no code
*/
#define UNREFERENCED_PARAMETER(x) (void)x;
#define UNREFERENCED_PARAMETER(x) (void)(x)
#ifdef I86 /* commandline overflow - removing /DPROTO TE */
#define PROTO
#endif
#define LENGTH(x) (sizeof(x)/sizeof(x[0]))
typedef const char CStr[], *PCStr;
typedef char Str[], *PStr;
typedef const void *CVP;
typedef const void FAR *CVFP;
typedef void FAR *VFP;
#define LENGTH(x) (sizeof (x)/sizeof *(x))
#define ENDOF(x) ((x) + LENGTH (x))
/* (unsigned) modulo arithmetics trick: a<=b<=c equal to b-a<=c-a */
#define inrange(type,v,lo,hi) ((type)((v) - (lo)) <= (type)((hi) - (lo)))
#define _isdigit(c) inrange(UBYTE, c, '0', '9')
#define _islower(c) inrange(UBYTE, c, 'a', 'z')
#define _isupper(c) inrange(UBYTE, c, 'A', 'Z')
/* Fast ASCII tolower/toupper */
#define _fast_lower(ch) ((ch) | 0x20)
#define _fast_dolower(var) ((var) |= 0x20)
#define _fast_upper(ch) ((ch) & ~0x20)
#define _fast_doupper(var) ((var) &= ~0x20)

View File

@ -28,6 +28,12 @@
/* Cambridge, MA 02139, USA. */
/****************************************************************/
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *process_hRcsId =
"$Id$";
#endif
#endif
/* Modes available as first argument to the spawnxx functions. */
@ -59,16 +65,11 @@ typedef struct {
UWORD ps_exit; /* 00 CP/M-like exit point: int 20 */
UWORD ps_size; /* 02 segment of first byte beyond */
/* memory allocated to program */
BYTE ps_fill1; /* 04 single char fill=0 */
/* CP/M-like entry point */
/* offsets 5-9 are a far call to absolute address 0:00C0h
encoded using 1MB wrap form of address (e.g. 0F01D:FEF0h)
for compatiblity with CP/M apps that do a near call to psp:5
and expect size (KB) of allocated segment in word at offset 6 */
UBYTE ps_farcall; /* 05 far call opcode */
intvec ps_reentry; /* 06 re-entry point */
BYTE ps_fill1; /* 04 single char fill */
/* CP/M-like entry point */
UBYTE ps_farcall; /* 05 far call opcode */
VOID(FAR ASMCFUNC * ps_reentry) (void); /* 06 re-entry point */
intvec ps_isv22, /* 0a terminate address */
ps_isv23, /* 0e ctrl-break address */
ps_isv24; /* 12 critical error address */
@ -79,10 +80,10 @@ typedef struct {
UWORD ps_maxfiles; /* 32 maximum open files */
UBYTE FAR *ps_filetab; /* 34 open file table pointer */
VOID FAR *ps_prevpsp; /* 38 previous psp pointer */
UBYTE ps_dbcs_inputmode; /* 3c unused,see int21/6301h/6302h */
UBYTE ps_truename; /* 3d unused,append truename flag int2f/B711h */
UBYTE ps_fill2; /* 3c unused */
UBYTE ps_truename; /* 3d [unused] append truename flag int2f/B711h */
UBYTE ps_netx_taskid[2]; /* 3e [Novell only field] task id */
UWORD ps_retdosver; /* 40 version to return on int21/30h, defaults to true version */
UWORD ps_retdosver; /* 40 [unused] version to return on int21/30h */
UWORD pdb_next; /* 42 [Win only field] PSP chain */
UBYTE ps_fill2b[4]; /* 44 unused, 4 bytes */
UBYTE ps_olddos; /* 48 [Win only field] DOS/Win program */

View File

@ -30,7 +30,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *sft_hRcsId =
"$Id: sft.h 1429 2009-06-09 18:50:03Z bartoldeman $";
"$Id$";
#endif
#endif
@ -56,33 +56,22 @@ typedef struct {
struct dpb FAR *_sft_dcb; /* The device control block */
struct dhdr FAR *_sft_dev; /* device driver for char dev */
} sft_dcb_or_dev;
#ifdef WITHFAT32
UWORD sft_relclust_high; /* 0b - High part of relative cluster */
#else
CLUSTER sft_stclust; /* 0b - Starting cluster */
#endif
dtime sft_time; /* 0d - File time */
ddate sft_date; /* 0f - File date */
ULONG sft_size; /* 11 - File size */
ULONG sft_posit; /* 15 - Current file position */
UWORD sft_relclust; /* 19 - File relative cluster (low part) */
ULONG sft_dirsector; /* 1b - Sector containing cluster */
UBYTE sft_diridx; /* 1f - directory index */
WORD sft_stclust; /* 0b - Starting cluster */
time sft_time; /* 0d - File time */
date sft_date; /* 0f - File date */
LONG sft_size; /* 11 - File size */
LONG sft_posit; /* 15 - Current file position */
WORD sft_relclust; /* 19 - File relative cluster */
WORD sft_cuclust; /* 1b - File current cluster */
WORD sft_dirdlust; /* 1d - Sector containing cluster */
BYTE sft_diridx; /* 1f - directory index */
BYTE sft_name[11]; /* 20 - dir style file name */
#ifdef WITHFAT32
CLUSTER sft_stclust; /* 2b - Starting cluster */
#else
BYTE FAR *sft_bshare; /* 2b - backward link of file sharing sft */
#endif
WORD sft_mach; /* 2f - machine number - network apps */
WORD sft_psp; /* 31 - owner psp */
WORD sft_shroff; /* 33 - Sharing offset */
CLUSTER sft_cuclust; /* 35 - File current cluster */
#ifdef WITHFAT32
UWORD sft_pad;
#else
WORD sft_status; /* 35 - this sft status */
BYTE FAR *sft_ifsptr; /* 37 - pointer to IFS driver for file, 0000000h if native DOS */
#endif
} sft;
/* SFT Table header definition */
@ -115,8 +104,7 @@ typedef struct sfttbl {
/* the following bits are file (block) unique */
#define SFT_FDATE 0x4000 /* File date set */
#define SFT_FFIXEDMEDIA 0x0800 /* File on non-removable media - unused */
#define SFT_FCLEAN 0x0040 /* File has not been written to */
#define SFT_FDIRTY 0x0040 /* File has been written to */
#define SFT_FDMASK 0x003f /* File mask for drive no */
/* the following bits are device (char) unique */
@ -130,7 +118,7 @@ typedef struct sfttbl {
#define SFT_FCONOUT 0x0002 /* device is console output */
#define SFT_FCONIN 0x0001 /* device is console input */
/* Convenience defines */
/* Covienence defines */
#define sft_dcb sft_dcb_or_dev._sft_dcb
#define sft_dev sft_dcb_or_dev._sft_dev
@ -138,7 +126,3 @@ typedef struct sfttbl {
#define sft_flags_hi sft_flags_union._split_sft_flags._sft_flags_hi
#define sft_flags_lo sft_flags_union._split_sft_flags._sft_flags_lo
/* defines for LSEEK */
#define SEEK_SET 0u
#define SEEK_CUR 1u
#define SEEK_END 2u

View File

@ -25,7 +25,7 @@
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
;
; $Id: stacks.inc 1591 2011-05-06 01:46:55Z bartoldeman $
; $Id$
;
;
@ -136,117 +136,51 @@ irp_hi equ 26
%macro Protect386Registers 0
%endmacro
%macro RestoreSP 0
mov sp, bp
%endmacro
%macro Restore386Registers 0
%endmacro
%ELSE
%ifdef WATCOM
%ELSE
%macro Protect386Registers 0
%ifdef WATCOM
push fs
push gs
%endmacro
%macro RestoreSP 0
lea sp, [bp-4]
%endmacro
%macro Restore386Registers 0
pop gs
pop fs
%endmacro
%else
%macro Protect386Registers 0
push eax
pop ax
%ifdef MSCL8
%ifdef MSC
push ecx
pop cx
%else ;BC5
%else ;BC
push ebx
pop bx
%endif
push edx
pop dx
%endmacro
%endif
%macro RestoreSP 0
lea sp, [bp-6]
%endmacro
%macro Restore386Registers 0
%ifdef WATCOM
pop gs
pop fs
%else
push dx
pop edx
%ifdef MSCL8
%ifdef MSC
push cx
pop ecx
%else ;BC5
%else ;BC
push bx
pop ebx
%endif
push ax
pop eax
%endif
%endmacro
%endif
%ENDIF
; macros to define stack arguments
; arg a, {b,4}, c
; defines a and c as "word" arguments and b as a "dword" argument
; for STDCALL defines .a as [bp+4], .b as [bp+6] and .c as [bp+10]
; for PASCAL defines .a as [bp+10], .b as [bp+6] and .c as [bp+4]
;
; popargs bx, {dx,ax}, cx pops these arguments of the stack (for PASCAL
; in reverse order). Here dx,ax is a dword argument dx:ax where dx is
; the high word. The caller is responsible for dealing with instruction
; pointer (ip) on the stack.
%ifdef gcc
%define STDCALL
%else
%define PASCAL
%endif
%macro definearg 1-2 2
%xdefine .%1 bp+.argloc
%assign .argloc .argloc+%2
%endmacro
%macro arg 1-*
%assign .argloc 4
%rep %0
%ifdef PASCAL
%rotate -1
%endif
definearg %1
%ifdef STDCALL
%rotate 1
%endif
%endrep
%endmacro
%macro multipop 1-*
%rep %0
%rotate -1
pop %1
%endrep
%endmacro
%macro popargs 1-*
%rep %0
%ifdef PASCAL
%rotate -1
%endif
multipop %1
%ifdef STDCALL
%rotate 1
%endif
%endrep
%endmacro

View File

@ -31,7 +31,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *tail_hRcsId =
"$Id: tail.h 485 2002-12-09 00:17:15Z bartoldeman $";
"$Id$";
#endif
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************/
/* */
/* dtime.h */
/* time.h */
/* */
/* DOS General Time Structure */
/* */
@ -35,11 +35,11 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *time_hRcsId =
"$Id: time.h 942 2004-05-23 15:00:37Z bartoldeman $";
"$Id$";
#endif
#endif
typedef UWORD dtime;
typedef UWORD time;
struct dostime
{

View File

@ -26,26 +26,29 @@
/* Cambridge, MA 02139, USA. */
/****************************************************************/
/* The version the kernel reports as compatible with */
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *date_hRcsId =
"$Id$";
#endif
#endif
/* This Kernel is at a min Dos Ver. 5.00 or 7.10 with FAT32 support */
#ifdef WITHFAT32
#define MAJOR_RELEASE 7
#define MINOR_RELEASE 10
#else
#define MAJOR_RELEASE 6
#define MINOR_RELEASE 22
#define MAJOR_RELEASE 5
#define MINOR_RELEASE 00
#endif
/* The actual kernel revision, 2000+REVISION_SEQ = 2.REVISION_SEQ */
#define REVISION_SEQ 43 /* returned in BL by int 21 function 30 */
#define OEM_ID 0xfd /* FreeDOS, returned in BH by int 21 30 */
/* Used for version information displayed to user at boot (& stored in os_release string) */
#ifndef KERNEL_VERSION
#define KERNEL_VERSION "- GIT "
#endif
/* actual version string */
#define KVS(v,s,o) "FreeDOS kernel " v "(build 20" #s " OEM:" #o ") [compiled " __DATE__ "]\n"
#define xKVS(v,s,o) KVS(v,s,o)
#define KERNEL_VERSION_STRING xKVS(KERNEL_VERSION, REVISION_SEQ, OEM_ID)
#define REV_NUMBER 0
#define OEM_ID 0xfd /* FreeDos version */
#define REVISION_MAJOR 1
#define REVISION_MINOR 1
#define REVISION_SEQ 37
#define BUILD "2037"
#define SUB_BUILD "w-UNSTABLE" /* only use w=WorkInProgress for UNSTABLE branch */
#define KERNEL_VERSION_STRING "1.1.37w" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
#define KERNEL_BUILD_STRING "2037w-UNSTABLE" /*#BUILD SUB_BUILD */

View File

@ -14,16 +14,9 @@ struct WinStartupInfo
ULONG next; /* far pointer to next WinStartupInfo structure or NULL */
ULONG vddName; /* far pointer to ASCIIZ pathname of virtual device driver */
ULONG vddInfo; /* far pointer to vdd reference data or NULL if vddName=NULL */
ULONG instanceTable; /* far pointer to array of instance data */
ULONG optInstanceTable; /* used only if winver set to 0x400 (w95)*/
ULONG instanceTable; /* far pointer to array of instance data */
};
extern struct WinStartupInfo winStartupInfo;
#if defined __GNUC__
extern UWORD winseg1, winseg2, winseg3;
extern UBYTE markEndInstanceData;
extern struct lol FAR ASM DATASTART;
#endif
/* contains a list of offsets relative to DOS data segment of
various internal variables.

View File

@ -9,7 +9,7 @@
#ifdef MAIN
#ifdef VERSION_STRINGS
static BYTE *XStructs_hRcsId =
"$Id: xstructs.h 1457 2009-06-26 20:00:41Z bartoldeman $";
"$Id$";
#endif
#endif
@ -64,19 +64,20 @@ struct xdpbforformat {
} rebuilddpb;
struct {
DWORD new; /* new active FAT/mirroring state, or -1 to get
DWORD newmirroring; /* new active FAT/mirroring state, or -1 to get
bits 3-0: the 0-based FAT number of the active FAT
bits 6-4: reserved (0)
bit 7: do not mirror active FAT to inactive FATs
or:
set new root directory cluster, -1 - get current
*/
DWORD old; /* previous active FAT/mirroring state (as above)
or
get previous root directory cluster
*/
DWORD oldmirroring; /* previous active FAT/mirroring state (as above) */
UDWORD reserved[2];
} setget;
} setmirroring;
struct {
DWORD newrootclst; /* set new root directory cluster, -1 - get current */
DWORD oldrootclst; /* get previous root directory cluster */
UDWORD reserved[2];
} setroot;
} xdff_f;
};

View File

@ -24,7 +24,7 @@
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
;
; $Id: apisupt.asm 538 2003-03-12 22:43:53Z bartoldeman $
; $Id$
;
%include "segs.inc"

View File

@ -31,14 +31,9 @@
; 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 $
; $Id$
;
; for OW on Linux:
%ifdef owlinux
%define WATCOM
%endif
%ifdef WATCOM
%ifdef _INIT
%define WATCOM_INIT ; no seperate init segment for watcom.
@ -48,7 +43,6 @@
%ifndef WATCOM_INIT
%include "segs.inc"
%include "stacks.inc"
%ifdef _INIT
@ -135,10 +129,9 @@ pascal_setup:
cld
mov bl,6 ; majority (4) wants that
arg arg1, arg2, arg3
mov cx,[.arg3] ; majority (8) wants that (near and far)
mov si,[.arg2] ; majority (3) wants that (near)
mov di,[.arg1] ; majority (3) wants that (near)
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
@ -194,17 +187,14 @@ FMEMCPYBACK:
FMEMCPY:
call pascal_setup
arg {d,4}, {s,4}, n
; Get the repetition count, n preset above
%ifdef STDCALL
mov cx,[.n]
%endif
; mov cx,[bp+4]
; Get the far source pointer, s
lds si,[.s]
lds si,[bp+6]
; Get the far destination pointer d
les di,[.d]
les di,[bp+10]
mov bl,10
jmp short domemcpy
@ -217,17 +207,14 @@ arg {d,4}, {s,4}, n
FMEMSET:
call pascal_setup
arg {d,4}, ch, n
; Get the repetition count, n - preset above
%ifdef STDCALL
mov cx,[.n]
%endif
; mov cx,[bp+4]
; Get the fill byte ch
mov ax,[.ch]
mov ax,[bp+6]
; Get the far source pointer, s
les di,[.d]
les di,[bp+8]
mov bl,8
domemset:
@ -248,12 +235,11 @@ domemset:
MEMSET:
call pascal_setup
arg d, ch, n
; Get the repitition count, n - preset above
; mov cx,[bp+4]
; Get the char ch
mov ax, [.ch]
mov ax, [bp+6]
; Get the far source pointer, d - preset above
; mov di,[bp+8]
@ -286,20 +272,21 @@ pascal_return:
; fstrcpy (void FAR*dest, void FAR *src);
%ifndef _INIT
global FSTRCPY
FSTRCPY:
call pascal_setup
arg {dest,4}, {src,4}
; Get the source pointer, ss
lds si,[.src]
lds si,[bp+4]
; and the destination pointer, d
les di,[.dest]
les di,[bp+8]
mov bl,8
jmp short dostrcpy
%endif
;******
global STRCPY
@ -307,13 +294,11 @@ STRCPY:
call pascal_setup
%ifdef PASCAL
; Get the source pointer, ss
mov si,[bp+4]
; and the destination pointer, d
mov di,[bp+6]
%endif
mov bl,4
dostrcpy:
@ -327,6 +312,7 @@ strcpy_loop:
jmp short pascal_return
;******************************************************************
%ifndef _INIT
global FSTRLEN
FSTRLEN:
call pascal_setup
@ -336,15 +322,14 @@ FSTRLEN:
mov bl,4
jmp short dostrlen
%endif
;**********************************************
global STRLEN
STRLEN:
call pascal_setup
; Get the source pointer, ss
%ifdef PASCAL
mov di,[bp+4]
%endif
mov bl,2
dostrlen:
@ -366,11 +351,8 @@ STRCHR:
call pascal_setup
; Get the source pointer, ss
arg src, ch
%ifdef STDCALL ; preset above for PASCAL
mov cx,[.ch]
mov si,[.src]
%endif
; mov cx,[bp+4] - preset above
; mov si,[bp+6] - preset above
mov bl,4
strchr_loop:
@ -401,12 +383,11 @@ strchr_found1:
FSTRCHR:
call pascal_setup
arg {src,4}, ch
; Get ch (preset above)
;mov cx, [bp+4]
;and the source pointer, src
lds si, [.src]
lds si, [bp+6]
;mov bl, 6 - preset above
@ -417,17 +398,14 @@ arg {src,4}, ch
FMEMCHR:
call pascal_setup
arg {src,4}, ch, n
; Get the length - preset above
%ifdef STDCALL
mov cx, [.n]
%endif
; mov cx, [bp+4]
; and the search value
mov ax, [.ch]
mov ax, [bp+6]
; and the source pointer, ss
les di, [.src]
les di, [bp+8]
mov bl, 8
@ -443,24 +421,19 @@ arg {src,4}, ch, n
FSTRCMP:
call pascal_setup
arg {dest,4}, {src,4}
; Get the source pointer, ss
lds si,[.src]
lds si,[bp+4]
; and the destination pointer, d
les di,[.dest]
les di,[bp+8]
mov bl,8
%if 0
jmp short dostrcmp
;******
global STRCMP
STRCMP:
global _strcmp
_strcmp:
call pascal_setup
mov bl,4
; Get the source pointer, ss
; mov si,[bp+4]
@ -470,11 +443,9 @@ STRCMP:
xchg si,di
dostrcmp:
%endif
; replace strncmp(s1,s2)-->
; strncmp(s1,s2,0xffff)
mov cx,0xffff
%if 0
jmp short dostrncmp
@ -489,7 +460,6 @@ FSTRNCMP:
; and the destination pointer, d
les di,[bp+8]
mov cx,[bp+12]
mov bl,10
jmp short dostrncmp
@ -507,7 +477,6 @@ _strncmp:
xchg si,di
dostrncmp:
%endif
jcxz strncmp_retzero
strncmp_loop:
@ -525,17 +494,14 @@ strncmp_loop:
FMEMCMP:
call pascal_setup
arg {dest,4}, {src,4}, n
; the length - preset above
%ifdef STDCALL
mov cx, [.n]
%endif
; mov cx, [bp+4]
; Get the source pointer, ss
les di,[.src]
les di,[bp+6]
; and the destination pointer, d
lds si,[.dest]
lds si,[bp+10]
mov bl,10

View File

@ -33,7 +33,7 @@
#ifdef VERSION_STRINGS
static BYTE *blockioRcsId =
"$Id: blockio.c 1702 2012-02-04 08:46:16Z perditionc $";
"$Id$";
#endif
#define b_next(bp) ((struct buffer FAR *)(MK_FP(FP_SEG(bp), bp->b_next)))
@ -47,7 +47,7 @@ static BYTE *blockioRcsId =
/************************************************************************/
/* #define DISPLAY_GETBLOCK */
STATIC BOOL flush1(struct buffer FAR * bp);
STATIC VOID flush1(struct buffer FAR * bp);
/*
this searches the buffer list for the given disk/block.
@ -155,7 +155,7 @@ STATIC struct buffer FAR *searchblock(ULONG blkno, COUNT dsk)
return bp;
}
BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mode)
VOID DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mode)
{
struct buffer FAR *bp = firstbuf;
@ -176,8 +176,6 @@ BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mo
bp = b_next(bp);
}
while (FP_OFF(bp) != FP_OFF(firstbuf));
return FALSE;
}
#if TOM
@ -226,8 +224,7 @@ struct buffer FAR *getblk(ULONG blkno, COUNT dsk, BOOL overwrite)
/* available, and fill it with the desired block */
/* take the buffer that lbp points to and flush it, then read new block. */
if (!flush1(bp))
return NULL;
flush1(bp);
/* Fill the indicated disk buffer with the current track and sector */
@ -259,106 +256,77 @@ VOID setinvld(REG COUNT dsk)
while (FP_OFF(bp) != FP_OFF(firstbuf));
}
/* Check if there is at least one dirty buffer */
/* */
BOOL dirty_buffers(REG COUNT dsk)
{
struct buffer FAR *bp = firstbuf;
do
{
if (bp->b_unit == dsk &&
(bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
return TRUE;
bp = b_next(bp);
}
while (FP_OFF(bp) != FP_OFF(firstbuf));
return FALSE;
}
/* */
/* */
/* Flush all buffers for a disk */
/* */
/* returns: */
/* TRUE on success */
/* */
BOOL flush_buffers(REG COUNT dsk)
VOID flush_buffers(REG COUNT dsk)
{
struct buffer FAR *bp = firstbuf;
REG BOOL ok = TRUE;
bp = firstbuf;
do
{
if (bp->b_unit == dsk)
if (!flush1(bp))
ok = FALSE;
flush1(bp);
bp = b_next(bp);
}
while (FP_OFF(bp) != FP_OFF(firstbuf));
return ok;
}
/* */
/* Write one disk buffer */
/* */
STATIC BOOL flush1(struct buffer FAR * bp)
STATIC VOID flush1(struct buffer FAR * bp)
{
BOOL ok = TRUE;
/* All lines with changes on 9/4/00 by BER marked below */
UWORD result; /* BER 9/4/00 */
if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
{
#ifdef WITHFAT32
ULONG b_offset = 0;
#else
UWORD b_offset = 0;
#endif
UBYTE b_copies = 1;
ULONG blkno = bp->b_blkno;
/* BER 9/4/00 */
result = dskxfer(bp->b_unit, bp->b_blkno, bp->b_buffer, 1, DSKWRITE);
if (bp->b_flag & BFR_FAT)
{
b_copies = bp->b_copies;
b_offset = bp->b_offset;
UWORD b_copies = bp->b_copies;
ULONG blkno = bp->b_blkno;
#ifdef WITHFAT32
ULONG b_offset = bp->b_offset;
if (b_offset == 0) /* FAT32 FS */
b_offset = bp->b_dpbp->dpb_xfatsize;
#else
UWORD b_offset = bp->b_offset;
#endif
}
while (b_copies--)
{
if (dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE))
ok = FALSE;
blkno += b_offset;
while (--b_copies > 0)
{
blkno += b_offset;
/* BER 9/4/00 */
result = dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE);
}
}
}
else
result = 0; /* This negates any error code returned in result...BER */
/* and 0 returned, if no errors occurred - tom */
bp->b_flag &= ~BFR_DIRTY; /* even if error, mark not dirty */
if (!ok) /* otherwise system has trouble */
if (result != 0) /* otherwise system has trouble */
bp->b_flag &= ~BFR_VALID; /* continuing. */
return ok;
}
/* */
/* Write all disk buffers */
/* */
BOOL flush(void)
VOID flush(VOID)
{
REG struct buffer FAR *bp = firstbuf;
REG BOOL ok;
ok = TRUE;
do
{
if (!flush1(bp))
ok = FALSE;
flush1(bp);
bp->b_flag &= ~BFR_VALID;
bp = b_next(bp);
}
while (FP_OFF(bp) != FP_OFF(firstbuf));
network_redirector(REM_FLUSHALL);
return (ok);
}
/************************************************************************/
@ -436,10 +404,10 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
{
IoReqHdr.r_trans = deblock_buf;
if (mode == DSKWRITE)
fmemcpy(deblock_buf, buf, dpbp->dpb_secsize);
fmemcpy(deblock_buf, buf, SEC_SIZE);
execrh((request FAR *) & IoReqHdr, dpbp->dpb_device);
if (mode == DSKREAD)
fmemcpy(buf, deblock_buf, dpbp->dpb_secsize);
fmemcpy(buf, deblock_buf, SEC_SIZE);
}
else
{

View File

@ -33,7 +33,7 @@
#ifdef VERSION_STRINGS
static BYTE *RcsId =
"$Id: break.c 885 2004-04-14 15:40:51Z bartoldeman $";
"$Id$";
#endif
#define CB_FLG *(UBYTE FAR*)MK_FP(0x0, 0x471)
@ -53,13 +53,13 @@ unsigned char ctrl_break_pressed(void)
unsigned char check_handle_break(struct dhdr FAR **pdev)
{
unsigned char c = CTL_C;
if (!ctrl_break_pressed())
c = (unsigned char)ndread(&syscon);
if (c != CTL_C && *pdev != syscon)
c = (unsigned char)ndread(pdev);
if (c == CTL_C)
unsigned char c = 0;
if (ctrl_break_pressed() ||
(c = (unsigned char)ndread(&syscon)) == CTL_C ||
*pdev != syscon && (c = (unsigned char)ndread(pdev)) == CTL_C)
{
handle_break(pdev, -1);
}
return c;
}
@ -76,7 +76,7 @@ unsigned char check_handle_break(struct dhdr FAR **pdev)
void handle_break(struct dhdr FAR **pdev, int sft_out)
{
char *buf = "^C\r\n";
static char *buf = "^C\r\n";
CB_FLG &= ~CB_MSK; /* reset the ^Break flag */
con_flush(pdev);
@ -90,4 +90,3 @@ void handle_break(struct dhdr FAR **pdev, int sft_out)
spawn_int23(); /* invoke user INT-23 and never come back */
}

View File

@ -32,7 +32,7 @@
#ifdef VERSION_STRINGS
static BYTE *charioRcsId =
"$Id: chario.c 1413 2009-06-01 13:41:03Z bartoldeman $";
"$Id$";
#endif
#include "globals.h"
@ -73,7 +73,7 @@ long BinaryCharIO(struct dhdr FAR **pdev, size_t n, void FAR * bp,
CharReqHdr.r_count = n;
CharReqHdr.r_trans = bp;
err = CharRequest(pdev, command);
} while (err == 1);
} while (err > 0);
return err == SUCCESS ? (long)CharReqHdr.r_count : err;
}
@ -96,9 +96,7 @@ STATIC void CharCmd(struct dhdr FAR **pdev, unsigned command)
STATIC int Busy(struct dhdr FAR **pdev)
{
CharCmd(pdev, C_NDREAD);
if (CharReqHdr.r_status & S_ERROR)
CharCmd(pdev, C_ISTAT);
CharCmd(pdev, C_ISTAT);
return CharReqHdr.r_status & S_BUSY;
}
@ -140,42 +138,15 @@ int ndread(struct dhdr FAR **pdev)
/* OUTPUT FUNCTIONS */
#ifdef __WATCOMC__
void fast_put_char(char c);
#pragma aux fast_put_char = "int 29h" __parm[__al] __modify __exact [__bx]
#else
/* writes a character in raw mode using int29 for speed */
STATIC void fast_put_char(unsigned char chr)
{
#if defined(__TURBOC__)
_AL = chr;
__int__(0x29);
#elif defined(__GNUC__)
asm volatile("int $0x29":: "a"(chr):"bx");
#elif defined(I86)
asm
{
mov al, byte ptr chr;
int 0x29;
}
#endif
}
#endif
void update_scr_pos(unsigned char c, unsigned char count)
{
unsigned char scrpos = scr_pos;
if (c == CR)
scrpos = 0;
scr_pos = 0;
else if (c == BS) {
if (scrpos > 0)
scrpos--;
} else if (c != LF && c != BELL) {
scrpos += count;
}
scr_pos = scrpos;
if (scr_pos > 0)
scr_pos--;
} else if (c != LF && c != BELL)
scr_pos += count;
}
STATIC int raw_get_char(struct dhdr FAR **pdev, BOOL check_break);
@ -194,9 +165,6 @@ long cooked_write(struct dhdr FAR **pdev, size_t n, char FAR *bp)
if (c == CTL_Z)
break;
/* write a character in cooked mode; maybe with printer echo;
handles TAB expansion */
if (c == HT) {
count = 8 - (scr_pos & 7);
c = ' ';
@ -212,7 +180,7 @@ long cooked_write(struct dhdr FAR **pdev, size_t n, char FAR *bp)
if (PrinterEcho)
DosWrite(STDPRN, 1, &c);
if (fast_counter & 0x80)
fast_put_char(c);
put_console(c);
else
{
err = CharIO(pdev, c, C_OUTPUT);
@ -256,16 +224,15 @@ void write_char_stdout(int c)
#define iscntrl(c) ((unsigned char)(c) < ' ')
/* this is for handling things like ^C, mostly used in echoed input */
STATIC int echo_char(int c, int sft_idx)
STATIC VOID echo_char(int c, int sft_idx, unsigned i)
{
int out = c;
local_buffer[i] = c;
if (iscntrl(c) && c != HT && c != LF && c != CR)
{
write_char('^', sft_idx);
out += '@';
c += '@';
}
write_char(out, sft_idx);
return c;
write_char(c, sft_idx);
}
STATIC void destr_bs(int sft_idx)
@ -296,11 +263,11 @@ long cooked_read(struct dhdr FAR **pdev, size_t n, char FAR *bp)
return xfer;
}
STATIC unsigned read_char_sft_dev(int sft_in, int sft_out,
STATIC unsigned char read_char_sft_dev(int sft_in, int sft_out,
struct dhdr FAR **pdev,
BOOL check_break)
{
unsigned c;
unsigned char c;
if (*pdev)
{
@ -392,15 +359,13 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
write_char(CR, sft_out);
write_char(LF, sft_out);
}
break;
case CTL_F:
break;
case RIGHT:
case F1:
if (stored_pos < stored_size && count < size - 1)
local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out);
echo_char(kp->kb_buf[stored_pos++], sft_out, count++);
break;
case F2:
@ -426,7 +391,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
if (c != F4) /* not delete */
{
while (stored_pos < new_pos && count < size - 1)
local_buffer[count++] = echo_char(kp->kb_buf[stored_pos++], sft_out);
echo_char(kp->kb_buf[stored_pos++], sft_out, count++);
}
stored_pos = new_pos;
break;
@ -497,15 +462,12 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
/* fall through */
default:
if (c >= 256)
break;
if (count < size - 1 || c == CR)
local_buffer[count++] = echo_char(c, sft_out);
echo_char(c, sft_out, count++);
else
write_char(BELL, sft_out);
if (stored_pos < stored_size && !insert)
stored_pos++;
break;
}
first = FALSE;
} while (c != CR);
@ -532,7 +494,8 @@ size_t read_line_handle(int sft_idx, size_t n, char FAR * bp)
kb_buf.kb_size = LINEBUFSIZECON;
}
read_line(sft_idx, sft_idx, &kb_buf);
kb_buf.kb_buf[kb_buf.kb_count + 1] = echo_char(LF, sft_idx);
write_char(LF, sft_idx);
kb_buf.kb_buf[kb_buf.kb_count + 1] = LF;
inputptr = kb_buf.kb_buf;
if (*inputptr == CTL_Z)
{

File diff suppressed because it is too large Load Diff

View File

@ -29,17 +29,16 @@
struct config { /* Configuration variables */
UBYTE cfgDosDataUmb;
BYTE cfgBuffers; /* number of buffers in the system */
BYTE cfgBuffers; /* number of buffers in the system */
UBYTE cfgFiles; /* number of available files */
UBYTE cfgFilesHigh;
UBYTE cfgFcbs; /* number of available FCBs */
UBYTE cfgProtFcbs; /* number of protected FCBs */
BYTE *cfgInit; /* init of command.com */
BYTE *cfgInitTail; /* command.com's tail */
char cfgShell[256]; /* SHELL= line */
UBYTE cfgLastdrive; /* last drive */
UBYTE cfgLastdriveHigh;
BYTE cfgStacks; /* number of stacks */
BYTE cfgStacksHigh;
BYTE cfgStacks; /* number of stacks */
BYTE cfgStacksHigh;
UWORD cfgStackSize; /* stacks size for each stack */
UBYTE cfgP_0_startmode; /* load command.com high or not */
unsigned ebda2move; /* value for switches=/E:nnnn */

View File

@ -161,8 +161,6 @@ CommonNdRdExit: ; *** tell if key waiting and return its ASCII if yes
add ah,[cs:_kbdType]
int 16h ; Get status, if zf=0 al=char
jz ConNdRd4 ; Jump if no char available
or ax,ax ; Also check for ax=0 as apparently some
jz ConNdRd4 ; int16h handlers set ax=0 to indicate unsupported function
call checke0 ; check for e0 scancode
or ax,ax ; Zero ?
jnz ConNdRd1 ; Jump if not zero
@ -265,14 +263,9 @@ _int29_handler:
pop ax
iret
%IFDEF DEBUG_PRINT_COMPORT
%ifnum DEBUG_PRINT_COMPORT
%define DEBUG_USE_COMPORT DEBUG_PRINT_COMPORT
%else
%define DEBUG_USE_COMPORT 1 ; default to COM2 if not specified
%endif
.comprint:
push dx
mov dx, DEBUG_USE_COMPORT ; 0=COM1,1=COM2,2=COM3,3=COM4
mov dx, 1 ; 0=COM1,1=COM2,2=COM3,3=COM4
mov ah, [cs:ASYNC_NEED_INIT]
or ah,ah

4734
kernel/country.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,90 +0,0 @@
; File:
; cpu.asm
; Description:
; Query basic CPU running on
;
; DOS-C
; Copyright (c) 2012
; FreeDOS
; All Rights Reserved
;
; This file is part of DOS-C.
;
; DOS-C is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version
; 2, or (at your option) any later version.
;
; DOS-C is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
; the GNU General Public License for more details.
;
;
%include "segs.inc"
segment INIT_TEXT
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+
global _query_cpu
_query_cpu:
; save registers, assumes enough space on stack & valid stack frame setup
;push ax - no need to save, return value saved here
push bx
push cx
pushf ; save flags
; begin check, assume x86 unless later family detected
xor bx, bx ; 808x or 186 highest detected family stored in bx
push bx
popf ; try to clear all flag bits
pushf ; copy flags to ax so we can test if clear succeeded
pop ax
and ax, 0f000h
cmp ax, 0f000h
jnz is286 ; no the 4 msb stuck set to 1, so is a 808x or 8018x
; NEC V20/V30 support 186 instructions but
; do not mask the shift count like a 186.
; based on https://hg.pushbx.org/ecm/ldebug/file/7f3440d5824d/source/init.asm#l3071
; which is based on http://www.textfiles.com/hamradio/v20_bug.txt
mov ax, sp ; we use stack to do test
mov cx, 0 ; after pop still 0 if 8088/8086
push cx
inc cx ; after pop still 1 if NEC V20/V30
; next instructions may lock system if breakpoint or trace flag set
db 8Fh, 0C1h; pop r/m16 with operand cx on 808x, nop on NEC V20/V30
mov sp, ax ; reset stack to known good state (pre push, optional pop)
or cx, cx ; cx is 0 if 808x, 1 if NEC
jz is808x ; if not NEC then goto test for 808x vs 8018x
mov bx, cx ; treat NEC V20/V30 as 8018x, i.e. return 1
jmp short cleanup
is808x:
mov ax,1 ; determine if 8086 or 186
mov cl,64 ; try to shift further than size of ax
shr ax,cl
or ax,ax
jz is086 ; 186 ignores the upper bits of cl
mov bx, 1 ; 186: above 808x, below 286
is086: jmp short cleanup
is286: mov bx, 2 ; at least 286
mov ax, 0f000h
push ax
popf ; try to set 4 msb of flags
pushf ; copy flags to ax so we can test if clear succeeded
pop ax
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
pop cx
pop bx
retn

File diff suppressed because it is too large Load Diff

View File

@ -34,32 +34,17 @@ PSP_USERSS equ 30h
segment HMA_TEXT
global _DosIdle_int
global _DosIdle_hlt
extern _InDOS
extern _cu_psp
extern _MachineId
extern critical_sp
extern _user_r
; variables as the following are "part of" module inthndlr.c
; because of the define MAIN before include globals.h there!
extern _HaltCpuWhileIdle
extern _DGROUP_
extern _InDOS:wrt DGROUP
extern _cu_psp:wrt DGROUP
extern _MachineId:wrt DGROUP
extern critical_sp:wrt DGROUP
extern _user_r:wrt DGROUP
extern _DGROUP_:wrt HMA_TEXT
;
_DosIdle_hlt:
push ds
mov ds, [cs:_DGROUP_]
cmp byte [_HaltCpuWhileIdle],1
jb DosId0
pushf
sti
hlt ; save some energy :-)
popf
DosId0: pop ds
retn
;
_DosIdle_int:
call _DosIdle_hlt
push ds
mov ds, [cs:_DGROUP_]
cmp byte [_InDOS],1
@ -91,6 +76,3 @@ Do_DosI:
pop ax
ret
; segment _DATA ; belongs to DGROUP
; whatever db whatever

128
kernel/dosnames.c Normal file
View File

@ -0,0 +1,128 @@
/****************************************************************/
/* */
/* dosnames.c */
/* DOS-C */
/* */
/* Generic parsing functions for file name specifications */
/* */
/* Copyright (c) 1994 */
/* Pasquale J. Villani */
/* All Rights Reserved */
/* */
/* This file is part of DOS-C. */
/* */
/* DOS-C is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version */
/* 2, or (at your option) any later version. */
/* */
/* DOS-C is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
/* the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public */
/* License along with DOS-C; see the file COPYING. If not, */
/* write to the Free Software Foundation, 675 Mass Ave, */
/* Cambridge, MA 02139, USA. */
/* */
/****************************************************************/
#include "portab.h"
#ifdef VERSION_STRINGS
static BYTE *dosnamesRcsId =
"$Id$";
#endif
#include "globals.h"
const char _DirWildNameChars[] = "*?./\\\"[]:|<>+=;,";
STATIC BOOL charOK(const char *s, const char c)
{
return (UBYTE)c >= ' ' && !strchr(s, c);
}
/*
MSD durring an FindFirst search string looks like this;
(*), & (.) == Current directory *.*
(\) == Root directory *.*
(..) == Back one directory *.*
This always has a "truename" as input, so we may do some shortcuts
returns number of characters in the directory component (up to the
last backslash, including d:) or negative if error
*/
int ParseDosName(const char *filename, char *fcbname, BOOL bAllowWildcards)
{
int nDirCnt, nFileCnt, nExtCnt;
const char *lpszLclDir, *lpszLclFile, *lpszLclExt;
/* Initialize the users data fields */
nDirCnt = nFileCnt = nExtCnt = 0;
/* NB: this code assumes ASCII */
/* Now see how long a directory component we have. */
lpszLclDir = lpszLclFile = filename;
filename += 2;
while (charOK(_DirWildNameChars + 5, *filename))
if (*filename++ == '\\')
lpszLclFile = filename;
nDirCnt = lpszLclFile - lpszLclDir;
/* Parse out the file name portion. */
filename = lpszLclFile;
while (charOK(bAllowWildcards ? _DirWildNameChars + 2
: _DirWildNameChars, *filename))
{
++nFileCnt;
++filename;
}
if (nFileCnt == 0)
{
if (bAllowWildcards && *filename == '\0' &&
(nDirCnt == 3 || filename[-1] != '\\'))
/* D:\ or D:\DOS but not D:\DOS\ */
return DE_NFILES;
return DE_PATHNOTFND;
}
/* Now we have pointers set to the directory portion and the */
/* file portion. Now determine the existance of an extension. */
lpszLclExt = filename;
if ('.' == *filename)
{
lpszLclExt = ++filename;
while (*filename)
{
if (charOK(bAllowWildcards ? _DirWildNameChars + 2
: _DirWildNameChars, *filename))
{
++nExtCnt;
++filename;
}
else
{
return DE_FILENOTFND;
}
}
}
else if (*filename)
return DE_FILENOTFND;
/* Finally copy whatever the user wants extracted to the user's */
/* buffers. */
memset(fcbname, ' ', FNAME_SIZE + FEXT_SIZE);
memcpy(fcbname, lpszLclFile, nFileCnt);
memcpy(&fcbname[FNAME_SIZE], lpszLclExt, nExtCnt);
/* Clean up before leaving */
return nDirCnt;
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,13 @@
moveable and Dyn.Buffer resizable, but not before
*/
#ifdef DEBUG
void far *DynAlloc(char *what, unsigned num, unsigned size);
#else
void far *_DynAlloc(unsigned num, unsigned size);
#define DynAlloc(what, num, size) (_DynAlloc((num), (size)))
#endif
void far *DynLast(void);
void DynFree(void *ptr);

View File

@ -19,7 +19,7 @@ additionally:
02610H 0F40EH 0CDFFH HMA_TEXT HMA
FCBs, f_nodes, buffers,...
FCB's, f_nodes, buffers,...
drivers
@ -38,31 +38,27 @@ additionally:
#include "portab.h"
#include "init-mod.h"
#include "dyndata.h"
#if defined(DEBUG)
#define DebugPrintf(x) printf x
#else
#define DebugPrintf(x)
#endif
#include "debug.h"
/*extern struct DynS FAR Dyn;*/
#ifndef __TURBOC__
#include "init-dat.h"
extern struct DynS DOSFAR ASM Dyn;
#else
extern struct DynS FAR ASM Dyn;
#endif
#ifdef DEBUG
void far *DynAlloc(char *what, unsigned num, unsigned size)
#else
void far *_DynAlloc(unsigned num, unsigned size)
#endif
{
void far *now;
unsigned total = num * size;
struct DynS far *Dynp = MK_FP(FP_SEG(LoL), FP_OFF(&Dyn));
#ifndef DEBUG
UNREFERENCED_PARAMETER(what);
#endif
if ((ULONG) total + Dynp->Allocated > 0xffff)
{
printf("PANIC:Dyn %lu\n", (ULONG) total + Dynp->Allocated);
@ -81,11 +77,13 @@ void far *DynAlloc(char *what, unsigned num, unsigned size)
return now;
}
/*
void DynFree(void *ptr)
{
struct DynS far *Dynp = MK_FP(FP_SEG(LoL), FP_OFF(&Dyn));
Dynp->Allocated = (char *)ptr - (char *)Dynp->Buffer;
}
*/
void FAR * DynLast()
{

View File

@ -25,35 +25,32 @@
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
;
; $Id: entry.asm 1701 2012-01-16 22:06:21Z perditionc $
; $Id$
;
%include "segs.inc"
%include "segs.inc"
%include "stacks.inc"
segment HMA_TEXT
segment HMA_TEXT
extern _int21_syscall
extern _int21_service
extern _int2526_handler
extern _error_tos
extern _char_api_tos
extern _disk_api_tos
extern _user_r
extern _ErrorMode
extern _InDOS
%IFDEF WIN31SUPPORT
extern _winInstanced
%ENDIF ; WIN31SUPPORT
extern _cu_psp
extern _MachineId
extern critical_sp
extern _error_tos:wrt DGROUP
extern _char_api_tos:wrt DGROUP
extern _disk_api_tos:wrt DGROUP
extern _user_r:wrt DGROUP
extern _ErrorMode:wrt DGROUP
extern _InDOS:wrt DGROUP
extern _cu_psp:wrt DGROUP
extern _MachineId:wrt DGROUP
extern critical_sp:wrt DGROUP
extern int21regs_seg
extern int21regs_off
extern int21regs_seg:wrt DGROUP
extern int21regs_off:wrt DGROUP
extern _Int21AX
extern _Int21AX:wrt DGROUP
extern _DGROUP_
extern _DGROUP_
global reloc_call_cpm_entry
global reloc_call_int20_handler
@ -68,17 +65,9 @@ segment HMA_TEXT
; VOID FAR
; cpm_entry(iregs UserRegs)
;
; For CP/M compatibility allow a program to invoke any DOS API function
; between 0 and 24h by doing a near call to psp:0005h which embeds a far call
; to absolute address 0:00C0h (int vector 30h & 31h) or FFFF:00D0 (hma).
; 0:00C0h contains the jmp instruction to reloc_call_cpm_entry which should
; be duplicated in hma to ensure correct operation with either state of A20 line.
; Note: int 31h is also used for DPMI but only in protected mode.
; Upon entry the stack has a near return offset (desired return address offset)
; and far return seg:offset (desired return segment of PSP, and useless offset
; which if used will return to the data, not code, at offset 0ah after far call
; in psp). We convert it to a normal call and correct the stack to appear same
; as if invoked via an int 21h call including proper return address.
; This one is a strange one. The call is to psp:0005h but it returns to the
; function after the call. What we do is convert it to a normal call and
; fudge the stack to look like an int 21h call.
;
reloc_call_cpm_entry:
; Stack is:
@ -86,7 +75,10 @@ reloc_call_cpm_entry:
; psp seg
; 000ah
;
add sp, byte 2 ; remove unneeded far return offset 0ah
push bp ; trash old return address
mov bp,sp
xchg bp,[2+bp]
pop bp
pushf ; start setting up int 21h stack
;
; now stack is
@ -115,43 +107,43 @@ reloc_call_cpm_entry:
; psp seg (alias .COM cs)
; return offset
;
cmp cl,024h ; restrict calls to functions 0-24h
ja cpm_error
cmp cl,024h
jbe cpm_error
mov ah,cl ; get the call # from cl to ah
jmp reloc_call_int21_handler ; do the system call
cpm_error: mov al,0
iret ; cleanup stack and return to caller
iret
;
; interrupt zero divide handler:
; print a message 'Interrupt divide by zero'
; print a message 'Divide error'
; Terminate the current process
;
; VOID INRPT far
; int20_handler(iregs UserRegs)
;
print_hex: mov cl, 12
print_hex: mov cl, 12
hex_loop:
mov ax, dx
shr ax, cl
and al, 0fh
cmp al, 10
sbb al, 69h
das
mov bx, 0070h
mov ah, 0eh
int 10h
sub cl, 4
jae hex_loop
ret
mov ax, dx
shr ax, cl
and al, 0fh
cmp al, 10
sbb al, 69h
das
mov bx, 0070h
mov ah, 0eh
int 10h
sub cl, 4
jae hex_loop
ret
divide_by_zero_message db 0dh,0ah,'Interrupt divide by zero, stack:',0dh,0ah,0
divide_error_message db 0dh,0ah,'Divide error, stack:',0dh,0ah,0
global reloc_call_int0_handler
reloc_call_int0_handler:
mov si,divide_by_zero_message
mov si,divide_error_message
zero_message_loop:
mov al, [cs:si]
@ -167,27 +159,27 @@ zero_message_loop:
jmp short zero_message_loop
zero_done:
mov bp, sp
xor si, si ; print 13 words of stack for debugging LUDIV etc.
stack_loop:
mov bp, sp
xor si, si ; print 13 words of stack for debugging LUDIV etc.
stack_loop:
mov dx, [bp+si]
call print_hex
mov al, ' '
int 10h
inc si
inc si
cmp si, byte 13*2
jb stack_loop
mov al, 0dh
int 10h
mov al, 0ah
int 10h
call print_hex
mov al, ' '
int 10h
inc si
inc si
cmp si, 13*2
jb stack_loop
mov al, 0dh
int 10h
mov al, 0ah
int 10h
mov ax,04c7fh ; terminate with errorlevel 127
int 21h
sti
thats_it: hlt
jmp short thats_it ; it might be command.com that nukes
sti
thats_it: hlt
jmp short thats_it ; it might be command.com that nukes
invalid_opcode_message db 0dh,0ah,'Invalid Opcode at ',0
@ -197,31 +189,6 @@ reloc_call_int6_handler:
mov si,invalid_opcode_message
jmp short zero_message_loop
global reloc_call_int19_handler
reloc_call_int19_handler:
; from Japheth's public domain code (JEMFBHLP.ASM)
; restores int 10,13,15,19,1b and then calls the original int 19.
cld
xor ax,ax
mov es,ax
mov al,70h
mov ds,ax
mov si,100h
mov cx,5
cli
nextitem: lodsb
mov di,ax
%if XCPU >= 186
shl di,2
%else
shl di,1
shl di,1
%endif
movsw
movsw
loop nextitem
int 19h
;
; Terminate the current process
;
@ -239,10 +206,35 @@ reloc_call_int20_handler:
; int21_handler(iregs UserRegs)
;
reloc_call_int21_handler:
cmp ah,25h
je int21_func25
cmp ah,35h
je int21_func35
;%define OEMHANDLER ; enable OEM hook, mostly OEM DOS 2.x, maybe through OEM 6.x
%ifdef OEMHANDLER
extern _OemHook21
; When defined and set (!= ffff:ffffh) invoke installed
; int 21h handler for ah=f9h through ffh
; with all registers preserved, callee must perform the iret
cmp ah, 0f9h ; if a normal int21 call, proceed
jb skip_oemhndlr ; as quickly as possible
; we need all registers preserved but also
; access to the hook address, so we copy locally
; 1st (while performing check for valid address)
; then do the jmp
push ds
push dx
mov dx,[cs:_DGROUP_]
mov ds,dx
cmp word [_OemHook21], -1
je no_oemhndlr
cmp word [_OemHook21+2], -1
je no_oemhndlr
pop dx
pop ds
jmp far [ds:_OemHook21] ; invoke OEM handler (no return)
;local_hookaddr dd 0
no_oemhndlr:
pop dx
pop ds
skip_oemhndlr:
%endif ;OEMHANDLER
;
; Create the stack frame for C call. This is done to
; preserve machine state and provide a C structure for
@ -258,6 +250,7 @@ reloc_call_int21_handler:
sti
PUSH$ALL
mov bp,sp
Protect386Registers
;
; Create kernel reference frame.
;
@ -265,12 +258,15 @@ reloc_call_int21_handler:
; until later when which stack to run on is determined.
;
int21_reentry:
Protect386Registers
mov dx,[cs:_DGROUP_]
mov ds,dx
cmp ah,25h
je int21_user
cmp ah,33h
je int21_user
cmp ah,35h
je int21_user
cmp ah,50h
je int21_user
cmp ah,51h
@ -279,8 +275,8 @@ int21_reentry:
jne int21_1
int21_user:
%IFNDEF WIN31SUPPORT
call end_dos_crit_sect
%IFNDEF WIN31SUPPORT ; begin critical section
call dos_crit_sect
%ENDIF ; NOT WIN31SUPPORT
push ss
@ -290,29 +286,6 @@ int21_user:
pop cx
jmp short int21_ret
int21_func25:
push es
push bx
xor bx,bx
mov es,bx
mov bl,al
shl bx,1
shl bx,1
mov [es:bx],dx
mov [es:bx+2],ds
pop bx
pop es
iret
int21_func35:
xor bx,bx
mov es,bx
mov bl,al
shl bx,1
shl bx,1
les bx,[es:bx]
iret
;
; normal entry, use one of our 4 stacks
;
@ -332,7 +305,7 @@ int21_1:
; I don't know who needs that, but ... (TE)
;
mov word [_user_r+2],ss
mov word [_user_r],bp ; store and init
mov word [_user_r],bp ; store and init
;
; Decide which stack to run on.
@ -371,7 +344,10 @@ int21_2:
%IFDEF WIN31SUPPORT ; begin critical section
; should be called as needed, but we just
; mark the whole int21 api as critical
call begin_dos_crit_sect
push ax
mov ax, 8001h ; Enter Critical Section
int 2ah
pop ax
%ENDIF ; WIN31SUPPORT
inc byte [_InDOS]
mov cx,_char_api_tos
@ -385,8 +361,8 @@ int21_2:
jbe int21_normalentry
int21_3:
%IFNDEF WIN31SUPPORT
call end_dos_crit_sect
%IFNDEF WIN31SUPPORT ; begin critical section
call dos_crit_sect
%ENDIF ; NOT WIN31SUPPORT
mov cx,_disk_api_tos
@ -407,9 +383,11 @@ int21_normalentry:
call _int21_service
int21_exit: dec byte [_InDOS]
%IFDEF WIN31SUPPORT
call end_dos_crit_sect ; release all critical sections
%IFDEF WIN31SUPPORT ; end critical section
call dos_crit_sect ; release all critical sections
%if 0
; should be called as needed, but we just
; mark the whole int21 api as critical
push ax
mov ax, 8101h ; Leave Critical Section
int 2ah
@ -427,42 +405,31 @@ int21_exit_nodec:
pop bp ; get back user stack
pop si
global _int21_iret
_int21_iret:
%if XCPU >= 386
%ifdef WATCOM
sub bp, 4 ; for fs and gs only
%else
sub bp, 6 ; high parts of eax, ebx or ecx, edx
%endif
%endif
cli
mov ss,si
RestoreSP
mov sp,bp
int21_ret:
Restore386Registers
POP$ALL
POP$ALL
;
; ... and return.
;
iret
%IFDEF WIN31SUPPORT
;
; begin DOS Critical Section 1
;
;
begin_dos_crit_sect:
; we only enable critical sections if Windows is active
; we currently use winInstanced, but may need to use separate patchable location
cmp word [_winInstanced], 0
jz skip_crit_sect
push ax
mov ax, 8001h ; Enter Critical Section
int 2ah
pop ax
skip_crit_sect:
ret
%ENDIF ; WIN31SUPPORT
;
; end Dos Critical Section 0 thur 7
;
;
end_dos_crit_sect:
dos_crit_sect:
mov [_Int21AX],ax ; needed!
push ax ; This must be here!!!
mov ah,82h ; re-enrty sake before disk stack
@ -531,8 +498,8 @@ int2526:
Protect386Registers
push dx
push cx ; save user stack
push dx
push cx ; save user stack
push dx ; SS:SP -> user stack
push cx
@ -540,8 +507,8 @@ int2526:
call _int2526_handler
add sp, byte 6
pop cx
pop dx ; restore user stack
pop cx
pop dx ; restore user stack
Restore386Registers
@ -614,11 +581,10 @@ CritErr05:
mov al,byte [bp+6] ; nDrive
mov di,word [bp+8] ; nError
;
; make cx:si point to dev header
; after registers restored use bp:si
; make bp:si point to dev header
;
mov si,word [bp+10] ; lpDevice Offset
mov cx,word [bp+12] ; lpDevice segment
mov bp,word [bp+12] ; lpDevice segment
;
; Now save real ss:sp and retry info in internal stack
;
@ -641,10 +607,7 @@ CritErr05:
; switch to user's stack
;
mov ss,[es:PSP_USERSS]
mov bp,[es:PSP_USERSP]
RestoreSP
Restore386Registers
mov bp,cx
mov sp,[es:PSP_USERSP]
;
; and call critical error handler
;

View File

@ -30,7 +30,7 @@
#ifdef VERSION_STRINGS
static BYTE *errorRcsId =
"$Id: error.c 709 2003-09-24 19:34:11Z bartoldeman $";
"$Id$";
#endif
#include "globals.h"

View File

@ -25,11 +25,10 @@
; write to the Free Software Foundation, 675 Mass Ave,
; Cambridge, MA 02139, USA.
;
; $Id: execrh.asm 1184 2006-05-20 20:49:59Z mceric $
; $Id$
;
%include "segs.inc"
%include "stacks.inc"
segment HMA_TEXT
; EXECRH
@ -51,29 +50,25 @@ segment HMA_TEXT
push si
push ds ; sp=bp-8
arg {rhp,4}, {dhp,4}
lds si,[.dhp] ; ds:si = device header
les bx,[.rhp] ; es:bx = request header
lds si,[bp+4] ; ds:si = device header
les bx,[bp+8] ; es:bx = request header
mov ax, [si+6] ; construct strategy address
mov [.dhp], ax
mov [bp+4], ax
push si ; the bloody fucking RTSND.DOS
push di ; driver destroys SI,DI (tom 14.2.03)
call far[.dhp] ; call far the strategy
call far[bp+4] ; call far the strategy
pop di
pop si
; Protect386Registers ; old free-EMM386 versions destroy regs in their INIT method
mov ax,[si+8] ; construct 'interrupt' address
mov [.dhp],ax ; construct interrupt address
call far[.dhp] ; call far the interrupt
; Restore386Registers ; less stack load and better performance...
mov ax,[si+8] ; construct 'interrupt' address
mov [bp+4],ax ; construct interrupt address
call far[bp+4] ; call far the interrupt
sti ; damm driver turn off ints
cld ; has gone backwards

Some files were not shown because too many files have changed in this diff Show More