On Wednesday, May 5, 2021 at 8:05:40 PM UTC+10, JJ wrote:
> > Ok, true, you can do that. But if you do that, you can
> > avoid the CMDLINE altogether and just create a new
> > INT 21H function, can't you? And maybe that is the
> > superior solution, so that we can fix this "envseg"
> > issue in the parm block at the same time.
> Sure, the CMDLINE can be omitted and be replaced with a more elegant method,
> but didn't you said you want to make it easy to port programs to your OS? If
> you remove CMDLINE, you'll have more work porting those programs.
Sure, it's a tradeoff. I'm not expecting every MSDOS
program to work unchanged in the transition from
16-bit to 32-bit.
But e.g. every MSDOS program that was written in C90
will port with zero changes whatsoever, other than the
C library itself, which is to be expected.
But C90 doesn't give you the ability to retrieve file
attributes. But can that be done in a portable manner,
sticking reasonable close to INT 21H AH=43H. All it
needs is a wrapper function, ie:
int PosGetFileAttributes(const char *fnm,int *attr)
That seems perfectly reasonable to me. Gates could
have created that API function above and told everyone
to start using that instead of setting ds/dx manually,
in preparation for a move to 32-bit, and even a move
to 64-bit. The function above will work even for 256-bit.
So to the question of CMDLINE - I don't think much
application code is spend doing direct exec() calls
with long parameters. It is more likely to be hidden
in a system() call, so you just need the C runtime
library author to make that change, once.
I really don't care how difficult it is for a C runtime
library author to convert from 16-bit MSDOS to
32-bit and 64-bit. I only care about the application
programmer.
> > I don't care about the size of either. What I care about is
> > compatibility.
> In your case, there's no way to keep 100% compatibility due to platform
> difference. What you can do is to minimize the incompatibilities due to that
That's true for the 32-bit move, but the CMDLINE
solution works even for old versions of 16-bit
MSDOS, which seems like a good solution to me.
> > Very simple. No memory protection. You can write directly
> > to 0xb8000 and the SVGA graphics card without any fuss
> > at all. As you can in 16-bit MSDOS if you make it
> > 0xb800:0x0000
> >
> > This is 32-bit MSDOS, not 32-bit Windows.
> >
> > Actually I have a 32-bit Windows proposal too, but forget
> > about that for now, and let's agree what 32-bit MSDOS
> > should look like.
> OK.
>
> So, what if you treat segment fields as the upper 16-bit of the 32-bit flat
> address?
Is this just for exec() or in general?
It's a lot of work to go to just for exec(), and it still won't
work anyway. Because if you only provide the upper
16 bits, it means you need to be able to allocate memory
on a 64k boundary, requiring a non-standard call. As soon
as you start doing non-standard stuff, you may as well
just write the conditional code.
In addition, when you move to 64-bit, you will be presented
with the same problem. Are you going to make the segment
the upper 16 bits of a 64-bit address? Or perhaps arrange
for memory allocation below 4 GB so that the upper 32 bits
are all 0, the next 16 bits will come from the segment, and
the lower 16 bits will be 0. This manipulation requires
conditional compilation. And basically buys nothing.
BFN. Paul.