[Freedos-kernel] Tom's kernel changes vs. CVS

2007-05-15 Thread Bart Oldeman
Hi,

I've put on some effort in merging Tom's changes into the current CVS
('stable').
Thanks to Eric for forwarding the patch. Committing them back into CVS
is mostly done now.

Many of the changes in Tom's kernel, when compared to 2035 plain, were
already there (or in a slightly different form), some are not.

I'm left with the small diff below of changes I do not understand.
Tom, can you explain?

1. config.c. Why use  instead of =? Is there a corner case with equality?
2. initoem.c:
+ if (ramsize == peek(0, RAMSIZE))
if (ramsize * 64 == ebdaseg  ramsize  640  peek(0, RAMSIZE) == ramsize)
   the extra double check looks strange to me, why check twice?
Something strange with short-circuit boolean evaluation?
3. int21/ax=3301. The comment and the code are out of sync. By falling
through it reports the new state of break_ena in DL (not AL).
Moreover, RBIL tells us that Novell DOS 7 report the *old* state
(instead of the new state) in DL. What is the intended logic here?

Thanks,
Bart

--- ke2035/kernel/config.c  2004-05-25 01:02:46.0 -0400
+++ ke2035ctom/kernel/config.c  2007-05-14 12:43:46.0 -0400
@@ -753,8 +753,8 @@
  if (timeout = 0) do
   {

 r.a.x = 0x0100; /* are there keys available ? */

 init_call_intr(0x16, r);

-if ((unsigned)(GetBiosTime() - startTime) = timeout * 18u)

+if ((unsigned)(GetBiosTime() - startTime)  timeout * 18u)

   return 0x;

   }

   while (r.flags  FLG_ZERO);

diff -urb ke2035/kernel/dsk.c ke2035ctom/kernel/dsk.c
+++ ke2035ctom/kernel/initoem.c 2007-05-14 12:43:46.0 -0400
@@ -58,7 +59,8 @@
   unsigned ebdaseg = peek(0, EBDASEG);

   unsigned ramsize = ram_top;



+  if (ramsize == peek(0, RAMSIZE))

   if (ramsize * 64 == ebdaseg  ramsize  640  peek(0, RAMSIZE) == ramsize)

   {

 unsigned ebdasz = peekb(ebdaseg, 0);

diff -urb ke2035/kernel/inthndlr.c ke2035ctom/kernel/inthndlr.c
--- ke2035/kernel/inthndlr.c2004-05-30 20:31:06.0 -0400
+++ ke2035ctom/kernel/inthndlr.c2007-05-14 12:43:46.0 -0400
@@ -78,17 +78,17 @@
 case 0x33:

   switch (irp-AL)

   {

+  /* Set Ctrl-C flag; returns al = break_ena  */

+case 0x01:

+  break_ena = irp-DL  1;

+  /* fall through */

+

   /* Get Ctrl-C flag  */

 case 0x00:

   irp-DL = break_ena;

   break;



-  /* Set Ctrl-C flag  */

-case 0x01:

-  break_ena = irp-DL  1;

-  break;

-

 case 0x02: /* andrew schulman: get/set extended
control break  */

   {

 UBYTE tmp = break_ena;

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Tom's kernel changes vs. CVS

2007-05-15 Thread tom ehlert
Hi Bart,

nice to see you're still alive :)

 Tom, can you explain?

 1. config.c. Why use  instead of =? Is there a corner case with equality?

IMO = is correct (timeout 0 should exit immediately)


 2. initoem.c:
 + if (ramsize == peek(0, RAMSIZE))
 if (ramsize * 64 == ebdaseg  ramsize  640  peek(0, RAMSIZE) == ramsize)
the extra double check looks strange to me, why check twice?
 Something strange with short-circuit boolean evaluation?

looks strange, and I have no idea why exactly this is there.

But since I put it in after ke2035, I just assume I did that
intentionally. (this was changed on or before 11.07.2004)

I'd leave it under 'it doesn't hurt'

 3. int21/ax=3301. The comment and the code are out of sync.

 By falling
 through it reports the new state of break_ena in DL (not AL).
right

besides that, the code should do the same in both cases (DL should be
00 or 01)

I don't mind much

Tom

 Moreover, RBIL tells us that Novell DOS 7 report the *old* state
 (instead of the new state) in DL. What is the intended logic here?

 Thanks,
 Bart

 --- ke2035/kernel/config.c  2004-05-25 01:02:46.0 -0400
 +++ ke2035ctom/kernel/config.c  2007-05-14 12:43:46.0 -0400
 @@ -753,8 +753,8 @@
   if (timeout = 0) do
{

  r.a.x = 0x0100; /* are there keys available ? */

  init_call_intr(0x16, r);

 -if ((unsigned)(GetBiosTime() - startTime) = timeout * 18u)

 +if ((unsigned)(GetBiosTime() - startTime)  timeout * 18u)

return 0x;

}

while (r.flags  FLG_ZERO);

 diff -urb ke2035/kernel/dsk.c ke2035ctom/kernel/dsk.c
 +++ ke2035ctom/kernel/initoem.c   2007-05-14 12:43:46.0 -0400
 @@ -58,7 +59,8 @@
unsigned ebdaseg = peek(0, EBDASEG);

unsigned ramsize = ram_top;



 +  if (ramsize == peek(0, RAMSIZE))

if (ramsize * 64 == ebdaseg  ramsize  640  peek(0, RAMSIZE) == 
 ramsize)

{

  unsigned ebdasz = peekb(ebdaseg, 0);

 diff -urb ke2035/kernel/inthndlr.c ke2035ctom/kernel/inthndlr.c
 --- ke2035/kernel/inthndlr.c2004-05-30 20:31:06.0 -0400
 +++ ke2035ctom/kernel/inthndlr.c2007-05-14 12:43:46.0 -0400
 @@ -78,17 +78,17 @@
  case 0x33:

switch (irp-AL)

{

 +  /* Set Ctrl-C flag; returns al = break_ena  */

 +case 0x01:

 +  break_ena = irp-DL  1;

 +  /* fall through */

 +

/* Get Ctrl-C flag  */

  case 0x00:

irp-DL = break_ena;

break;



 -  /* Set Ctrl-C flag  */

 -case 0x01:

 -  break_ena = irp-DL  1;

 -  break;

 -

  case 0x02: /* andrew schulman: get/set extended
 control break  */

{

  UBYTE tmp = break_ena;

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Freedos-kernel mailing list
 Freedos-kernel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Mit freundlichen Grüßen / Kind regards,
Tom Ehlert
+49-241-79886


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Tom's kernel changes vs. CVS

2007-05-15 Thread Eric Auer

Hi Bart, Tom,

some extra comment for

 2. initoem.c:
 + if (ramsize == peek(0, RAMSIZE))
 if (ramsize * 64 == ebdaseg  ramsize  640  peek(0, RAMSIZE) == ramsize)
the extra double check looks strange to me, why check twice?
 Something strange with short-circuit boolean evaluation?

... I got the recommendation do not move EBDA unless it starts
at the segment where low DOS RAM ends according to 40[13], as
another location could mean that something else fiddled with the
location / memory already. Of course that does not answer the
question why ramsize == peek(0, RAMSIZE) is checked for twice.

Eric

PS: Bart, could you make a list which things you merged in from
Tom's kernel and which you did not? I would like to compare it
to my own list... Thanks :-).

PPS: Did you also check in the changes from the kernel on my
homepage? If so, I hope you grabbed some of the changelog and
put it into the cvs logs. Good cvs logs are always very useful.
If you did not check in my changes yet, remind me to do myself ;-).


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Comparison of FreeDOS 2036 to the Tom kernel

2007-05-15 Thread Bart Oldeman
Part 2...

On 1/1/07, Eric Auer [EMAIL PROTECTED] wrote:
 inthndlr.c: Toms version modifies DL on return from int 21.3301
(set ctrl c flag), while the CVS does not - CVS is better.
TA -- discussed earlier
The CVS version uses the new dpb16to32 function for shorter code.
CN

TOMS version has some interesting extra error handling, maybe
this can be added to the CVS version: Around line 430, Tom does
if ErrorMode  AH=0c  AH neither 30 nor 59 then { ErrorMode=0;
fnode[0].f_count = 0; fnode[1].f_count = 0; } - in other words,
for the non-reentrant DOS functions, make sure to mark all near
fnodes as unused on entrance to int 21.
Later, around line 1550, if not both fnode counts are 0, force
them to be 0, but display a warning if ErrorMode was 0. Explanation:
An int24, for example in FindFirst, is handled by an app by NOT
returning to the kernel (possible). That way, resources are never
freed and ErrorMode is never reset...
Note that Tom only forces fnode freeing, not ErrorMode reset.
TA. This is also in the UNSTABLE kernel, to be exact I ported it from there.

FatGetDrvData modifies AX in Toms version and AL in CVS, which of
the two is better? See fcbfns.c
The FcbParseFname call of int 21.29 modifies AL directly in CVS,
while Toms version also updates rc. WHICH OF THE TWO IS BETTER?

CN (both)

Tom re-orders some register writes, which looks as if he tried
to set lr.ES / lr.DI as late as possible. Why? Optimizes better?
TA. Probably to allow the compiler to do common tail optimization. It
saves a few bytes.

The CVS version returns CX = 0 on int 21.30, while Tom returns
the REVISION numbers. A comment in CVS tells that CX must be 0
for 32RTM compatibility - found by Michael.
The int 21.36 implementation follows the different DosGetFree
parameter / return value structure in both versions.
The function int 21.??0a, set extended error, looks more optimized
in the CVS version. Both seem to have the same effect. COMMENTS?
In the CVS version, int 21.5f checks if cdsp-cdsDpb has a zero
offset, according to comments this checks if a drive is physical.
Sounds good...? This affects the handling of the AL==7 case.
The CVS version provides a more extended stub for the DBCS API
int 21.63xx ;-).
CN

The int2F_12_handler of the CVS version supports several new
functions: 26 (open), 27 (close), 29 (read). HOWEVER, the new
code for function 28 (seek) is disabled. WHY?
There is also a SET DOS VERSION DX interface at function 2f.
CN

 - intr.asm: Toms version has the following additional code:
global INTR / INTR: INTR (between the no_read_error: ret and
the segment INIT_TEXT around line 125). What is that used for?
Where is INTR defined?

TNA
right at the beginning: %macro INTR 0
called by Tom in two places.

 - ioctl.c looks BETTER IN TOMS version: r_command of the request
header is set based on al, using a table with the entries
0,0,C_IOCTLIN,C_IOCTLOUT,C_IOCTLIN,C_IOCTLOUT,C_ISTAT,C_OSTAT,
C_REMMEDIA,0,0,0,C_GENIOCTL,C_GENIOCTL,C_GETLDEV,C_SETLDEV,
C_IOCTLQRY,C_IOCTLQRY at slots 0..11 (hex). The CVS code, on
the other hand, spreads this information over two switch / case
areas which first set a nMode variable and later set r_command.
TA: This is a little optimization that is also present in the UNSTABLE
ioctl.c (which takes things a bit further). The table saves doing
everything seperately in switch cases. Actually ioctl can be made a
lot simpler with that table. Done in UNSTABLE, but I could do better
myself (saving ~200 bytes in the process), not applied yet.

 - main.c has an updated copyright string year in the CVS version.
Other differences seem to be whitespace-only around line 570 and
correcting a typo: TOM has the corrected boot from string around
line 735, while the CVS version writes booot from. One more diff
is around line 690: Is EmulatedDriveStatus nothing/void (Toms
version) or is it STATIC int (CVS version)...?
TA (for booot), the rest is CN.

 - memmgr.c: The CVS version allows double free of memory blocks,
which is necessary to be compatible with a flaw in QBasic 4...
CN

 - nls.c: TOMS version quotes quite some ASM code and sets many
registers before calling intr(0x2f,r): BH=0x14 BL=subfct CX=bufsize
SI=(short)nlsinfo BP=bp BX=cp DX=cntry ES:DI = pointer bp.
The CVS version, on the other hand, uses call_nls(subfct,
nlsInfo, bp, cp, cntry, bufsize, buf, id). WHICH OF THEM IS BETTER?
TO (none :) I applied something else that puts id in the high part
of a long, and no intr. It's a tricky variable because SS!=DS in that
code.

 - proto.h: The parameters / return types differ for DosGetFree,
FcbParseFname and FatGetDrvData. The CVS also has dpb16to32...
CN

 - serial.asm: The CVS version has ComInStat, which allows polling
the serial port status. Implemented based on a feature request

[Freedos-kernel] Comparison of FreeDOS 2036 to the Tom kernel

2007-05-15 Thread Bart Oldeman
Hi,

here is the point by point reply to Eric's list...
CN means: a new change in CVS independent of Tom (not present in the
2035-Tom diff)
TA means: Tom's change, applied
TNA means: Tom's change, not applied
TO means: Tom's change, other, see explanation.

On 12/31/06, Eric Auer [EMAIL PROTECTED] wrote:

 - Tom has a build2 bat file, which does a SYS CONFIG
on the kernel, copies the kernel to A:, and sorts the
map file. We could add that to the cvs.

TNA
He's had that for a long time, I always saw that as something Tom specific.
You certainly don't want to put it as is... as strange things will
happen, I'd get

Error reading from drive A: DOS area: sector not found
(A)bort, (I)gnore, (R)etry, (F)ail?

without a floppy drive...

 - buildall, build, default: more comments in cvs,
plus cvs has set dos4g=quiet
CN

 - bugs / build / lfnapi / mkboot / nls / sys / readme.txt:
at most differs in linebreak style? WHAT is 2. in mkboot??

There hasn't been a 2. in mkboot since at least May 2000.

Is the zip naming scheme still up to date in readme?
Does sys.txt describe all current stable SYS options?
CN (I don't know)

 - config.txt: cvs has a newer extended version
NOTE: I think there should be a FCBS note telling that
FreeDOS can provide FCBS without FCBS=... line?
The IF %config%==... example should use .
CN (Perhaps)

 - contrib.txt: cvs is newer, updates Bernd / Aitor
CN

 - fdkernel.lsm / version.h / globals.h differ, of course
NOTE that we no longer have REVISION_MAJOR nor
REVISION_MINOR as those were incompatible to 32RTM!
CN. Well you can still (sort of) derive them from the string via int21/ax=33ff

 - intfns.txt CVS version better describes the current state
QUESTION: Which int 2f functions are still missing?
Any volunteers for int 21.5d01 ... 21.5d05?
Typo in CVS: drive instead of driver for LFN
CN

 - readme.cvs CVS version is better, more up to date
CN

 - floppy.asm CVS version is slightly better, improved
comments. The FL_DISKCHANGED implementation is a bit
different but in the end seems to do the same thing.
Could anybody CHECK THAT?
TNA
Tom and Arkady (in CVS) both fixed the same bug with ret 8 but in
different ways: Arkady jumps backwards to ret_AH whereas Tom jumps
forwards.

 - filelist, makefile: CVS version provides more FreeDOS
style directory / zip file structure and no longer
includes autoexec / config / install bat files. IF we
had somewhat more useful SAMPLE CONFIG / autoexec, it
would make sense to include them, but for now, I prefer
the CVS style :-).
CN

 - device.h CVS version provides r_si and r_di but those
do not seem to be used yet?
CN should be in ioctl.c (see UNSTABLE branch). I'll do that later.

 - hdr.h CVS version makes intr() void, Tom uses unsigned
WHICH is better? CVS probably?
TO... Tom changed intr() in pcb.h (which was unused) to match up with
the one prototyped for init code, when he started using it for NLS and
floppy change notification.
I have instead, removed the intr() prototype. I thought, and still
think, that intr() is a bit too expensive (too many bytes) to use in
the resident code. Tom disagrees, but we've been through that :)

 - portab.h CVS version has some extra Watcom pragmas with
the comment min.unpacked size (default parm / modify)
I assume CVS is better?
The CVS version also has MK_SEG_PTR and MK_UWORD and
MK_ULONG, probably by Arkady, but I think those are not
yet actually used for much?
CN. I don't like those macros much, so I like it that they are hardly
used but we've been through that too :)

 - asmsupt.asm CVS version uses some FSTRCMP / _fstrcmp /
pascal_setup in Watcom, while Tom has that commented
out as still untested. WHICH IS BETTER?
CN. Now used in fatfs.c to prevent removal of current directory so tested.

 - config.c timeout is time  timeout in Tom version and
time = timeout in CVS version, the latter is maybe
better for 0 timeouts / hanging timers??
TNA as explained by Tom just now.

 - dosfns.c CVS DosGetFree returns UWORD (-1 for false)
instead of BOOL, so it no longer has a UWORD * spc
argument
NOTE: What is the purpose of spc = rg[0] in cvs?
   it was just moved up a bit, getting redirector data.
IsDevice has different handling of padding can be
with spaces or 00 bytes, probably having the same
effect in the end. Could somebody COMPARE both versions?
The CVS version also skips something for block devices.
CN. All those changes were on purpose, no changes in Tom's kernel.

 - dsk.c the TOM VERSION provides an call to int 2f.4a00
to ask a potential GUI whether it is okay to display
the insert disk a:/b:... DJ message as text. A GUI
can trap this and show a dialog box instead. VERY NICE.
TO. I have applied this but using a special purpose asm function to
avoid intr to sav e about 120 bytes.

NOTE that both versions have a typo: ... the any key ...
It's not a