muta...@gmail.com
2021-04-27 08:35:38 UTC
Looking at the code for PDPCLIB and PDOS,
it seems that when a program does a:
system("fred abc");
that the maximum length of "abc" is governed
by what can fit in the PSP, starting at 0x80,
which means from 128 bytes you need to
subtract 1 byte for the length indicator itself,
and 1 byte for a compulsory '\r', so there are
126 bytes for the caller, and that is what is put
in the first byte.
I'd like to support more than that. Actually the
limit of a single byte is enough for me at the
moment, ie 254, but maybe it should be extended
even further, ie if someone puts 255 in that spot,
it means that the real length is in cmd[1] and
cmd[2]. And if both of those are x'FF' then the
real length is in cmd[3..6].
Anyway, if the length is anything above 126, then
how about calling a new INT 21H function to
retrieve an "extended parameter"?
I see there is already an extension for PDOS/386,
and it is isolated in the AH=F6H for PDOS/x86
extensions. Maybe that's where it should stay.
Any suggestions on the best way forward?
Is there any prior art for this? Maybe I can just
copy an existing solution. Unless it has some
disadvantage.
Thanks. Paul.
/* F6,3F - Get Command Line String For The Current Process */
char *PosGetCommandLine(void)
{
union REGS regsin;
union REGS regsout;
regsin.h.ah = 0xF6;
regsin.h.al = 0x3F;
int86(0x21, ®sin, ®sout);
return ((char *)(regsout.d.eax));
}
it seems that when a program does a:
system("fred abc");
that the maximum length of "abc" is governed
by what can fit in the PSP, starting at 0x80,
which means from 128 bytes you need to
subtract 1 byte for the length indicator itself,
and 1 byte for a compulsory '\r', so there are
126 bytes for the caller, and that is what is put
in the first byte.
I'd like to support more than that. Actually the
limit of a single byte is enough for me at the
moment, ie 254, but maybe it should be extended
even further, ie if someone puts 255 in that spot,
it means that the real length is in cmd[1] and
cmd[2]. And if both of those are x'FF' then the
real length is in cmd[3..6].
Anyway, if the length is anything above 126, then
how about calling a new INT 21H function to
retrieve an "extended parameter"?
I see there is already an extension for PDOS/386,
and it is isolated in the AH=F6H for PDOS/x86
extensions. Maybe that's where it should stay.
Any suggestions on the best way forward?
Is there any prior art for this? Maybe I can just
copy an existing solution. Unless it has some
disadvantage.
Thanks. Paul.
/* F6,3F - Get Command Line String For The Current Process */
char *PosGetCommandLine(void)
{
union REGS regsin;
union REGS regsout;
regsin.h.ah = 0xF6;
regsin.h.al = 0x3F;
int86(0x21, ®sin, ®sout);
return ((char *)(regsout.d.eax));
}