Commit Graph

174 Commits

Author SHA1 Message Date
Bernd Wilhelm Böckmann
1ce349ef26 fixes #148 2024-05-16 18:01:06 -04:00
Bernd Boeckmann
c08313ab62 fix issue #144 by correcting getbpb return code
getbpb now returns 0 instead of S_DONE in case of an uninitialized
partition, copying the default BPB into the BPB.

The previous return of S_DONE in case of uninitialized partitions
resulted in rp->r_bpptr not getting set in bldbpb. This in
combination with indicating success resulted in garbage returned
via rp->r_bpptr.

The DPB values are now being set to the default BPB ones in media_check
ea951d8136/kernel/fatfs.c (L1728)
via call to bpb_to_dpb in case of an uninitialized partition.
This may have side effects. But because DF_NOACCESS is still set, I
think it is the right way to do it.

The commit also masks high bit of AL for INT25/26 containing the drive
number. Some programs may set the bit according to RBIL:

"examination of CPWIN386.CPL indicates that if this call fails with
error 0408h on an old-style (<32M) call, one should retry the
call with the high bit of the drive number in AL set"

Leaving the bit set may render the given drive number unusable.
It should do no harm to mask it to increase the chance of the operation
to succeed. Also, the AH should be set to zero, because drive is given
only in AL.
2024-03-05 16:35:31 -05:00
Andrew Bird
6092afc74d Build: Country submodule now has production target
When country was converted to a submodule (by me) the production
installation target was hacked onto the kernel subdirectory Makefile
which wasn't ideal. Introduce a production target into the country
Makefile that does the installation. Since we want the submodule to be
buildable standalone, we can't include the variable definitions from the
upper level, such as $(DIRSEP) and $(CP), so the caller has to pass those
in at build time if using the production target.

Tested on Linux (GCC + Watcom) and DOS (Watcom)
2024-02-24 17:38:14 +00:00
Kenneth J Davis
edd0732433
move FAR item to own line 2024-02-11 08:59:32 -05:00
Kenneth J Davis
a593799eb0
add some comments regarding relocation of kernel during configuration 2024-02-10 17:38:19 -05:00
Kenneth J Davis
114236da17
allow selection of COM port for debug prints easily overridden during compile, e.g. build.bat /D DEBUG_PRINT_COMPORT /V 2 2024-02-10 17:36:33 -05:00
Kenneth J Davis
716f732e3a
rework to make handling flags simpler, from ecm 2024-02-10 17:34:00 -05:00
Kenneth J Davis
7a73120228
copy over debug print to COM ports from UNSTABLE branch 2024-02-10 17:27:23 -05:00
Kenneth J Davis
795c1df742
prevent possible hang on loading device driver, from ecm 2024-02-08 19:24:55 -05:00
Kenneth J Davis
6a94489230
handle wmake and gmake differences
wmake requires changing into directory as ignores -C option, gmake ignores cd into directory so requires -C subdir option
2024-02-06 18:26:26 -05:00
Kenneth J Davis
19c35ee574
use tab not spaces for Makefile 2024-02-06 16:36:15 -05:00
Bocke
9b6a8579d1 Make build work on DOS
Double ampersands are not supported by DOS command line interpreters. The previous would work only on (modern-ish) Windows.
2024-02-05 10:47:59 -05:00
Bernd Boeckmann
093dea9a7b initdisk.c: format specifier fixes 2 2024-02-04 20:44:19 -05:00
Kenneth J Davis
4ffc5c10a5 fix bug#121 don't look for 123? unless still looking for verb at start of line
allows correctly parsing lines like SHELL=4DOS.COM which otherwise strips 4 leading to looking for shell of "DOS.COM"
2024-02-04 20:37:43 -05:00
Kenneth J Davis
f7bf549544 correct xor to test not clear value, invert test so 808x is 0 and NEC is 1 matching returned value 2024-02-04 19:43:09 -05:00
Kenneth J Davis
07155e6184 fix bug#123, detect NEC V20/V30 as 186 instead of only 8086/8088, based on ecm-pushbx ldebug
see https://hg.pushbx.org/ecm/ldebug/file/7f3440d5824d/source/init.asm#l3071

(cherry picked from commit 5fdcc1d214b821fde33a5bd92ea7d7c0134a2056)
2024-02-04 19:43:09 -05:00
Kenneth J Davis
431be02b0a rework update_dcb() to avoid potential access uninitialized memory 2024-02-03 22:00:17 -05:00
C. Masloch
1c2f541689 intr: avoid random trace in (init_)call_intr 2024-02-03 21:04:11 -05:00
C. Masloch
3ef6d61609 main: fix, only init env once in PSPInit, do not set cmdline tail 2024-02-03 21:01:17 -05:00
C. Masloch
ab3cac6d0c allow gcc build to succeed with -DWIN31SUPPORT 2024-02-03 20:59:11 -05:00
Bernd Boeckmann
9a7d22701d initdisk.c: fix wrong printf format specifiers, fixes #122 2024-02-03 20:52:42 -05:00
Kenneth J Davis
db71b1a783
don't normally show InitDisk while booting 2023-12-20 17:17:08 -05:00
Kenneth J Davis
de96d00402
additional comments about LBA detection 2023-12-20 00:35:01 -05:00
Bernd Boeckmann
cab32344bb only use AH for EDD version detection, as AL is reserved...
...according to the spec
2023-12-19 23:50:02 -05:00
Bernd Boeckmann
a5431d9245 remove BIOS assisted LBA translation, not sure its worth including it 2023-12-19 23:50:02 -05:00
Bernd Boeckmann
b33afdbfad change handling of head count < 2, was a no-op since last commit...
... because heads was always at least 1.
2023-12-19 23:50:02 -05:00
Bernd Boeckmann
c20a97e844 initdisk: actually restrict disk size to 2TB, fix ExtLBAForce usage 2023-12-19 23:50:02 -05:00
Kenneth J Davis
569337a7ef
fix bug# 98 (correct bad CONFIG value 19 with bad value 14, should be 6) and add support for additional CONFIG options Verbose and PartitionMode to sys CONFIG processing 2023-12-19 19:50:22 -05:00
Kenneth J Davis
2e849b36c1
update copyright string to 2023 2023-12-18 20:23:04 -05:00
Kenneth J Davis
7b0633b26b
only print messages once, not each time processing partitions; use LBA if forceLBA enabled in additional cases where LBA support not detected 2023-12-18 18:37:19 -05:00
Kenneth J Davis
4b0162c2a6
default to normal not quiet for initial messages 2023-12-18 18:31:20 -05:00
Kenneth J Davis
cfdd09963f
fix from boeckmann (Bernd Böckmann) for Format GitHub issue #1 - format divide by 0 due to kernel function 440D, subfunction 60 returning a zero for logical_sectors_per_fat as initdisk overflows and calculates incorrect value 2023-12-17 21:01:37 -05:00
Kenneth J Davis
f1249dcd6f
From bzt, initialize drive parameter head & sector values to avoid potential divisions by 0 2023-12-08 21:20:46 -05:00
Kenneth J Davis
5880d36ba9
add ability to adjust verboseness of messages during booting 2023-12-08 18:08:11 -05:00
C. Masloch
95694f7e34 config: delete variable only if it makes enough space to write new 2023-08-30 06:59:41 -04:00
C. Masloch
6101fb2aed config: pass searchvar result to deletevar 2023-08-30 06:59:41 -04:00
C. Masloch
24d19cd05c config: allow to delete variable with empty SET command 2023-08-30 06:59:41 -04:00
C. Masloch
3dafa54e8b config: delete existing variable before writing new contents 2023-08-30 06:59:41 -04:00
C. Masloch
132a0a9f94 truename: fix array overrun (pick from fdpp)
Picked from the commit at fe1c4dc7fe

The referenced issue is at https://github.com/dosemu2/fdpp/issues/212

The patch was applied using unix2dos on the patch file
then `patch -p1 --binary` with the patch file as stdin.
The original used a new define for the maximum path length.
As there is no difference to our current SFTMAX define I
changed this hunk to retain the SFTMAX use.

This fixes a bug when eg function 3Dh receives a buffer
that starts with ".\" but the byte in memory before this
buffer happens to be also a dot. I ran into this problem
semi-randomly during building EDR-DOS with the most recent
WarpLink build. If WarpLink was placed somewhat low in the
Low Memory Area then one of its function 3Dh calls would
happen to have a dot before the pathname buffer. (I had to
load lCDebug using the last fit strategy then enter TSR mode,
to catch the bug without the presence of the debugger working
around the occurrence of the bug.)

Original commit Metadata:

From: Stas Sergeev <stsp@users.sourceforge.net>
Date: Wed, 1 Feb 2023 13:01:55 +0500
Subject: [PATCH] truename: fix array overrun [fixes #212]

src[-2] was peeking into a random memory location.
It seems entire truename() is written by some morons... :(
Its completely unreadable and full of bugs.
2023-08-26 21:32:19 -04:00
C. Masloch
29ccb6e454 main: insure master environment starts out empty 2023-07-03 07:37:00 -04:00
C. Masloch
a0549a395e config: make sure word marker trailing in environment is zero 2023-07-03 07:37:00 -04:00
C. Masloch
3d1ba0d486 config: build master environment during FDCONFIG.SYS processing
lDebug wants to access the environment while executing
as a device driver. Instead of building it in a variable
then copying it to 68h:0 after FDCONFIG.SYS processing,
just build it there to begin with.
2023-07-03 07:37:00 -04:00
Andrew Bird
afe7fbe068 inthndlr: align hma size to para
Based on a patch https://github.com/dosemu2/fdpp/commit/e7fe81d458
for FDDP by @stsp

[fixes #101]
2023-04-13 18:05:24 -04:00
Andrew Bird
fa3dc59367 DosGetExtFree: Use new redirector function 11a3
To be able to return free space on larger non local disks, the redirector
needs an extension. Dosemu2 has implemented this function and FDPP
has an almost identical patch to this. If the extension is not
implemented by your chosen redirector, then fallback to the standard
110c function is done for int21/7303.

With this patch up to 2TB (with Dosemu2 reporting in 512 blocks) can be
displayed.
2023-03-21 20:54:17 -04:00
C. Masloch
28cd58688a fatfs.c: allow bpbSectorsPerCluster == 0 to mean 256
This should be compatible to Enhanced DR-DOS.

Tested by building a boot image like the following:

nasm ../ldosmbr/oldmbr.asm -o oldmbr.bin
nasm ../ldosboot/boot.asm -D_FAT16=1 -I ../lmacros/ \
 -D_LOAD_NAME="'LDEBUG'" -o boot16.bin
nasm bootimg.asm -I ../lmacros/ -o disk16.img \
 -D_MBR -D_ALIGNDATA -D_BOOTPATCHFILE=boot16.bin \
 -D_MBRPATCHFILE=oldmbr.bin -D_BPE=16 \
 -D_SPI='(_SPC * 5000)' -D_NUMROOT=512 -D_SPC=256 \
 -D_SPF='((_SPI / _SPC + 255) / 256)' \
 -D_PAYLOADFILE=../ldebug/bin/ldebug.com,quit.com,\
::rename,../k256spc/bin/kernel.sys,kernel.sys,\
command.com,::fill,1,32,autoexec.bat

The repos bootimg, ldosboot, ldosmbr, and lmacros are
available at https://hg.pushbx.org/ecm/

The file ldebug.com is a recent bootable lDebug debugger.
The file command.com is a recent FreeCOM. The file quit.com
is assembled with NASM from
https://hg.pushbx.org/ecm/ldebug/file/e6035c05670a/misc/quit.asm

Run like this:

qemu-system-i386 -hda disk16.img -boot order=c -display curses

To the lDebug prompt "-" enter "boot protocol freedos",
then a "q" command. On success, the quit.com command
can be run to quit the qemu VM.

Not yet done:

- initdisk.c:512 uses MAXCLUSTSIZE defined to 128. This is
not difficult to change but it is unclear whether this
should be changed.

- The boot loaders are not yet adjuscted, requiring use of
the ldosboot or lDebug loaders instead.

- A patch for FORMAT (copylefted) version 0.91u is available
from the Enhanced DR-DOS project. Mirrored in the directory at
https://pushbx.org/ecm/download/edrdos/freedos/
This should be easy enough to update to the most recent version.
2023-01-04 19:38:57 -05:00
Kenneth J Davis
e1b22c7035
update comments
(from Geoff Chappell blog and RBIL)
2022-10-24 20:19:32 -04:00
Kenneth J Davis
6f6e44e1b5
fix OW warning W115 in config.c 2022-10-24 18:08:27 -04:00
Kenneth J Davis
af52b0c8c3
fix OW warning W115 in dsk.c 2022-10-24 18:01:50 -04:00
tkchia
7149a8efe4 FCB (int 21h func 29h): should not accept field separator as "drive letter" 2022-07-16 07:20:24 -04:00
tkchia
031f17068a FCB (int 21h func 29h): should keep parsing name even if drive letter invalid 2022-07-15 09:45:10 -04:00