Hi!
I'm implementing NLSFUNC for FreeDOS and I've found that many (most) of
the needed MUX functions are missing.
This patch implements functions 2F1226h to 2F1229h. This, together with
my previous nls.c patch, allowed me to make a first working
implementation of NLSFUNC's int 2F1404h, but the patch looks so simple
that I must have done something wrong :) so, kernel guys, please, have
a look at it. It is mainly cut'n'paste from int21_service()
Eduardo.
diff -uNrp ke2035.orig/kernel/inthndlr.c ke2035/kernel/inthndlr.c
--- ke2035.orig/kernel/inthndlr.c 2004-06-24 22:41:20.000000000 +0200
+++ ke2035/kernel/inthndlr.c 2004-06-24 22:41:09.000000000 +0200
@@ -1656,6 +1656,9 @@ struct int2f12regs {
*/
VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
{
+ COUNT rc;
+ long lrc;
+
if (r.AH == 0x4a)
{
size_t size = 0, offs = 0xffff;
@@ -1869,6 +1875,42 @@ VOID ASMCFUNC int2F_12_handler(struct in
r.CX = fstrlen(MK_FP(r.DS, r.SI)) + 1;
break;
+ case 0x26: /* open file */
+ r.FLAGS &= ~FLG_CARRY;
+ CritErrCode = SUCCESS;
+ lrc = DosOpen(MK_FP(r.DS, r.DX), O_LEGACY | O_OPEN | r.CL, 0);
+ goto long_check;
+
+ case 0x27: /* close file */
+ r.FLAGS &= ~FLG_CARRY;
+ CritErrCode = SUCCESS;
+ rc = DosClose(r.BX);
+ goto short_check;
+
+ case 0x28: /* move file pointer */
+ r.FLAGS &= ~FLG_CARRY;
+ CritErrCode = SUCCESS;
+ r.BP &= 0x00ff;
+ if (r.BP > 2)
+ goto error_invalid;
+ lrc = DosSeek(r.BX, (LONG)((((ULONG) (r.CX)) << 16) | r.DX),
r.BP);
+ if (lrc == -1)
+ {
+ lrc = DE_INVLDHNDL;
+ }
+ else
+ {
+ r.DX = (UWORD)(lrc >> 16);
+ lrc = (UWORD) lrc;
+ }
+ goto long_check;
+
+ case 0x29: /* read from file */
+ r.FLAGS &= ~FLG_CARRY;
+ CritErrCode = SUCCESS;
+ lrc = DosRead(r.BX, r.CX, MK_FP(r.DS, r.DX));
+ goto long_check;
+
case 0x2a: /* Set FastOpen but does nothing. */
r.FLAGS &= ~FLG_CARRY;
@@ -1897,6 +1939,26 @@ VOID ASMCFUNC int2F_12_handler(struct in
r.FLAGS |= FLG_CARRY;
}
}
+ goto real_exit;
+long_check:
+ if (lrc >= SUCCESS)
+ {
+ r.AX = (UWORD)lrc;
+ goto real_exit;
+ }
+ rc = (int)lrc;
+short_check:
+ if (rc < SUCCESS)
+ goto error_exit;
+ goto real_exit;
+error_invalid:
+ rc = DE_INVLDFUNC;
+error_exit:
+ r.AX = -rc;
+ if (CritErrCode == SUCCESS)
+ CritErrCode = r.AX; /* Maybe set */
+ r.FLAGS |= FLG_CARRY;
+real_exit:;
}
/*
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel